def testDimRestErrors(self):
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, -1, 2])
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, -1, -1])
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, 14])
 def testDimRestErrors(self):
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, -1, 2])
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, -1, -1])
   with self.assertRaises(ValueError):
     pretty_tensor_methods._infer_unknown_dims([2, 3, 5], [DIM_SAME, 14])
Example #3
0
 def testReshapeWithTooManyUnknownDim(self):
     shape = pretty_tensor_methods._infer_unknown_dims([None, 3, None],
                                                       '_*')
     self.assertEquals(['_', -1], shape)
Example #4
0
 def testReshapeWithTwoLegalUnknownDim(self):
     shape = pretty_tensor_methods._infer_unknown_dims([2, None, None],
                                                       '_*')
     self.assertEquals([2, -1], shape)
Example #5
0
 def testReshapeWithUnknownBatch(self):
     shape = pretty_tensor_methods._infer_unknown_dims([None, 3, 5], '_*')
     self.assertEquals(['_', 15], shape)
 def testReshapeWithTooManyUnknownDim(self):
   shape = pretty_tensor_methods._infer_unknown_dims([None, 3, None], '_*')
   self.assertEquals(['_', -1], shape)
 def testReshapeWithTwoLegalUnknownDim(self):
   shape = pretty_tensor_methods._infer_unknown_dims([2, None, None], '_*')
   self.assertEquals([2, -1], shape)
 def testReshapeWithUnknownBatch(self):
   shape = pretty_tensor_methods._infer_unknown_dims([None, 3, 5], '_*')
   self.assertEquals(['_', 15], shape)