def test_MaxPool3D_pickle(): tg = TensorGraph() feature = Feature(shape=(tg.batch_size, 10, 10, 10, 10)) layer = MaxPool3D(in_layers=feature) tg.add_output(layer) tg.set_loss(layer) tg.build() tg.save()
def test_max_pool_3D(self): """Test that MaxPool3D can be invoked.""" length = 2 width = 2 depth = 2 in_channels = 2 batch_size = 20 in_tensor = np.random.rand(batch_size, length, width, depth, in_channels) with self.session() as sess: in_tensor = tf.convert_to_tensor(in_tensor, dtype=tf.float32) out_tensor = MaxPool3D()(in_tensor) sess.run(tf.global_variables_initializer()) out_tensor = out_tensor.eval() assert out_tensor.shape == (batch_size, 1, 1, 1, in_channels)