Ejemplo n.º 1
0
    def test_transpose_batch_time_rank_unknown(self):
        with self.test_session(graph=tf.Graph()):
            tensor = tf.placeholder(tf.float32, shape=None)

            with self.assertRaisesRegexp(ValueError,
                                         "Tensor with unknown rank"):
                tensor_utils.transpose_batch_time(tensor)
Ejemplo n.º 2
0
    def test_transpose_batch_time_rank_1(self):
        with self.test_session(graph=tf.Graph()):
            tensor = tf.constant([1, 2, 3])

            transposed = tensor_utils.transpose_batch_time(tensor)

            self.assertAllEqual(transposed.eval(), [1, 2, 3])
Ejemplo n.º 3
0
    def test_transpose_batch_time_rank_2(self):
        with self.test_session(graph=tf.Graph()):
            tensor = tf.constant([[1, 2], [3, 4]])  # pyformat: disable

            transposed = tensor_utils.transpose_batch_time(tensor)

            self.assertAllEqual(transposed.eval(),
                                [[1, 3], [2, 4]])  # pyformat: disable