CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【Paddle Tensor No.10】新增 Tensor.__complex__
#69257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
self.cast_dtype = 'complex64' | ||
|
||
def set_func(self): | ||
self.func = paddle.jit.to_static(full_graph=True)(test_complex_cast) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 case 想跑通的话,应该需要修改 python/paddle/jit/dy2static/transformers/cast_transformer.py
和 python/paddle/jit/dy2static/convert_operators.py
的 convert_var_dtype
现在不修改的情况下是能跑通的么?如果能跑通有点不符合预期
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本地之前没有跑到。这个case需要支持吗?我看报错信息都是在 python/paddle/base/layers/math_op_patch.py
和 python/paddle/pir/math_op_patch.py
两处新增的地方。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
支持一下吧,和 float、int 保持一致
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
python/paddle/pir/math_op_patch.py
Outdated
complex(Tensor) is not supported in static graph mode. Because it's value is not available during the static mode. | ||
It's usually triggered by the logging implicitly, for example: | ||
>>> logging.info("The value of x is: {complex(x)}") | ||
^ `x` is Tensor, `complex(x)` triggers complex(Tensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
对齐到上面的 x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
if dtype == 'complex': | ||
return var.astype('complex64') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个为啥要单独写而不是一起放到 cast_map?看起来 paddle.cast
和 Tensor.astype
逻辑是一致的,都是走的 cast
OP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看 PIR 分支是没有这些限制的,如果老 IR 有问题的话,可以在当前 case 上装饰 test_pir_only
装饰器跳过老 IR,新特性无需考虑老 IR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,明白了
按照上面说的,装饰 |
好的 |
嗯,先跳过下吧 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tensor.__complex__
@NKNaN 覆盖率好像没过,还麻烦看下是否能补充几个单测 |
PR Category
User Experience
PR Types
New features
Description
新增
Tensor.__complex__