def testPixelControlLossScalarDiscount(self):
    """Compute loss for given observations, actions, values, scalar discount."""

    loss, _ = pixel_control_ops.pixel_control_loss(
        self.observations_ph, self.actions_ph, self.action_values_ph,
        self.cell_size, self.discount, self.scale)
    init = tf.global_variables_initializer()

    with self.test_session() as sess:
      sess.run(init)
      feed_dict = {
          self.observations_ph: self.observations,
          self.action_values_ph: self.action_values,
          self.actions_ph: self.actions}
      loss_np = sess.run(loss, feed_dict=feed_dict)
      self.assertNear(loss_np, self.error, 1e-3)
Compute loss for given observations, actions, values, scalar discount.
trfl/pixel_control_ops_test.py