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

Fix nn functional conv2d bug #7892

Merged
merged 57 commits into from
Apr 2, 2022
Merged

Fix nn functional conv2d bug #7892

merged 57 commits into from
Apr 2, 2022

Conversation

BBuf
Copy link
Contributor

@BBuf BBuf commented Mar 24, 2022

handle this bug: Oneflow-Inc/vision#185.

@github-actions
Copy link
Contributor

Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally.

img = flow.ones(1, 3, 224)
kernel = flow.randn(3, 1, 3)
y = flow.nn.functional.conv1d(img, kernel, groups=3)
assert y.shape[0] == img.shape[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这儿用test_case.assertTrue ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是也可以用autotest和PyTorch对比一下结果

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改成autotest版本

@BBuf BBuf removed the request for review from oneflow-ci-bot March 24, 2022 14:12
@BBuf BBuf requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 31, 2022 00:59
@github-actions
Copy link
Contributor

Static analysis with clang failed. PR label automerge has been removed

@BBuf BBuf added the automerge label Apr 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7892/

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 128.5ms (= 12845.7ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 138.4ms (= 13843.1ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.08 (= 138.4ms / 128.5ms)

✔️ OneFlow resnet50 time: 77.7ms (= 7772.4ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.6ms (= 8662.3ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.11 (= 86.6ms / 77.7ms)

OneFlow resnet50 time: 53.0ms (= 10606.8ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 60.0ms (= 12003.2ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.13 (= 60.0ms / 53.0ms)

OneFlow resnet50 time: 44.8ms (= 8961.7ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 49.0ms (= 9790.6ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.09 (= 49.0ms / 44.8ms)

OneFlow resnet50 time: 37.2ms (= 7446.3ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 40.1ms (= 8024.3ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.08 (= 40.1ms / 37.2ms)

OneFlow swin dataloader time: 0.249s (= 49.866s / 200, num_workers=1)
PyTorch swin dataloader time: 0.252s (= 50.372s / 200, num_workers=1)
✔️ Relative speed: 1.010 (= 0.252s / 0.249s)

OneFlow swin dataloader time: 0.067s (= 13.387s / 200, num_workers=4)
PyTorch swin dataloader time: 0.068s (= 13.632s / 200, num_workers=4)
✔️ Relative speed: 1.018 (= 0.068s / 0.067s)

OneFlow swin dataloader time: 0.038s (= 7.681s / 200, num_workers=8)
PyTorch swin dataloader time: 0.037s (= 7.359s / 200, num_workers=8)
✔️ Relative speed: 0.958 (= 0.037s / 0.038s)

❌ OneFlow resnet50 time: 138.6ms (= 13864.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 156.8ms (= 15684.4ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.13 (= 156.8ms / 138.6ms)

OneFlow resnet50 time: 88.7ms (= 8873.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 106.0ms (= 10603.2ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.19 (= 106.0ms / 88.7ms)

OneFlow resnet50 time: 62.8ms (= 12566.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 86.2ms (= 17240.5ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.37 (= 86.2ms / 62.8ms)

OneFlow resnet50 time: 53.7ms (= 10742.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 66.6ms (= 13320.3ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.24 (= 66.6ms / 53.7ms)

OneFlow resnet50 time: 51.2ms (= 10242.1ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 62.4ms (= 12483.5ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.22 (= 62.4ms / 51.2ms)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2022

CI failed when running job: cuda-speed-test. PR label automerge has been removed

@github-actions github-actions bot removed the automerge label Apr 1, 2022
@BBuf BBuf added the automerge label Apr 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2022

View latest API docs preview at: https://staging.oneflow.info/docs/Oneflow-Inc/oneflow/pr/7892/

@github-actions
Copy link
Contributor

github-actions bot commented Apr 2, 2022

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 128.5ms (= 12848.6ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 140.5ms (= 14050.6ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.09 (= 140.5ms / 128.5ms)

✔️ OneFlow resnet50 time: 77.0ms (= 7703.0ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 83.2ms (= 8322.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.08 (= 83.2ms / 77.0ms)

OneFlow resnet50 time: 52.6ms (= 10519.1ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 61.3ms (= 12261.6ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.17 (= 61.3ms / 52.6ms)

OneFlow resnet50 time: 42.9ms (= 8585.6ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 49.2ms (= 9845.9ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.15 (= 49.2ms / 42.9ms)

OneFlow resnet50 time: 39.2ms (= 7840.5ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 44.2ms (= 8837.2ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.13 (= 44.2ms / 39.2ms)

OneFlow swin dataloader time: 0.256s (= 51.199s / 200, num_workers=1)
PyTorch swin dataloader time: 0.254s (= 50.733s / 200, num_workers=1)
✔️ Relative speed: 0.991 (= 0.254s / 0.256s)

OneFlow swin dataloader time: 0.066s (= 13.263s / 200, num_workers=4)
PyTorch swin dataloader time: 0.070s (= 14.048s / 200, num_workers=4)
✔️ Relative speed: 1.059 (= 0.070s / 0.066s)

OneFlow swin dataloader time: 0.037s (= 7.476s / 200, num_workers=8)
PyTorch swin dataloader time: 0.038s (= 7.596s / 200, num_workers=8)
✔️ Relative speed: 1.016 (= 0.038s / 0.037s)

✔️ OneFlow resnet50 time: 135.6ms (= 13563.7ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 158.2ms (= 15818.8ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.17 (= 158.2ms / 135.6ms)

OneFlow resnet50 time: 90.2ms (= 9023.5ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 108.1ms (= 10814.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.20 (= 108.1ms / 90.2ms)

OneFlow resnet50 time: 60.7ms (= 12140.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 80.8ms (= 16167.8ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.33 (= 80.8ms / 60.7ms)

OneFlow resnet50 time: 53.1ms (= 10619.0ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 68.2ms (= 13641.0ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.28 (= 68.2ms / 53.1ms)

OneFlow resnet50 time: 48.5ms (= 9695.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 61.5ms (= 12290.8ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.27 (= 61.5ms / 48.5ms)

@mergify mergify bot merged commit 709f56a into master Apr 2, 2022
@mergify mergify bot deleted the fix_nn_functional_conv2d_bug branch April 2, 2022 20:53
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.

5 participants