def backward_compute(self):
m = np.size(self.images,0)
self.delta = self.delta.reshape(m,self.channel,self.height,self.width)
newDelta = np.zeros([m,self.last_layer.channel,self.last_layer.height,self.last_layer.width])
for i in range(m):
for j in range(self.channel):
for h in range(self.height):
for w in range(self.width):
tmpLoc = self.maxIndex[i,j,h*self.width+w]
relativeH = tmpLoc//self.squareSize
relativeW = tmpLoc - relativeH * self.squareSize
lastW = w*self.stride+relativeW
lastH = h*self.stride+relativeH
newDelta[i,j,lastH,lastW] += self.delta[i,j,h,w]
self.last_layer.delta = newDelta
pass
评论列表
文章目录