-
Notifications
You must be signed in to change notification settings - Fork 667
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
Dev mv code from modules to functional #10420
base: master
Are you sure you want to change the base?
Conversation
…d vectorize=False
…d vectorize=False
Speed stats:
|
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.
这个文件名为啥叫 sparse?
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.
原来这个函数是放在nn/modules/sparse.py中的,它就命名为sparse,我把它迁移到nn/functional下,没有改原文件名
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.
可以跟 interpolate 合并到一起
View latest API docs preview at: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/docs/Oneflow-Inc/oneflow/pr/10420/ |
Speed stats:
|
View latest API docs preview at: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/docs/Oneflow-Inc/oneflow/pr/10420/ |
Speed stats:
|
…dev_mv_code_from_modules_to_functional
return res | ||
|
||
|
||
def layer_norm(input, normalized_shape: tuple, weight=None, bias=None, eps=1e-05): |
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.
这里可以加一下文档,参照上面的 group norm
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.
以及 type hinting
norm_type=2.0, | ||
scale_grad_by_freq=False, | ||
sparse=False, | ||
): |
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.
同样,这里加上 type hinting,另外文档中有 example 代码,结尾要加上
if __name__ == "__main__":
import doctest
doctest.testmod(raise_on_error=True)
import oneflow as flow | ||
|
||
|
||
def linear(input, weight, bias=None): |
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.
type hinting 以及结尾的测试
View latest API docs preview at: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/docs/Oneflow-Inc/oneflow/pr/10420/ |
…ctional' into dev_mv_code_from_modules_to_functional
View latest API docs preview at: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/docs/Oneflow-Inc/oneflow/pr/10420/ |
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.
type hinting 部分没有问题
View latest API docs preview at: https://oneflow-staging.oss-cn-beijing.aliyuncs.com/docs/Oneflow-Inc/oneflow/pr/10420/ |
Speed stats:
|
移动nn.modules下的代码到nn.functional下
代码移动:
测试代码: