Skip to content

Conversation

@zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Mar 23, 2022

PR types

Others

PR changes

Others

Describe

Yaml配置中支持为Scalar类型参数指定特定数据类型,标记方式为Scalar(Type), 如Scalar(int) axis

iclementine
iclementine previously approved these changes Mar 24, 2022
Copy link

@iclementine iclementine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

'ScalarArray': 'const ScalarArray&',
'Scalar': 'const Scalar&',
'Scalar(int)': 'const Scalar&',
'Scalar(int32)': 'const Scalar&',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉int32

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

'Scalar(dobule)': 'const Scalar&',
'uint8': 'uint8_t',
'int': 'int',
'int32': 'int32_t',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,统一命名风格,要不和C++类型对齐,要不和DataType的标记类型对齐,避免模棱两可的数据类型命名

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. 对于attribute的写法向C++类型对齐

'Tensor[]' : 'std::vector<Tensor>',
'Tensor[Tensor[]]' : 'std::vector<std::vector<Tensor>>',
'Scalar' : 'paddle::experimental::Scalar',
'Scalar(int)' : 'paddle::experimental::Scalar',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果细化设计,后续所有类型都需要支持

Copy link
Contributor Author

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类型,后续是否新增需要根据具体需求来决定。

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zyfncg zyfncg merged commit 0408701 into PaddlePaddle:develop Mar 25, 2022
@zyfncg zyfncg deleted the scalar_type branch March 25, 2022 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants