message: Prepare tensorflow/python/eager:ops_test for Tensor equality.
diff: @@ -189,8 +189,16 @@ class OpsTest(test_util.TensorFlowTestCase):
  self.assertAllEqual((a <= b), np.less_equal(v1, v2))
  self.assertAllEqual((a > b), np.greater(v1, v2))
  self.assertAllEqual((a >= b), np.greater_equal(v1, v2))
  +
  + # TODO(b/120678848): Remove the else branch once we enable
  + # ops.Tensor._USE_EQUALITY by default.
  + if ops.Tensor._USE_EQUALITY:
  + self.assertAllEqual((a == b), np.equal(v1, v2))
  + self.assertAllEqual((a != b), np.not_equal(v1, v2))
  + else:
  self.assertAllEqual((a == b), np.equal(v1, v2)[0])
  self.assertAllEqual((a != b), np.not_equal(v1, v2)[0])
  +
  self.assertAllEqual(v1[0], a[constant_op.constant(0)])
  ops_test([1, 4, 8], [2, 3, 5])
  @@ -407,18 +415,23 @@ class OpsTest(test_util.TensorFlowTestCase):
  def testWeakKeyDictionaryTensor(self):
  weak_key_dict = weakref.WeakKeyDictionary()
  +
  strong_x = constant_op.constant([[1.]])
  strong_y = constant_op.constant([[2.]])
  - weak_key_dict[strong_x] = constant_op.constant([[3.]])
  - weak_key_dict[strong_y] = constant_op.constant([[4.]])
  + strong_x_ref = strong_x.experimental_ref()
  + strong_y_ref = strong_y.experimental_ref()
  + weak_key_dict[strong_x_ref] = constant_op.constant([[3.]])
  + weak_key_dict[strong_y_ref] = constant_op.constant([[4.]])
  strong_y.a = constant_op.constant([[5.]])
  - weak_x = weakref.ref(strong_x)
  - del strong_x
  - self.assertIs(weak_x(), None)
  - self.assertEqual([strong_y], list(weak_key_dict))
  + weak_x_ref = weakref.ref(strong_x)
  +
  + del strong_x, strong_x_ref
  + self.assertIs(weak_x_ref(), None)
  + self.assertEqual([strong_y_ref], list(weak_key_dict))
  self.assertEqual(1, len(list(weak_key_dict)))
  self.assertEqual(1, len(weak_key_dict))
  - del strong_y
  +
  + del strong_y, strong_y_ref
  self.assertEqual([], list(weak_key_dict))
  def testEagerTensorsCanBeGarbageCollected(self):
  