-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[SOT][dynamic shape] Adapt some InferMeta for dynamic shape #65517
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle/phi/infermeta/multiary.cc
Outdated
@@ -753,7 +753,7 @@ void BatchNormInferMeta(const MetaTensor& x, | |||
check = false; | |||
} |
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.
750-754 行看起来就是处理了动态 shape 场景?因为取的就是 product 结果为负(离谱,俩 -1 不就是正的了吗),可以看看这里的处理逻辑的漏洞,并看看是否可以清理还是怎样做比较合适
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.
done
} | ||
|
||
if ((!config.is_runtime) && | ||
(contain_unknown_dim(scale.dims()) || contain_unknown_dim(bias.dims()))) { | ||
check = false; | ||
} |
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.
2024-06-28 17:38:10 --------------------------------------
2024-06-28 17:38:10 C++ Traceback (most recent call last):
2024-06-28 17:38:10 --------------------------------------
2024-06-28 17:38:10 0 paddle::pybind::static_api_batch_norm_(_object*, _object*, _object*)
2024-06-28 17:38:10 1 paddle::dialect::batch_norm_(pir::Value const&, pir::Value const&, pir::Value const&, paddle::optional<pir::Value> const&, paddle::optional<pir::Value> const&, bool, float, float, std::string const&, bool, bool)
2024-06-28 17:38:10 2 paddle::dialect::BatchNorm_Op::Build(pir::Builder&, pir::OperationArgument&, pir::Value, pir::Value, pir::Value, pir::Value, pir::Value, bool, float, float, std::string const&, bool, bool)
2024-06-28 17:38:10 3 paddle::dialect::BatchNorm_Op::InferMeta(std::vector<pir::Value, std::allocator<pir::Value> > const&, std::unordered_map<std::string, pir::Attribute, std::hash<std::string >, std::equal_to<std::string >, std::allocator<std::pair<std::string const, pir::Attribute> > >*)
2024-06-28 17:38:10 4 common::enforce::EnforceNotMet::EnforceNotMet(common::ErrorSummary const&, char const*, int)
2024-06-28 17:38:10 5 common::enforce::GetCurrentTraceBackString[abi:cxx11](bool)
2024-06-28 17:38:10
2024-06-28 17:38:10 ----------------------
2024-06-28 17:38:10 Error Message Summary:
2024-06-28 17:38:10 ----------------------
2024-06-28 17:38:10 InvalidArgumentError: ShapeError: the shape of scale must equal to [-1]But received: the shape of scale is [3]
2024-06-28 17:38:10 [Hint: Expected scale.dims()[0] == C, but received scale.dims()[0]:3 != C:-1.] (at ../paddle/phi/infermeta/multiary.cc:925)
这是没成功跳过吗
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.
coverage 这个单测还超时了,很奇怪
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.
看起来是因为没判断C==-1,但是为什么我本地没有报错好奇怪
PR-CI-Py3-PIR 下 bn 单测挂了,奇怪 |
paddle/phi/infermeta/multiary.cc
Outdated
} | ||
|
||
if ((!config.is_runtime) && (contain_unknown_dim(scale.dims()) || | ||
contain_unknown_dim(bias.dims()) || C == -1)) { |
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 (!scale || !bias ||
((!config.is_runtime) && (contain_unknown_dim(scale.dims()) ||
contain_unknown_dim(bias.dims()))))
我测了下py好像没报错 #65612。
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.
嗯,我等会看下,这个 PR 后续我来推进
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.
那这块是不是可以直接在contain_unknown_dim里判断一下
Co-authored-by: Winters Montagne <[email protected]>
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.
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
修复部分在非运行时的检查条件,之前只考虑到只有一个动态shape参数,现在使用anyof代替product,从而支持多个参数。