def conv(self,
input,
k_h,
k_w,
c_o,
s_h,
s_w,
name,
relu=True,
padding=DEFAULT_PADDING,
group=1,
biased=True):
input = pad_if_needed(input, padding, 'conv2d', k_h, k_w, s_h, s_w)
result = F.conv2d(input,
self.weights[name + '/weights'],
bias=self.weights[name + '/biases'] if biased else None,
padding=0,
groups=group,
stride=(s_h, s_w))
if relu:
result = F.relu(result)
return result
评论列表
文章目录