-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Scalar support marking data_type in yaml #40867
Conversation
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.
LGTM
@@ -89,6 +89,11 @@ def parse_input_and_attr(self, api_name, args_config, optional_vars=[]): | |||
attr_types_map = { | |||
'ScalarArray': 'const ScalarArray&', | |||
'Scalar': 'const Scalar&', | |||
'Scalar(int)': 'const Scalar&', | |||
'Scalar(int32)': 'const Scalar&', |
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.
去掉int32
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
'Scalar(int32)': 'const Scalar&', | ||
'Scalar(int64)': 'const Scalar&', | ||
'Scalar(float)': 'const Scalar&', | ||
'Scalar(dobule)': 'const Scalar&', | ||
'uint8': 'uint8_t', | ||
'int': 'int', | ||
'int32': 'int32_t', |
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++类型对齐,要不和DataType的标记类型对齐,避免模棱两可的数据类型命名
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. 对于attribute的写法向C++类型对齐
@@ -37,6 +37,11 @@ | |||
'Tensor[]' : 'std::vector<Tensor>', | |||
'Tensor[Tensor[]]' : 'std::vector<std::vector<Tensor>>', | |||
'Scalar' : 'paddle::experimental::Scalar', | |||
'Scalar(int)' : 'paddle::experimental::Scalar', |
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.
目前只支持int,int64_t,float和double四种配置,已基本覆盖目前使用Scalar的attribute类型,后续是否新增需要根据具体需求来决定。
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.
LGTM
PR types
Others
PR changes
Others
Describe
Yaml配置中支持为Scalar类型参数指定特定数据类型,标记方式为
Scalar(Type)
, 如Scalar(int) axis