You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的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.
SigureMo
changed the title
[Dy2St] Set TensorArray dtype after first write if its type is undefined
[PIR][Dy2St] Set TensorArray dtype after first write if its type is undefined
Sep 13, 2024
SigureMo
changed the title
[PIR][Dy2St] Set TensorArray dtype after first write if its type is undefined
[Typing][PIR][Dy2St] Set TensorArray dtype after first write if its type is undefined
Sep 14, 2024
SigureMo
changed the title
[Typing][PIR][Dy2St] Set TensorArray dtype after first write if its type is undefined
[PIR][Dy2St] Set TensorArray dtype after first write if its type is undefined
Sep 14, 2024
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
对于上述情况,动转静下会对
l
创建一个 float32 的TensorArray
,但后续会往里面添加 int64 的数据,这里我们有两种可以处理的方式:之前是直接报错的,后来加上了 cast,这两种其实都有问题,前者会导致大量存量代码需要修改,后者会导致后续取出的元素永远是 float32
由于这里原来是动态图代码,用户没有显式标注类型,因此从最开始而言其类型就应该是
Array<Unknown>
,在发现后续有append(i64)
时应该自动推导为Array<i64>
,这是符合编译器的类型推导原则的从 Paddle 的框架或者说 PIR 的角度,使用了
UndefinedDataType
来表示最开始尚未确定类型,对应 phi 下的DataType::UNDEFINED
,我们会为动转静转换的元素 dtype 设置为 undefined,而在后面append
时候触发的ArrayWriteInferMeta
设置成第一个元素的 dtype由于动转静只有捕获
append
等相关操作才会转为 TensorArray,因此创建的UndefinedDataType
的 array 一定会在组网期间确定类型,组网完成后不会再有UndefinedDataType
的 TensorArrayPcard-67164