-
Notifications
You must be signed in to change notification settings - Fork 77
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
[Op][Manip] collapse_sum_like, collapse_sum_to #87
[Op][Manip] collapse_sum_like, collapse_sum_to #87
Conversation
dbd5e1d
to
fb3e114
Compare
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.
Overall looks great, just wanna update comments
I noted some style issue for Python function signatures in this PR. Please format them properly. |
c562afe
to
9473f82
Compare
For another thing, don’t forget to check CI and fix the issues if there’s any. https://ci.mlc.ai/blue/organizations/jenkins/mlc-ai-relax/detail/PR-87/9/pipeline |
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
* collapse_sum_like & collapse_sum_to * address comments * test coverage * fix some tests * collapse_sum_to tgt shape var test * format * format * reformat * reformat * type: ignore * handle shape var cases and add regression tests
This PR introduces two operators
collapse_sum_like
andcollapse_sum_to
which are mainly used in automatic differentiation.The shape inference rule of
collapse_sum
can be described as below:data_shape
andtarget_shape
.collapse_sum
collapsesdata_shape
totarget_shape
.target_shape
but not indata_shape
. E.g.data_shape=(2, 3, 4, 5)
,target_shape=(4, 5)
. Here2, 3
are these axes.4, 5
in the above case.target_shape
is1
. E.g.data_shape=(2, 4, 5)
,target_shape=(2, 1, 5)
is legal.In fact just the reversed rule of broadcasting.