Skip to content

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Jul 12, 2017

  • Refine register methods, make Op can get rid of whole-archieve
  • USE_OP before a op is used.
  • Add unittest for add_op.

@reyoung reyoung force-pushed the feature/op_kernel_add branch from 84ac1af to ab48ef8 Compare July 13, 2017 08:38
Copy link
Member

Choose a reason for hiding this comment

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

这里的模板参数应该有两个吧,一个是设备类型,一个是数据类型

template <typename DeviceType, typename DataType>
class AddKernel

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

目前既然没有不同数据类型的实现,就先不考虑不同数据类型的问题。

Copy link
Member

Choose a reason for hiding this comment

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

这里目前先不考虑对不同数据类型kernel的支持吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

目前既然没有不同数据类型的实现,就先不考虑不同数据类型的问题。

Copy link
Contributor

Choose a reason for hiding this comment

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

会有doublefloathalf等数据类型的支持吧,希望从接口下考虑下。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

如果需要增加数据类型的话,只是注册的时候加一个参数就好了。除了注册之外的接口没有区别。

@reyoung reyoung force-pushed the feature/op_kernel_add branch from ab48ef8 to 7bf260a Compare July 13, 2017 09:29
* Refine register methods, make Op can get rid of whole-archieve
* `USE_OP` before a op is used.
* Add unittest for add_op.
@reyoung reyoung force-pushed the feature/op_kernel_add branch from 7bf260a to a0aaafe Compare July 13, 2017 10:56
add_subdirectory(memory)
add_subdirectory(platform)
add_subdirectory(framework)
add_subdirectory(op) # because `operator` is a reserved word for CPP, so short to `op`
Copy link
Member

Choose a reason for hiding this comment

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

a personal suggestion, use ops instead of op

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe operators is better.

ProtoMakerType(&op_proto, &op_checker);
PADDLE_ENFORCE(op_proto.IsInitialized(),
"Fail to initialize %s's OpProto !", op_type);
*op_proto.mutable_type() = op_type;
Copy link
Member

Choose a reason for hiding this comment

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

I am curious why this can work before without set op_type

Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@gangliao gangliao left a comment

Choose a reason for hiding this comment

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

LGTM. but device_type is better than CPU_OR_GPU

reyoung and others added 2 commits July 13, 2017 20:14
* Convert `op` --> `operators`
* Remove AddType in OpProtoMaker, because type is part of registry.
* Rename CPU_OR_GPU --> DEVICE_TYPE in registry macro.
@reyoung reyoung merged commit bf12706 into PaddlePaddle:develop Jul 14, 2017
"REGISTER_OP must be in global namespace"); \
static ::paddle::framework::OpRegisterHelper<__op_class, __op_maker_class> \
__op_register_##__op_type##__(#__op_type); \
int __op_register_##__op_type##_handle__() { return 0; }
Copy link
Member

Choose a reason for hiding this comment

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

这里加上这个函数是什么作用啊?

int __op_register_##__op_type##_handle__() { return 0; }

@reyoung reyoung deleted the feature/op_kernel_add branch July 15, 2017 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants