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