TST: add unit test

This commit is contained in:
Yan Facai (颜发才) 2017-08-23 13:42:34 +08:00 committed by Martin Wicke
parent 0563e1f6bf
commit 0c9ddf3ffd

View File

@ -314,6 +314,16 @@ class TensorUtilTest(test.TestCase):
shape=[3, 4],
dtype=dtype)))
def testIntMixedWithDimension(self):
dtype = dtypes.int32
nptype = np.int32
t = tensor_util.make_tensor_proto([10, tensor_shape.Dimension(20), 30],
dtype=dtype)
self.assertEquals(dtype, t.dtype)
a = tensor_util.MakeNdarray(t)
self.assertEquals(nptype, a.dtype)
self.assertAllClose(np.array([10, 20, 30], dtype=nptype), a)
def testLong(self):
t = tensor_util.make_tensor_proto(10, dtype=dtypes.int64)
self.assertProtoEquals("""