Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

PR Category

User Experience

PR Types

New features

Description

本 PR 致力于将 Tensor.shape 的返回值从 list 修改为 paddle.Size,并尽可能保障向前兼容性。具体改动如下:

  1. 修改 Tensor.shape,使之返回 paddle.Size
  2. 将 paddle.Size 的基类改为 List,使得 Tensor.shape 可以向前兼容,并修改和重写了 Size 的几个方法,使之能够与 Tuple 交互
  3. 修改 tensor_to_string 方法,以确保 shape 方法改动后Tensor 的表示字符串不变。
  4. CastPyArg2IntArray 增加对 Size 类型的解析

@paddle-bot
Copy link

paddle-bot bot commented Nov 11, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhwesky2010 zhwesky2010 changed the title [API Compability]Tensor.shape return Size instead of list [API Compability] Tensor.shape return Size instead of list Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants