Skip to content

Commit f1d5c2b

Browse files
committed
Replaced Abs and Min functions in Eye Op in PyTorch
1 parent f45b277 commit f1d5c2b

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
@@ -97,10 +97,10 @@ def pytorch_funcify_eye(op, **kwargs):
9797

9898
def eye(N, M, k):
9999
mjr, mnr = (M, N) if k > 0 else (N, M)
100-
k_abs = abs(k)
100+
k_abs = torch.abs(k)
101101
zeros = torch.zeros(N, M, dtype=dtype)
102102
if k_abs < mjr:
103-
l_ones = min(mjr - k_abs, mnr)
103+
l_ones = torch.min(mjr - k_abs, mnr)
104104
return zeros.diagonal_scatter(torch.ones(l_ones, dtype=dtype), k)
105105
return zeros
106106

0 commit comments

Comments
 (0)