Exemple #1
0
 def bprop(self, grad, input, output, outGrad):
   if self.dropRate > 0.0:
     gpu_copy_to(grad * self.dropMask, grad)
  
   gpu_copy_to(transpose(dot(transpose(grad), self.weight.wt)), outGrad)
   
   self.weight.set_grad(dot(grad, transpose(input)))
   add_row_sum_to_vec(self.bias.grad, grad, alpha=0.0)
Exemple #2
0
 def bprop(self, grad, input, output, outGrad):
   if self.dropRate > 0.0:
     gpu_copy_to(grad * self.dropMask, grad)
  
   gpu_copy_to(transpose(dot(transpose(grad), self.weight.wt)), outGrad)
   
   self.weight.set_grad(dot(grad, transpose(input)))
   add_row_sum_to_vec(self.bias.grad, grad, alpha=0.0)
Exemple #3
0
 def bprop(self, grad, input, output, outGrad):
   self.weight.grad.fill(0)
   self.bias.grad.fill(0)
  
   # bprop to next layer
   cudaconv2.localImgActs(grad, self.weight.wt, outGrad, self.img_size, self.img_size,
       self.outputSize, -self.padding, self.stride, self.numColor, 1, 0.0, 1.0)
   
   # bprop weight
   cudaconv2.localWeightActs(input, grad, self.weight.grad, self.img_size, self.outputSize,
       self.outputSize, self.filterSize, -self.padding, self.stride, self.numColor, 1, 0.0, 1.0)
   
   # bprop bias
   add_row_sum_to_vec(self.bias.grad, grad)
Exemple #4
0
 def bprop(self, grad, input, output, outGrad):
   self.weight.grad.fill(0)
   self.bias.grad.fill(0)
  
   # bprop to next layer
   cudaconv2.localImgActs(grad, self.weight.wt, outGrad, self.img_size, self.img_size,
       self.outputSize, -self.padding, self.stride, self.numColor, 1, 0.0, 1.0)
   
   # bprop weight
   cudaconv2.localWeightActs(input, grad, self.weight.grad, self.img_size, self.outputSize,
       self.outputSize, self.filterSize, -self.padding, self.stride, self.numColor, 1, 0.0, 1.0)
   
   # bprop bias
   add_row_sum_to_vec(self.bias.grad, grad)