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