Beispiel #1
0
 def test_transpose(self):
     """Test that Transpose can be invoked."""
     in_dim_1 = 2
     in_dim_2 = 7
     batch_size = 10
     in_tensor = np.random.rand(batch_size, in_dim_1, in_dim_2)
     with self.session() as sess:
         in_tensor = tf.convert_to_tensor(in_tensor, dtype=tf.float32)
         out_tensor = Transpose((0, 2, 1))(in_tensor)
         out_tensor = out_tensor.eval()
         assert out_tensor.shape == (batch_size, in_dim_2, in_dim_1)
Beispiel #2
0
 def test_transpose(self):
   """Test that Transpose can be invoked."""
   in_dim_1 = 2
   in_dim_2 = 7
   batch_size = 10
   in_tensor = np.random.rand(batch_size, in_dim_1, in_dim_2)
   with self.session() as sess:
     in_tensor = tf.convert_to_tensor(in_tensor, dtype=tf.float32)
     out_tensor = Transpose((0, 2, 1))(in_tensor)
     out_tensor = out_tensor.eval()
     assert out_tensor.shape == (batch_size, in_dim_2, in_dim_1)
Beispiel #3
0
def test_Transpose_pickle():
  tg = TensorGraph()
  feature = Feature(shape=(tg.batch_size, 1))
  layer = Transpose(perm=(1, 0), in_layers=feature)
  tg.add_output(layer)
  tg.set_loss(layer)
  tg.build()
  tg.save()