Skip to content

Commit 5a9d915

Browse files
twaclawDiego Sandoval
authored and
Diego Sandoval
committed
Replaced Abs and Min functions in Eye Op in PyTorch
1 parent f5d818f commit 5a9d915

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytensor/link/pytorch/dispatch/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ def pytorch_funcify_eye(op, **kwargs):
108108

109109
def eye(N, M, k):
110110
mjr, mnr = (M, N) if k > 0 else (N, M)
111-
k_abs = abs(k)
111+
k_abs = torch.abs(k)
112112
zeros = torch.zeros(N, M, dtype=dtype)
113113
if k_abs < mjr:
114-
l_ones = min(mjr - k_abs, mnr)
114+
l_ones = torch.min(mjr - k_abs, mnr)
115115
return zeros.diagonal_scatter(torch.ones(l_ones, dtype=dtype), k)
116116
return zeros
117117

0 commit comments

Comments
 (0)