smarter way to write sign
MODIFY
tinygrad/tensor.py
tinygrad/tensor.py
@@ -277,7 +277,7 @@ class Tensor:
return self.relu() + (-1.0*self).relu()
def sign(self):
- return self.abs() / (self+1e-10)
+ return self / (self.abs() + 1e-10)
def _pool2d(self, py, px):
xup = self[:, :, :self.shape[2]-self.shape[2]%py, :self.shape[3]-self.shape[3]%px]

smarter way to write sign