Skip to content

Commit 6815005

Browse files
committed
MAINT: add np.invert/bitwise_not
1 parent 37dcf49 commit 6815005

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

torch_np/_ufunc_impl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ def wrapped(x1, /, out=None, *, where=True,
138138
tanh = deco_unary_ufunc(torch.tanh)
139139
trunc = deco_unary_ufunc(torch.trunc)
140140

141+
invert = deco_unary_ufunc(torch.bitwise_not)
142+
141143
# special cases: torch does not export these names
142144
def _cbrt(x):
143145
return torch.pow(x, 1/3)

torch_np/_unary_ufuncs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ def wrapped(x1, *args, **kwds):
6262
tanh = deco_unary_ufunc_from_impl(_ufunc_impl.tanh)
6363
trunc = deco_unary_ufunc_from_impl(_ufunc_impl.trunc)
6464

65+
invert = deco_unary_ufunc_from_impl(_ufunc_impl.invert)
66+
67+
6568
cbrt = deco_unary_ufunc_from_impl(_ufunc_impl.cbrt)
6669
positive = deco_unary_ufunc_from_impl(_ufunc_impl.positive)
6770

6871
# numpy has these aliases while torch does not
6972
abs = absolute
7073
conj = conjugate
74+
bitwise_not = invert
7175

0 commit comments

Comments
 (0)