Skip to content

Conversation

@daquexian
Copy link
Contributor

Fix issue #21271

@pytorchbot pytorchbot added the module: onnx Related to torch.onnx label Jun 4, 2019
@jerryzh168 jerryzh168 requested a review from houseroad June 4, 2019 18:55
@daquexian
Copy link
Contributor Author

@ezyang @houseroad Could you please help review it? Thanks!

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)))
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

Copy link
Member

@houseroad houseroad left a comment

Choose a reason for hiding this comment

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

LGTM.

@facebook-github-bot
Copy link
Contributor

@houseroad merged this pull request in 76e0154.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants