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

Export fused_scale_tril op #5933

Merged
merged 24 commits into from
Aug 19, 2021
Merged

Export fused_scale_tril op #5933

merged 24 commits into from
Aug 19, 2021

Conversation

leaves-zwx
Copy link
Contributor

No description provided.

} else {
scale = ctx->integer_scale_value;
}
(*in_grads)[0] = JUST(functional::FusedScaleTril(out_grads[0], ctx->diagonal, 0, scale));
Copy link
Contributor

Choose a reason for hiding this comment

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

这个地方的第三个参时(0)我不大懂,看老 lazy 的注册梯度,这个 filled_value 其实就是正向 filled_value 属性(float和int都包括)。但是这里直接写死为 0 了。是可以的吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

前向,保留下三角矩阵,反向传播时,梯度也保留下三角矩阵。看 tril_op.cpp 里面也是这么写的,反向没传 fill_value (默认是 0)

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 18, 2021 08:58
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 18, 2021 08:58
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 18, 2021 09:30
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 13:00
@oneflow-ci-bot oneflow-ci-bot removed their request for review August 18, 2021 14:07
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 18, 2021 17:11
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 19:28
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 18, 2021 23:29
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 19, 2021 00:49
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 19, 2021 02:18
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 19, 2021 03:34
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 19, 2021 04:34
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

PyTorch resnet50 time: 140.9ms (= 7044.5ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 128.3ms (= 6414.6ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
Relative speed: 1.10 (= 140.9ms / 128.3ms)

PyTorch resnet50 time: 84.6ms (= 4232.1ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 74.5ms (= 3726.6ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
Relative speed: 1.14 (= 84.6ms / 74.5ms)

PyTorch resnet50 time: 59.6ms (= 2977.8ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 47.9ms (= 2396.5ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
Relative speed: 1.24 (= 59.6ms / 47.9ms)

PyTorch resnet50 time: 46.7ms (= 2333.6ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 38.6ms (= 1928.5ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
Relative speed: 1.21 (= 46.7ms / 38.6ms)

PyTorch resnet50 time: 44.1ms (= 2203.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow resnet50 time: 37.5ms (= 1875.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
Relative speed: 1.17 (= 44.1ms / 37.5ms)

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 19, 2021 05:43
@oneflow-ci-bot oneflow-ci-bot merged commit 9bedea2 into master Aug 19, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the f_fused_scale_tril branch August 19, 2021 05:44
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