forked from tinygrad/tinygrad
fix GPU sign...these tests aren't very good
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ class Exp(Function):
|
||||
class Sign(Function):
|
||||
@staticmethod
|
||||
def forward(ctx, input):
|
||||
return unary_op(ctx, 'a >= 0', input)
|
||||
return unary_op(ctx, '(a > 0) - (a < 0)', input)
|
||||
|
||||
@staticmethod
|
||||
def backward(ctx, grad_output):
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ class Tensor:
|
||||
return self * (self.softplus().tanh()) # x*tanh(softplus(x))
|
||||
|
||||
def abs(self):
|
||||
return self.relu() + (-1.0*self).relu()
|
||||
return self * self.sign()
|
||||
|
||||
def _pool2d(self, py, px):
|
||||
xup = self[:, :, :self.shape[2]-self.shape[2]%py, :self.shape[3]-self.shape[3]%px]
|
||||
|
||||
Reference in New Issue
Block a user