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

Dev add bitwise_not op #9859

Merged
merged 26 commits into from
Feb 13, 2023
Merged

Dev add bitwise_not op #9859

merged 26 commits into from
Feb 13, 2023

Conversation

marigoold
Copy link
Contributor

@marigoold marigoold commented Feb 13, 2023

  • 增加了 bitwise_not 算子
  • 修复了 ~Tensor 的错误(之前调用 logical not,其实应该调用 bitwise not)

@marigoold marigoold marked this pull request as draft February 13, 2023 04:08
@marigoold marigoold changed the base branch from master to dev_add_bitwise_op February 13, 2023 04:14
Base automatically changed from dev_add_bitwise_op to master February 13, 2023 09:54
@marigoold marigoold marked this pull request as ready for review February 13, 2023 10:05
@marigoold marigoold changed the title Dev add bitwise unary op Dev add bitwise_not op Feb 13, 2023
@@ -97,5 +97,29 @@ def test_scalar_bitwise_xor(test_case):
return _test_scalar_bitwise(test_case, torch.bitwise_xor,)


@flow.unittest.skip_unless_1n1d()
class TestBitwiseNotModule(flow.unittest.TestCase):
@autotest(n=10, auto_backward=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为啥不支持auto_backward

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里为啥不支持auto_backward

它的输入只能是 int,不支持算微分

Copy link
Contributor

Choose a reason for hiding this comment

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

好的,可以加个note说明下

@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.

@marigoold marigoold requested review from oneflow-ci-bot and removed request for oneflow-ci-bot February 13, 2023 14:52
@marigoold marigoold enabled auto-merge (squash) February 13, 2023 14:52
@github-actions
Copy link
Contributor

Speed stats:

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

❌ OneFlow resnet50 time: 140.9ms (= 14094.2ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 142.9ms (= 14289.9ms / 100, input_shape=[16, 3, 224, 224])
❌ Relative speed: 1.01 (= 142.9ms / 140.9ms)

OneFlow resnet50 time: 80.7ms (= 8069.3ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 86.4ms (= 8643.3ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.07 (= 86.4ms / 80.7ms)

OneFlow resnet50 time: 49.6ms (= 9910.9ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 61.8ms (= 12360.4ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.25 (= 61.8ms / 49.6ms)

OneFlow resnet50 time: 33.1ms (= 6616.1ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 44.3ms (= 8853.0ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.34 (= 44.3ms / 33.1ms)

OneFlow resnet50 time: 25.3ms (= 5057.9ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 42.2ms (= 8433.7ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.67 (= 42.2ms / 25.3ms)

OneFlow swin dataloader time: 0.231s (= 46.202s / 200, num_workers=1)
PyTorch swin dataloader time: 0.150s (= 29.982s / 200, num_workers=1)
Relative speed: 0.649 (= 0.150s / 0.231s)

OneFlow swin dataloader time: 0.066s (= 13.169s / 200, num_workers=4)
PyTorch swin dataloader time: 0.042s (= 8.384s / 200, num_workers=4)
Relative speed: 0.637 (= 0.042s / 0.066s)

OneFlow swin dataloader time: 0.037s (= 7.434s / 200, num_workers=8)
PyTorch swin dataloader time: 0.022s (= 4.384s / 200, num_workers=8)
Relative speed: 0.590 (= 0.022s / 0.037s)

❌ OneFlow resnet50 time: 152.6ms (= 15256.2ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 161.9ms (= 16188.9ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
❌ Relative speed: 1.06 (= 161.9ms / 152.6ms)

OneFlow resnet50 time: 91.3ms (= 9128.3ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 102.4ms (= 10244.4ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.12 (= 102.4ms / 91.3ms)

OneFlow resnet50 time: 59.4ms (= 11874.6ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 80.5ms (= 16109.7ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.36 (= 80.5ms / 59.4ms)

OneFlow resnet50 time: 42.1ms (= 8414.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 74.8ms (= 14963.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.78 (= 74.8ms / 42.1ms)

OneFlow resnet50 time: 36.6ms (= 7317.4ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 68.1ms (= 13617.1ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.86 (= 68.1ms / 36.6ms)

@github-actions
Copy link
Contributor

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

@marigoold marigoold merged commit 3493bb5 into master Feb 13, 2023
@marigoold marigoold deleted the dev_add_bitwise_unary_op branch February 13, 2023 21:31
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.

4 participants