Skip to content

Commit 5b5b849

Browse files
committed
fix DiagRule
1 parent b539e35 commit 5b5b849

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tester/paddle_to_torch/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ def apply(self, paddle_api: str) -> ConvertResult:
15271527
core = "result = x.diag(diagonal=offset)"
15281528
post = """
15291529
if x.ndim == 1 and padding_value != 0:
1530-
padding_value = torch.tensor(padding_value, dtype=x.dtype)
1530+
padding_value = torch.tensor(padding_value, dtype=torch.float32)
15311531
diag_mask = torch.diag(torch.ones_like(x), diagonal=offset)
15321532
result = torch.where(diag_mask.bool(), result, padding_value)
15331533
"""

0 commit comments

Comments
 (0)