Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tester/paddle_to_torch/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3856,7 +3856,7 @@ def apply(self, paddle_api: str) -> ConvertResult:
result = (x!= 0).sum(dim=axis, keepdim=True).to(x.dtype)
else:
result = (x!= 0).sum(dim=axis).to(x.dtype)
elif len(x.shape)>2 and axis is None:
elif len(x.shape)>=2 and axis is None:
if p==math.inf:
if keepdim:
result = x.abs().amax().reshape([1] * x.ndim)
Expand All @@ -3868,7 +3868,12 @@ def apply(self, paddle_api: str) -> ConvertResult:
else:
result = x.abs().amin()
else:
_kwargs["input"] = x.flatten()
if p == "fro":
_kwargs["ord"] = 2
result = {self.torch_api}(**_kwargs)
if keepdim:
result = result.reshape([1] * x.ndim)
else:
result = {self.torch_api}(**_kwargs)
"""
Expand Down