Example #1
0
 def test_length_3_tensor_works(self):
   with self.test_session():
     tensor = tf.constant([1, 2, 3], dtype=tf.float32)
     result = histogram_ops._strict_1d_cumsum(tensor, 3)
     expected = tf.constant([1, 3, 6], dtype=tf.float32)
     np.testing.assert_array_equal(expected.eval(), result.eval())
 def test_length_1_tensor_works(self):
   with self.cached_session():
     tensor = constant_op.constant([3], dtype=dtypes.float32)
     result = histogram_ops._strict_1d_cumsum(tensor, 1)
     expected = constant_op.constant([3], dtype=dtypes.float32)
     np.testing.assert_array_equal(expected.eval(), result.eval())
Example #3
0
 def test_empty_tensor_returns_empty(self):
   with self.test_session():
     tensor = tf.constant([])
     result = histogram_ops._strict_1d_cumsum(tensor, 0)
     expected = tf.constant([])
     np.testing.assert_array_equal(expected.eval(), result.eval())
Example #4
0
 def test_length_1_tensor_works(self):
   with self.test_session():
     tensor = constant_op.constant([3], dtype=dtypes.float32)
     result = histogram_ops._strict_1d_cumsum(tensor, 1)
     expected = constant_op.constant([3], dtype=dtypes.float32)
     np.testing.assert_array_equal(expected.eval(), result.eval())