mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-19 02:44:40 -05:00
UnaryOps.NEG (#1749)
This commit is contained in:
@@ -534,6 +534,7 @@ class Tensor:
|
||||
|
||||
# ***** mlops (unary) *****
|
||||
|
||||
def __neg__(self): return mlops.Neg.apply(self)
|
||||
def contiguous(self): return mlops.Contiguous.apply(self)
|
||||
def contiguous_backward(self): return mlops.ContiguousBackward.apply(self)
|
||||
def log(self): return mlops.Log.apply(self)
|
||||
@@ -557,7 +558,6 @@ class Tensor:
|
||||
def ceil(self: Tensor) -> Tensor: return (self > (b := self.trunc())).where(b+1, b)
|
||||
def floor(self: Tensor) -> Tensor: return (self < (b := self.trunc())).where(b-1, b)
|
||||
|
||||
def __neg__(self): return 0.0-self
|
||||
def square(self): return self*self
|
||||
def clip(self, min_, max_): return self.maximum(min_).minimum(max_)
|
||||
def abs(self): return self.relu() + (-self).relu()
|
||||
|
||||
Reference in New Issue
Block a user