def backward_cpu(self, inputs, grad_outputs):
x, W = inputs[:2]
Wb = binarize_cpu(W)
b = inputs[2] if len(inputs) == 3 else None
gy = grad_outputs[0]
h, w = x.shape[2:]
gW = numpy.tensordot(gy, self.col, ((0, 2, 3), (0, 4, 5)))
gcol = numpy.tensordot(Wb, gy, (0, 1))
gcol = numpy.rollaxis(gcol, 3)
gx = conv.col2im_cpu(gcol, self.sy, self.sx, self.ph, self.pw, h, w)
if b is None:
return gx, gW
else:
gb = gy.sum(axis=(0, 2, 3))
return gx, gW, gb
function_binary_xnor_convolution_2d.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录