示例#1
0
 def fprop(self):
     # -target * log(pred)
     tmp1 = self.pred.array + self.eps
     ca.log(tmp1, tmp1)
     tmp1 *= self.target.array
     ca.sum(tmp1, axis=1, out=self.array)
     ca.negative(self.array, self.array)
示例#2
0
 def bprop(self):
     if self.lhs.bpropable:
         ca.divide(self.grad_array, self.rhs.array, out=self.lhs.grad_array)
     if self.rhs.bpropable:
         ca.multiply(self.grad_array, self.array, out=self.rhs.grad_array)
         self.rhs.grad_array /= self.rhs.array
         ca.negative(self.rhs.grad_array, out=self.rhs.grad_array)
示例#3
0
 def bprop(self):
     if self.lhs_bprop:
         ca.divide(self.out_grad, self.rhs.out, out=self.lhs.out_grad)
     if self.rhs_bprop:
         ca.multiply(self.out_grad, self.out, out=self.rhs.out_grad)
         self.rhs.out_grad /= self.rhs.out
         ca.negative(self.rhs.out_grad, out=self.rhs.out_grad)
示例#4
0
 def bprop(self):
     if self.lhs_bprop:
         ca.divide(self.out_grad, self.rhs.out, out=self.lhs.out_grad)
     if self.rhs_bprop:
         ca.multiply(self.out_grad, self.out, out=self.rhs.out_grad)
         self.rhs.out_grad /= self.rhs.out
         ca.negative(self.rhs.out_grad, out=self.rhs.out_grad)
示例#5
0
文件: loss.py 项目: EricSchles/deeppy
 def fprop(self):
     # -target * log(pred)
     tmp1 = self.pred.array + self.eps
     ca.log(tmp1, tmp1)
     tmp1 *= self.target.array
     ca.sum(tmp1, axis=1, out=self.array)
     ca.negative(self.array, self.array)
示例#6
0
 def bprop(self):
     if self.lhs.bpropable:
         ca.divide(self.grad_array, self.rhs.array, out=self.lhs.grad_array)
     if self.rhs.bpropable:
         ca.multiply(self.grad_array, self.array, out=self.rhs.grad_array)
         self.rhs.grad_array /= self.rhs.array
         ca.negative(self.rhs.grad_array, out=self.rhs.grad_array)
 def fprop(self):
     tmp1 = self.mu.array**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.logvar.array
     tmp1 += 1
     tmp1 -= ca.exp(self.logvar.array)
     ca.sum(tmp1, axis=self.axis, out=self.array)
     self.array *= -0.5
 def fprop(self):
     tmp1 = self.mu.out**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.log_sigma.out
     tmp1 += 1
     tmp1 -= ca.exp(self.log_sigma.out)
     ca.sum(tmp1, axis=1, keepdims=True, out=self.out)
     self.out *= -0.5
示例#9
0
 def fprop(self):
     tmp1 = self.mu.out**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.log_sigma.out
     tmp1 += 1
     tmp1 -= ca.exp(self.log_sigma.out)
     self.out = ca.sum(tmp1)
     self.out *= -0.5
示例#10
0
 def fprop(self):
     tmp1 = self.mu.out**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.log_sigma.out
     tmp1 += 1
     tmp1 -= ca.exp(self.log_sigma.out)
     self.out = ca.sum(tmp1)
     self.out *= -0.5
示例#11
0
 def fprop(self):
     tmp1 = self.mu.array**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.logvar.array
     tmp1 += 1
     tmp1 -= ca.exp(self.logvar.array)
     ca.sum(tmp1, axis=self.axis, out=self.array)
     self.array *= -0.5
示例#12
0
 def fprop(self):
     tmp1 = self.mu.array**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.log_sigma.array
     tmp1 += 1
     tmp1 -= ca.exp(self.log_sigma.array)
     self.array = ca.sum(tmp1)
     self.array *= -0.5
 def fprop(self):
     tmp1 = self.mu.array**2
     ca.negative(tmp1, tmp1)
     tmp1 += self.log_sigma.array
     tmp1 += 1
     tmp1 -= ca.exp(self.log_sigma.array)
     self.array = ca.sum(tmp1)
     self.array *= -0.5
示例#14
0
 def bprop(self):
     ca.negative(self.out_grad, self.x.out_grad)
示例#15
0
 def bprop(self):
     ca.negative(self.grad_array, self.x.grad_array)
示例#16
0
 def bprop(self):
     if self.lhs_bprop:
         self.lhs.out_grad = self.out_grad
     if self.rhs_bprop:
         ca.negative(self.out_grad, out=self.rhs.out_grad)
示例#17
0
 def bprop(self):
     ca.negative(self.grad_array, self.x.grad_array)
示例#18
0
 def bprop(self):
     ca.negative(self.out_grad, out=self.x.out_grad)
示例#19
0
 def fprop(self):
     ca.negative(self.x.out, out=self.out)
示例#20
0
 def fprop(self):
     ca.negative(self.x.out, out=self.out)
示例#21
0
 def bprop(self):
     if self.lhs_bprop:
         self.lhs.out_grad = self.out_grad
     if self.rhs_bprop:
         ca.negative(self.out_grad, out=self.rhs.out_grad)
示例#22
0
 def bprop(self):
     ca.negative(self.x.out, self.x.out_grad)
     ca.exp(self.x.out_grad, self.x.out_grad)
     self.x.out_grad += 1
     ca.divide(1.0, self.x.out_grad, out=self.x.out_grad)
     self.x.out_grad *= self.out_grad
示例#23
0
 def bprop(self):
     if self.lhs.bpropable:
         self.lhs.grad_array = self.grad_array
     if self.rhs.bpropable:
         ca.negative(self.grad_array, out=self.rhs.grad_array)
示例#24
0
 def fprop(self):
     ca.negative(self.x.array, out=self.array)
示例#25
0
 def fprop(self):
     ca.negative(self.x.array, out=self.array)
示例#26
0
 def bprop(self):
     if self.lhs.bpropable:
         self.lhs.grad_array = self.grad_array
     if self.rhs.bpropable:
         ca.negative(self.grad_array, out=self.rhs.grad_array)