Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
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)
Exemplo n.º 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)
Exemplo n.º 7
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
 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 13
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
Exemplo n.º 14
0
 def bprop(self):
     ca.negative(self.out_grad, self.x.out_grad)
Exemplo n.º 15
0
 def bprop(self):
     ca.negative(self.grad_array, self.x.grad_array)
Exemplo n.º 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)
Exemplo n.º 17
0
 def bprop(self):
     ca.negative(self.grad_array, self.x.grad_array)
Exemplo n.º 18
0
 def bprop(self):
     ca.negative(self.out_grad, out=self.x.out_grad)
Exemplo n.º 19
0
 def fprop(self):
     ca.negative(self.x.out, out=self.out)
Exemplo n.º 20
0
 def fprop(self):
     ca.negative(self.x.out, out=self.out)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 24
0
 def fprop(self):
     ca.negative(self.x.array, out=self.array)
Exemplo n.º 25
0
 def fprop(self):
     ca.negative(self.x.array, out=self.array)
Exemplo n.º 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)