mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-08-29 14:16:06 +00:00
remove *0 hack in sign, gradient materializes zeros for unconnected nodes (#15416)
Amp-Thread-ID: https://ampcode.com/threads/T-019d1612-6322-706b-a94d-a812400a55cb Co-authored-by: Amp <[email protected]>
This commit is contained in:
@@ -677,7 +677,7 @@ class ElementwiseMixin(DTypeMixin):
|
||||
print(Tensor([-3., -2., -1., 0., 1., 2., 3.]).sign().numpy())
|
||||
```
|
||||
"""
|
||||
return self.ne(0).where((self < 0).where(self.const_like(-1), self.const_like(1)), self.const_like(0)) + self * 0
|
||||
return self.ne(0).where((self < 0).where(self.const_like(-1), self.const_like(1)), self.const_like(0))
|
||||
|
||||
def abs(self) -> Self:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user