-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Update design doc for Python Layer #4698
Update design doc for Python Layer #4698
Conversation
doc/design/python_api.md
Outdated
|
||
1. The layer developer can figure out how many common functions they can use by just typing `self.` in an IDE. | ||
2. It is easy to understand and develop since inheritance is a common way to reuse code. | ||
3. It is transparent for end-users since we can wrap a functor class to a function. |
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.
maybe Add a Conclusion part that we choose Functor to build our layer.
doc/design/python_api.md
Outdated
self.kwargs = kwargs | ||
|
||
def __call__(self): | ||
raise NotImplementedError("LayerBase is a ") |
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.
complete the msg of LayerBase is a
doc/design/python_api.md
Outdated
We can provide a decorator to wrap a functor class as a function. The code is as follows. | ||
|
||
```python | ||
def export(name): |
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.
maybe export_layer
or layer
? make user be sure what this decorator is used for.
…le into feature/update_layer_design
03c6c98
to
7f87c49
Compare
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.
Impressive!
We not only use the fewer lines of code to write `fc_layer` but also make the code clearer to understand. At the same time, layer developers can figure out what function they can invoke by typing `helper.` in a python editor. | ||
|
||
|
||
### Implementation of layer helper | ||
|
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.
Will the new api be compatible with v2 api?
This update is about how to implement layer function. The logic in this PR is as follow:
FullyConnected
layer if we do not provide any common functions. So it is necessary to give a mechanism for code reusing.