padding & stride
from mxnet import autograd,nd from mxnet import gluon,init from mxnet.gluon import nn,loss as gloss from mxnet.gluon import data as gdata def comp_conv2d(conv2d,X): conv2d.initialize() # (样本,通道,高,宽) X = X.reshape((1,1)+X.shape) #print(X.shape) Y = conv2d(X) return Y conv2d = nn.Conv2D(1,kernel_size=(3,3),padding=1) X = nd.random.uniform(shape=(8,8)) #print(X) #print(comp_conv2d(conv2d,X).shape) conv2d = nn.Conv2D(1,kernel_size=(5,3),padding=(2,1)) #print(comp_conv2d(conv2d,X).shape) conv2d = nn.Conv2D(1,kernel_size=3,padding=1,strides=2) print(comp_conv2d(conv2d,X).shape) conv2d = nn.Conv2D(1,kernel_size=(3,5),padding=(0,1),strides=(3,4)) print(comp_conv2d(conv2d,X).shape)