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

refine and align with pytorch #7593

Merged
merged 30 commits into from Mar 2, 2022
Merged

Conversation

hjchen2
Copy link
Contributor

@hjchen2 hjchen2 commented Feb 24, 2022

  • conv1d/2d/3d和deconv1d/2d/3d kernel,stride和dilation参数支持 int 传参
  • 提供Tensor.zero_()接口
  • Tensor.norm 参数命名
  • flow.max和flow.min用法
  • flow.nn.functional.dropout,支持inplace

- name: "max"
signature: [
"TensorTuple (Tensor input, Int32 dim=None, Bool keepdim=False) => Max",
"Tensor (Tensor input, Tensor other) => Max"
Copy link
Contributor

Choose a reason for hiding this comment

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

max看torch文档好像还有一个接口(输入输出都是一个tensor的那种?):
torch.max(input) → [Tensor](https://pytorch.org/docs/stable/tensors.html#torch.Tensor)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"TensorTuple (Tensor input, Int32 dim=None, Bool keepdim=False) => Max", 这个就支持你说的那种,输出如果是TensorTuple,而且size是1的话,就自动会取第0个Tensor作为输出

Copy link
Contributor

Choose a reason for hiding this comment

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

哦哦好的,忽略

@@ -1176,6 +1180,7 @@ def RegisterMethods():
Tensor.prod = _prod
Tensor.sin = _sin
Tensor.sin_ = _sin_inplace
Tensor.zero_ = _zero_
Copy link
Contributor

Choose a reason for hiding this comment

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

我们还有个地方是flow.zero_但是接口是flow.zeros_,也顺便改下吧

上下文在:#7573

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done,见commit 204dd3f

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot February 24, 2022 14:14
@github-actions
Copy link
Contributor

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

@oneflow-ci-bot oneflow-ci-bot removed their request for review February 24, 2022 16:10
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot February 28, 2022 05:55
@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 15:57
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 1, 2022 16:27
@oneflow-ci-bot oneflow-ci-bot self-requested a review March 1, 2022 19:38
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 1, 2022 22:08
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

CI failed when running job: cpu-module. PR label automerge has been removed

@github-actions github-actions bot removed the automerge label Mar 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

Speed stats:

@oneflow-ci-bot oneflow-ci-bot removed their request for review March 1, 2022 23:06
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot March 2, 2022 04:15
@oneflow-ci-bot oneflow-ci-bot self-requested a review March 2, 2022 05:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2022

Speed stats:
GPU Name: GeForce GTX 1080 

✔️ OneFlow resnet50 time: 128.7ms (= 12871.1ms / 100, input_shape=[16, 3, 224, 224])
PyTorch resnet50 time: 140.9ms (= 14090.3ms / 100, input_shape=[16, 3, 224, 224])
✔️ Relative speed: 1.09 (= 140.9ms / 128.7ms)

✔️ OneFlow resnet50 time: 78.3ms (= 7832.9ms / 100, input_shape=[8, 3, 224, 224])
PyTorch resnet50 time: 85.0ms (= 8502.5ms / 100, input_shape=[8, 3, 224, 224])
✔️ Relative speed: 1.09 (= 85.0ms / 78.3ms)

OneFlow resnet50 time: 53.5ms (= 10705.1ms / 200, input_shape=[4, 3, 224, 224])
PyTorch resnet50 time: 56.0ms (= 11196.2ms / 200, input_shape=[4, 3, 224, 224])
✔️ Relative speed: 1.05 (= 56.0ms / 53.5ms)

OneFlow resnet50 time: 44.0ms (= 8795.9ms / 200, input_shape=[2, 3, 224, 224])
PyTorch resnet50 time: 50.2ms (= 10030.4ms / 200, input_shape=[2, 3, 224, 224])
✔️ Relative speed: 1.14 (= 50.2ms / 44.0ms)

OneFlow resnet50 time: 37.4ms (= 7481.1ms / 200, input_shape=[1, 3, 224, 224])
PyTorch resnet50 time: 44.4ms (= 8886.0ms / 200, input_shape=[1, 3, 224, 224])
✔️ Relative speed: 1.19 (= 44.4ms / 37.4ms)

✔️ OneFlow resnet50 time: 142.1ms (= 14210.0ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 160.8ms (= 16075.3ms / 100, input_shape=[16, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.13 (= 160.8ms / 142.1ms)

OneFlow resnet50 time: 90.9ms (= 9094.7ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 105.9ms (= 10588.9ms / 100, input_shape=[8, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.16 (= 105.9ms / 90.9ms)

OneFlow resnet50 time: 62.9ms (= 12583.0ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 77.5ms (= 15500.4ms / 200, input_shape=[4, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.23 (= 77.5ms / 62.9ms)

OneFlow resnet50 time: 52.1ms (= 10425.1ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 67.8ms (= 13566.6ms / 200, input_shape=[2, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.30 (= 67.8ms / 52.1ms)

OneFlow resnet50 time: 48.5ms (= 9691.3ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
PyTorch resnet50 time: 62.8ms (= 12565.9ms / 200, input_shape=[1, 3, 224, 224], ddp, world size=2)
✔️ Relative speed: 1.30 (= 62.8ms / 48.5ms)

@hjchen2 hjchen2 merged commit f847927 into master Mar 2, 2022
@hjchen2 hjchen2 deleted the dev_align_with_pytorch_hjchen2 branch March 2, 2022 07:58
marigoold pushed a commit that referenced this pull request Mar 15, 2022
* refine and align with pytorch

* add flow.zero_ and check valid
wyg1997 pushed a commit that referenced this pull request Mar 17, 2022
* refine and align with pytorch

* add flow.zero_ and check valid
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.

None yet

5 participants