Skip to content
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

Whether the OperatorBase needs an initial interface? #2830

Closed
qingqing01 opened this issue Jul 12, 2017 · 1 comment · Fixed by #2838
Closed

Whether the OperatorBase needs an initial interface? #2830

qingqing01 opened this issue Jul 12, 2017 · 1 comment · Fixed by #2838
Assignees

Comments

@qingqing01
Copy link
Contributor

Now the OperatorBase has one default empty constructor. And each operator will be created by calling this empty constructor in OpRegistry:: CreateOp(). Where to do the operations which only need to be done once in the operator? For example, we create an auxiliary object in the RNN operator. so, whether the OperatorBase needs an initial interface?

@JiayiFeng
Copy link
Collaborator

JiayiFeng commented Jul 12, 2017

I think we can add a virtual Init function which does nothing in OperatorBase:

virtual void Init() {}

and overwrite it in any Op that really need some initialization.

Op->Init() could be called in OpRegistry::CreateOp() after attribute check.

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 a pull request may close this issue.

5 participants