-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[ONNX] Fix the shape of PReLU weight #21330
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
|
@ezyang @houseroad Could you please help review it? Thanks! |
torch/onnx/symbolic_opset9.py
Outdated
| def prelu(g, self, weight): | ||
| self_sizes = self.type().sizes() | ||
| if self_sizes and len(self_sizes) > 2: | ||
| weight = g.op("Unsqueeze", weight, axes_i=list(range(1, len(self_sizes) - 1))) |
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 we already supported the broadcasting in ONNX's PRelu, why do we want to unsqueeze it again?
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.
The reason is #21271. The shape of weight should be [channels, 1, 1] according to ONNX document (ONNX PReLU requires unidirectional broadcasting), however, the actual shape is [channels] instead.
facebook-github-bot
left a comment
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 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
houseroad
left a comment
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.
|
@houseroad merged this pull request in 76e0154. |
Fix issue #21271