-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Relay] Add conv2d_backward_weight
op (without topi)
#9954
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
masahi
requested review from
anijain2305,
icemelon,
jroesch,
junrushao,
jwfromm,
MarisaKirisame,
mbrookhart,
slyubomirsky,
vinx13,
wweic,
yzhliu,
zhiics,
ZihengJiang,
areusch,
comaniac,
Huyuwei,
jcf94,
kevinthesun,
Laurawly,
merrymercy and
tqchen
as code owners
January 18, 2022 03:56
masahi
force-pushed
the
relay-conv2d-grad
branch
from
January 18, 2022 07:33
5c2504a
to
87c287e
Compare
masahi
force-pushed
the
relay-conv2d-grad
branch
2 times, most recently
from
January 18, 2022 13:24
62880c6
to
7d9dca8
Compare
comaniac
reviewed
Jan 18, 2022
comaniac
approved these changes
Jan 18, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tkonolige
approved these changes
Jan 18, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @masahi!
masahi
force-pushed
the
relay-conv2d-grad
branch
from
January 19, 2022 00:47
7d9dca8
to
387703d
Compare
masahi
force-pushed
the
relay-conv2d-grad
branch
from
January 19, 2022 08:11
387703d
to
f91e9d9
Compare
yuanfz98
pushed a commit
to yuanfz98/tvm
that referenced
this pull request
Jan 24, 2022
* python plumbing * add cpp def * legalize worked * clean up * layout conversion doesnt work * extract wgrad body * fix convert layout * black * fix kernel size * revert irrelevant change * add doc, clarify the meanings of parameters * update layout convert * test passed * fixed layout conversion * update convert layout * remove print * remove layout convert for now * minor fix * removed unused import * add wgrad python reference * add test stub * add doc * test other stride and pad * tweak * more pylint filter * fix typo in doc * swap arg order (data, grad) to be consistent with conv2d_transpose(dgrad)
crazydemo
pushed a commit
to crazydemo/tvm
that referenced
this pull request
Jan 27, 2022
* python plumbing * add cpp def * legalize worked * clean up * layout conversion doesnt work * extract wgrad body * fix convert layout * black * fix kernel size * revert irrelevant change * add doc, clarify the meanings of parameters * update layout convert * test passed * fixed layout conversion * update convert layout * remove print * remove layout convert for now * minor fix * removed unused import * add wgrad python reference * add test stub * add doc * test other stride and pad * tweak * more pylint filter * fix typo in doc * swap arg order (data, grad) to be consistent with conv2d_transpose(dgrad)
ylc
pushed a commit
to ylc/tvm
that referenced
this pull request
Feb 16, 2022
* python plumbing * add cpp def * legalize worked * clean up * layout conversion doesnt work * extract wgrad body * fix convert layout * black * fix kernel size * revert irrelevant change * add doc, clarify the meanings of parameters * update layout convert * test passed * fixed layout conversion * update convert layout * remove print * remove layout convert for now * minor fix * removed unused import * add wgrad python reference * add test stub * add doc * test other stride and pad * tweak * more pylint filter * fix typo in doc * swap arg order (data, grad) to be consistent with conv2d_transpose(dgrad)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a Relay op for the gradient of conv2d op with respect to weight (wgrad for short). It is implemented simply using the existing equivalent expressions in
tvm/python/tvm/relay/op/_tensor_grad.py
Lines 428 to 467 in 850abb0
conv2d_backward_weight
op legalization. So no topi op has been added for now.The motivation for introducing this op is threefold:
nn.con2d
and other ops, works but it is likely to be inefficient since it involvestile(grad, [1, in_channel // attrs.groups, 1, 1])
, a larger group conv2d workload and other post-processing (sum, transpose, slice etc). A direct implementation would likely be much faster.convert_layout
pass on a backward graph, resulting in.I cannot pattern match this graph and extract NHWC conv2d wgrad, since
layout_transform
ops are "too close" tonn.conv2d
. I need them to happen beforetile
and aftertranspose
. So this anti-behavior is the strong reason to want a dedicated wgrad op representation in Relay.cc @vinx13 @tkonolige @comaniac @YuchenJin