def forward(self):
     self.cache = softmax(self.x.data)
     return Tensor(-self.y.data * np.log(self.cache + 1e-7))
Exemple #2
0
 def forward(self):
     return Tensor(log(self.x.data), diff=self.diff)
Exemple #3
0
 def forward(self):
     return Tensor(add(self.x.data, self.y.data), diff=self.diff)
Exemple #4
0
 def forward(self):
     self.cache = softmax(self.x.data)
     return Tensor(np.log(self.cache + 1e-7), diff=self.diff)
Exemple #5
0
 def cast_to_tensor(x: Union[float, Tensor]):
     if type(x) is float:
         x = Tensor(x)
     return x
Exemple #6
0
 def forward(self):
     return Tensor(forward(self.x.data, self.p), diff=self.diff)
Exemple #7
0
 def forward(self):
     self.cache = np.exp(self.x.data)
     return Tensor(self.cache, diff=self.diff)
Exemple #8
0
 def forward(self):
     self.cache = softmax(self.x.data)
     return Tensor(self.cache, diff=self.diff)