The example how to get the output shape of operator after defined an operator in a network.
Created by: qingqing01
For example:
import paddle.v2.fluid as fluid
import paddle.v2.fluid.layers as layers
dshape = [4, 3, 28, 28]
data = layers.data(name='data', shape=[3, 28, 28], dtype='float32')
conv = layers.conv2d(data, 20, 3, stride=[1, 1], padding=[1, 1])
print conv.shape
The output is:
(-1L, 20L, 28L, 28L)
Since the type of dimension in Tensor is int64_t
, the integer in shape is 20L
, 28L
.