From 1dcef3f766a6d2dc1dbedd2090382324eecafeb9 Mon Sep 17 00:00:00 2001 From: onehr Date: Tue, 14 Nov 2017 18:01:38 +0800 Subject: [PATCH] The interface of DownsampleFactorMax has been changed to Pool ``` Interface Changes: - Rename DownsampleFactorMax to Pool. - tensor.stack now uses the same interface as numpy.stack - optimizer=fast_compile moves computation to the GPU - Raise the user stack trace more frequently. - Change dev version numbering to follow the PEP 440 ``` from [https://pypi.python.org/pypi/Theano/0.8.0] --- src/convnet3d/maxpool3d.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/convnet3d/maxpool3d.py b/src/convnet3d/maxpool3d.py index 0491bec..78263ca 100644 --- a/src/convnet3d/maxpool3d.py +++ b/src/convnet3d/maxpool3d.py @@ -5,8 +5,7 @@ from theano import tensor -from theano.tensor.signal.downsample import DownsampleFactorMax - +from theano.tensor.signal.pool import Pool def max_pool_3d(input, ds, ignore_border=False): """ @@ -46,7 +45,7 @@ def max_pool_3d(input, ds, ignore_border=False): input_4D = tensor.reshape(input, new_shape, ndim=4) # downsample mini-batch of videos in rows and cols - op = DownsampleFactorMax((ds[1],ds[2]), ignore_border) + op = Pool((ds[1],ds[2]), ignore_border) output = op(input_4D) # restore to original shape outshape = tensor.join(0, input.shape[:-2], output.shape[-2:]) @@ -70,10 +69,10 @@ def max_pool_3d(input, ds, ignore_border=False): vid_shape), 'int32') input_4D_time = tensor.reshape(input_time, new_shape, ndim=4) # downsample mini-batch of videos in time - op = DownsampleFactorMax((1,ds[0]), ignore_border) + op = Pool((1,ds[0]), ignore_border) outtime = op(input_4D_time) # output # restore to original shape (xxx, rows, cols, time) outshape = tensor.join(0, input_time.shape[:-2], outtime.shape[-2:]) shufl = (list(range(vid_dim-3)) + [vid_dim-1]+[vid_dim-3]+[vid_dim-2]) - return tensor.reshape(outtime, outshape, ndim=input.ndim).dimshuffle(shufl) \ No newline at end of file + return tensor.reshape(outtime, outshape, ndim=input.ndim).dimshuffle(shufl)