-
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
[API 2.0] Add transformer apis #26418
[API 2.0] Add transformer apis #26418
Conversation
test=develop
test=develop
test=develop
test=develop
test=develop
…arily. test=develop
test=develop
f4425cd
to
0d01c16
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.
LGTM
|
||
from .activation import * | ||
from .loss import * | ||
from .conv import * | ||
from .extension import * | ||
from .activation import * | ||
from .norm import * | ||
from .transformer import * |
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.
大写的组网类,在paddle.nn下建别名,推荐用paddle.nn.Transformer
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. Thanks
|
||
return (q, k, v) if cache is None else (q, k, v, cache) | ||
|
||
def cal_kv(self, key, value): |
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.
calculate 的缩写用 calc 更多些
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. Rename as compute_kv
. Thanks
|
||
return (q, k, v) if cache is None else (q, k, v, cache) | ||
|
||
def cal_kv(self, key, value): |
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.
这个API用户是否需要使用?如果需要的话,建议修改下。
calculate 的缩写用 calc 更多些,或者这里用compute也可以
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. Rename as compute_kv
. Thanks
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
import copy | ||
import collections | ||
|
||
import numpy as np |
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.
这里其实可以不必 import numpy
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. Thanks
…ording to comments. test=develop
48f97e1
PR types
New features
PR changes
APIs
Describe
Add transformer apis, as follows: