예제 #1
0
 def testMatmulError(self):
     with self.assertRaisesRegex(ValueError, r''):
         math_ops.matmul(array_ops.ones([], np.int32),
                         array_ops.ones([2, 3], np.int32))
     with self.assertRaisesRegex(ValueError, r''):
         math_ops.matmul(array_ops.ones([2, 3], np.int32),
                         array_ops.ones([], np.int32))
예제 #2
0
    def testOnes(self):
        for s in self.all_shapes:
            actual = array_ops.ones(s)
            expected = np.ones(s)
            msg = 'shape: {}'.format(s)
            self.match(actual, expected, msg)

        for s, t in itertools.product(self.all_shapes, self.all_types):
            actual = array_ops.ones(s, t)
            expected = np.ones(s, t)
            msg = 'shape: {}, dtype: {}'.format(s, t)
            self.match(actual, expected, msg)