Skip to content

Commit 346fbc1

Browse files
Merge pull request #404 from zhengshengning/fix-0size_reshape
[0-size Tensor Job2 No.96] fix rules of reshape
2 parents de2b8d6 + 5aa1590 commit 346fbc1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tester/paddle_to_torch/rules.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4713,10 +4713,7 @@ def apply(self, paddle_api: str) -> ConvertResult:
47134713
shape[i] = elements
47144714
"""
47154715
core = """
4716-
if x.numel() == 0:
4717-
result = torch.zeros(shape, dtype=x.dtype)
4718-
else:
4719-
result = torch.reshape(x, shape)
4716+
result = torch.reshape(x, shape)
47204717
"""
47214718
code = Code(preprocess=pre.splitlines(), core=core.splitlines())
47224719
return ConvertResult.success(paddle_api, code)

0 commit comments

Comments
 (0)