Skip to content

Skip prod test cases unsupported by PyTorch.#617

Merged
wanghuancoder merged 2 commits intoPFCCLab:mainfrom
baoqiwen:bqw_prod_skip
Mar 5, 2026
Merged

Skip prod test cases unsupported by PyTorch.#617
wanghuancoder merged 2 commits intoPFCCLab:mainfrom
baoqiwen:bqw_prod_skip

Conversation

@baoqiwen
Copy link
Contributor

@baoqiwen baoqiwen commented Mar 5, 2026

PyTorch 不支持 torch.prod(x, dim=[2,3,4]) 直接传 list。
PaddleAPITest 的 ReduceRule 是逐 axis 循环调用 torch.prod(x, dim=a, keepdim=True) 再 squeeze。
这一行为与Paddle存在精度差距,原因是:

  • Paddle: axis=[2,3,4] → 一次性 reduce 24 个元素(1次reduce)
  • PyTorch (ReduceRule): 逐 axis 循环 torch.prod(dim=2) → torch.prod(dim=3) → torch.prod(dim=4)(3次reduce)

因此,PaddleAPITest 跳过 torch 不支持的 prod 多轴 case:

  • axis 是 list/tuple 且 len > 1 → skip(如 list[2,3,4,]、tuple(0,1,)、list[0,1,])
  • axis 是 TensorConfig 且 shape[0] > 1 → skip(如 Tensor([2],"int64") 生成 2 个随机索引)

共skip了12个case:
image

@paddle-bot
Copy link

paddle-bot bot commented Mar 5, 2026

Thanks for your contribution!

Copy link
Collaborator

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder wanghuancoder enabled auto-merge (squash) March 5, 2026 10:55
@wanghuancoder wanghuancoder merged commit 4ae89e7 into PFCCLab:main Mar 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants