-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Export ReduceMean/ReduceFrontMean/ReduceBackMean (Caffe2) to ReduceMean (ONNX). #16727
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
Conversation
|
Test added. |
b58ca42 to
b23b50c
Compare
|
@yinghai could you please review this? |
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.
ReduceFrontMean and ReduceBackMean are deprecated now. Could you (also) add support for ReduceMean operator (https://github.com/pytorch/pytorch/blob/master/caffe2/operators/reduce_ops.cc#L221)?
|
@houseroad Added |
69a4618 to
bd59779
Compare
caffe2/onnx/onnx_exporter.cc
Outdated
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.
using additional block to avoid dup names seems uncommon in PyTorch codebase. Could you remove this trick?
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.
This provides more benefit than what you thought.
- Use
it_suffixis unnecessary and it makes code becomes longer. - With
constwe get SSA, which is easier to read for "local" var. - With
{}I can get even more, i.e. terminate the life span earlier before reassignment. This narrows the "local" semantics and helps people navigating in the code.
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.
I didn't see the benefits here...
Especially, the logic here is so simple, and you can just reuse it name.
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.
Fine...Don't wanna drag this PR longer.
IMHO reuse is bad, and makes the first occurrence asymmetric to the rest.
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.
Please make sure the coding style is consistent with the whole file.
caffe2/onnx/onnx_exporter.cc
Outdated
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.
Also, the extra block is useless here. And it will make the coding style so inconsistent...
|
Error unrelated. |
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.
Looks good. Thanks.
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.
@houseroad is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
The second input (
lengths) is not supported.