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