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

wrap flow.nn.init.* with flow.no_grad() #5932

Merged
merged 4 commits into from
Aug 18, 2021
Merged

Conversation

daquexian
Copy link
Contributor

和 pytorch 对齐,修复 flow.nn.init.* 对 requires_grad=True 的 tensor 会报错的问题

Signed-off-by: daquexian <daquexian566@gmail.com>
@daquexian daquexian requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 01:15
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 02:11
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 02:54
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 139.9ms (= 6996.1ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 127.8ms (= 6392.4ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.09 (= 139.9ms / 127.8ms)

PyTorch resnet50 time: 84.0ms (= 4199.5ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.3ms (= 3716.3ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.13 (= 84.0ms / 74.3ms)

PyTorch resnet50 time: 58.8ms (= 2940.9ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 47.4ms (= 2369.6ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.24 (= 58.8ms / 47.4ms)

PyTorch resnet50 time: 48.5ms (= 2425.7ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 37.4ms (= 1867.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.30 (= 48.5ms / 37.4ms)

PyTorch resnet50 time: 41.8ms (= 2091.8ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 35.9ms (= 1796.4ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 1.16 (= 41.8ms / 35.9ms)

@oneflow-ci-bot oneflow-ci-bot merged commit 5bf11d8 into master Aug 18, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the fix_init_grad branch August 18, 2021 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants