Beispiel #1
0
 def test_generator_does_not_raise(self):
     generator_of_stuff = (tf.constant([11, 22]), tf.constant([1, 2]))
     tf.assert_proper_iterable(generator_of_stuff)
Beispiel #2
0
 def test_non_iterable_object_raises(self):
     non_iterable = 1234
     with self.assertRaisesRegexp(TypeError, "to be iterable"):
         tf.assert_proper_iterable(non_iterable)
Beispiel #3
0
 def test_list_does_not_raise(self):
     list_of_stuff = [tf.constant([11, 22]), tf.constant([1, 2])]
     tf.assert_proper_iterable(list_of_stuff)
Beispiel #4
0
 def test_single_ndarray_raises(self):
     array = np.array([1, 2, 3])
     with self.assertRaisesRegexp(TypeError, "proper"):
         tf.assert_proper_iterable(array)
Beispiel #5
0
 def test_single_string_raises(self):
     mystr = "hello"
     with self.assertRaisesRegexp(TypeError, "proper"):
         tf.assert_proper_iterable(mystr)
Beispiel #6
0
 def test_single_tensor_raises(self):
     tensor = tf.constant(1)
     with self.assertRaisesRegexp(TypeError, "proper"):
         tf.assert_proper_iterable(tensor)
Beispiel #7
0
 def test_single_sparse_tensor_raises(self):
     ten = tf.SparseTensor(indices=[[0, 0], [1, 2]],
                           values=[1, 2],
                           shape=[3, 4])
     with self.assertRaisesRegexp(TypeError, "proper"):
         tf.assert_proper_iterable(ten)
Beispiel #8
0
 def test_list_does_not_raise(self):
   list_of_stuff = [tf.constant([11, 22]), tf.constant([1, 2])]
   tf.assert_proper_iterable(list_of_stuff)
Beispiel #9
0
 def test_generator_does_not_raise(self):
   generator_of_stuff = (tf.constant([11, 22]), tf.constant([1, 2]))
   tf.assert_proper_iterable(generator_of_stuff)
Beispiel #10
0
 def test_non_iterable_object_raises(self):
   non_iterable = 1234
   with self.assertRaisesRegexp(TypeError, "to be iterable"):
     tf.assert_proper_iterable(non_iterable)
Beispiel #11
0
 def test_single_string_raises(self):
   mystr = "hello"
   with self.assertRaisesRegexp(TypeError, "proper"):
     tf.assert_proper_iterable(mystr)
Beispiel #12
0
 def test_single_ndarray_raises(self):
   array = np.array([1, 2, 3])
   with self.assertRaisesRegexp(TypeError, "proper"):
     tf.assert_proper_iterable(array)
Beispiel #13
0
 def test_single_sparse_tensor_raises(self):
   ten = tf.SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], shape=[3, 4])
   with self.assertRaisesRegexp(TypeError, "proper"):
     tf.assert_proper_iterable(ten)
Beispiel #14
0
 def test_single_tensor_raises(self):
   tensor = tf.constant(1)
   with self.assertRaisesRegexp(TypeError, "proper"):
     tf.assert_proper_iterable(tensor)