def test_Repeat_pickle(): tg = TensorGraph() feature = Feature(shape=(tg.batch_size, 1)) layer = Repeat(n_times=10, in_layers=feature) tg.add_output(layer) tg.set_loss(layer) tg.build() tg.save()
def test_repeat(self): """Test that Repeat can be invoked.""" in_dim = 4 batch_size = 10 n_repeat = 2 in_tensor = np.random.rand(batch_size, in_dim) with self.session() as sess: in_tensor = tf.convert_to_tensor(in_tensor, dtype=tf.float32) out_tensor = Repeat(n_repeat)(in_tensor) out_tensor = out_tensor.eval() assert out_tensor.shape == (batch_size, n_repeat, in_dim)