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 tril op #6005

Merged
merged 21 commits into from
Aug 25, 2021
Merged

Dev tril op #6005

merged 21 commits into from
Aug 25, 2021

Conversation

Ikkyu321
Copy link
Contributor

@Ikkyu321 Ikkyu321 commented Aug 23, 2021

  • 对齐pytorch.tril算子

  • 求单个或者批量2-D张量延相对主对角线位移指定diagnal的下三角张量

图片
图片

namespace oneflow {
namespace one {

struct TrilInterpState : public AutoGradCaptureState {
Copy link
Contributor

Choose a reason for hiding this comment

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

TrilInterpState 改为 TrilCaptureState

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TrilInterpState 改为 TrilCaptureState

已修改

tensor([[1., 0., 0.],
[1., 1., 0.],
[1., 1., 1.]], dtype=oneflow.float32)
>>> x.tril(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

这里只保留 flow.tril 的例子吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里只保留 flow.tril 的例子吧

已修改

@Ikkyu321 Ikkyu321 marked this pull request as ready for review August 23, 2021 08:40
return y

@autotest()
def TestTril_with_diag(test_case):
Copy link
Contributor

Choose a reason for hiding this comment

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

这个TestTril用小写吧(保持和上面的对齐)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个TestTril用小写吧(保持和上面的对齐)

已修改

@oneflow-ci-bot oneflow-ci-bot self-requested a review August 23, 2021 10:22
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 140.4ms (= 7020.1ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 128.6ms (= 6427.7ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.09 (= 140.4ms / 128.6ms)

PyTorch resnet50 time: 84.1ms (= 4203.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.7ms (= 3735.4ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.13 (= 84.1ms / 74.7ms)

PyTorch resnet50 time: 56.3ms (= 2816.8ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 47.2ms (= 2359.9ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.19 (= 56.3ms / 47.2ms)

PyTorch resnet50 time: 48.9ms (= 2444.1ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 37.5ms (= 1875.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.30 (= 48.9ms / 37.5ms)

PyTorch resnet50 time: 41.8ms (= 2088.6ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 43.5ms (= 2176.8ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 0.96 (= 41.8ms / 43.5ms)

@Flowingsun007 Flowingsun007 requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 23, 2021 12:20
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 141.4ms (= 7068.0ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 128.4ms (= 6422.3ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.10 (= 141.4ms / 128.4ms)

PyTorch resnet50 time: 84.6ms (= 4231.2ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.7ms (= 3733.9ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.13 (= 84.6ms / 74.7ms)

PyTorch resnet50 time: 57.9ms (= 2893.4ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 47.8ms (= 2389.6ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.21 (= 57.9ms / 47.8ms)

PyTorch resnet50 time: 53.2ms (= 2659.8ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 39.7ms (= 1984.0ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.34 (= 53.2ms / 39.7ms)

PyTorch resnet50 time: 44.6ms (= 2228.6ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 39.0ms (= 1951.8ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 1.14 (= 44.6ms / 39.0ms)

@oneflow-ci-bot oneflow-ci-bot self-requested a review August 24, 2021 07:02
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 24, 2021 10:25
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 24, 2021 11:33
@github-actions
Copy link
Contributor

CI failed, removing label automerge

1 similar comment
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 24, 2021 13:55
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 25, 2021 05:20
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 25, 2021 06:30
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 25, 2021 07:59
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

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

PyTorch resnet50 time: 82.3ms (= 4116.5ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.3ms (= 3716.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.11 (= 82.3ms / 74.3ms)

PyTorch resnet50 time: 60.3ms (= 3016.1ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 49.0ms (= 2451.7ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.23 (= 60.3ms / 49.0ms)

PyTorch resnet50 time: 47.7ms (= 2385.2ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 40.0ms (= 2002.5ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.19 (= 47.7ms / 40.0ms)

PyTorch resnet50 time: 43.9ms (= 2195.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 36.8ms (= 1839.0ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 1.19 (= 43.9ms / 36.8ms)

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 25, 2021 09:36
@oneflow-ci-bot oneflow-ci-bot merged commit 09044ea into master Aug 25, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the dev_tril_op branch August 25, 2021 09:38
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