Skip to content

Conversation

@BowenBao
Copy link
Collaborator

In onnx spec, the supported input/output type for And and Or is Bool only.
Thus in exporting, cast to/from Bool is inserted for input/output.

@ezyang ezyang requested a review from houseroad March 15, 2019 02:42
@BowenBao BowenBao force-pushed the onnx_and_etc branch 2 times, most recently from d36c9ff to 768ff82 Compare April 1, 2019 20:49
yinghai
yinghai previously requested changes Apr 2, 2019
Copy link
Member

Choose a reason for hiding this comment

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

can we refactor this function with wrap_logical_op_with_cast_to_uint8?
so we will have wrap_func_with_cast_to(func, to_type), and you can directly pass type as a parameter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done. I have renamed the other to inject_logical_op_with_cast_to. A little context is that in ONNX, And and Or accept only Bool type, so inputs need to be cast to Bool, and output cast back to original type.

@BowenBao BowenBao force-pushed the onnx_and_etc branch 3 times, most recently from 70ba283 to 1d04bec Compare April 9, 2019 01:10
Copy link
Member

Choose a reason for hiding this comment

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

is globals() necessary here?

Copy link
Member

Choose a reason for hiding this comment

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

rename cast_func to to_cast_func?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

Looks good, thanks.

@houseroad
Copy link
Member

please rebase to master again, thanks.

@BowenBao
Copy link
Collaborator Author

please rebase to master again, thanks.

Thanks, rebased.

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.

@houseroad
Copy link
Member

rebase please?

nit

nit

refactor wrapper

merge

fix flake8: line too long

fix typo

fix regression on not supporting boolean and/or

rename wrapped func
@pytorchbot pytorchbot added the module: onnx Related to torch.onnx label May 13, 2019
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.

@facebook-github-bot
Copy link
Contributor

@houseroad merged this pull request in fa18964.

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

Labels

module: onnx Related to torch.onnx open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants