Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix different types in rsub caused bug#15707

Closed
zrphercule wants to merge 5 commits into
pytorch:masterfrom
zrphercule:fix_rsub
Closed

Fix different types in rsub caused bug#15707
zrphercule wants to merge 5 commits into
pytorch:masterfrom
zrphercule:fix_rsub

Conversation

@zrphercule
Copy link
Copy Markdown
Contributor

@zrphercule zrphercule commented Jan 3, 2019

Before this pr, rsub did not convert two elements into the same dtype, therefore "1 - x" may export to an onnx model that two elements of rsub having different dtype.
By adding this symbolic patch this bug should be fixed.
Related test cases also created.

Copy link
Copy Markdown
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.

Do we really need Linear and Sigmoid in this case?

@zrphercule
Copy link
Copy Markdown
Contributor Author

@houseroad actually no, just copying my local testcase to it... It is fine if we only use a simple "1 - x'

@houseroad
Copy link
Copy Markdown
Member

Yeah, let's do it to make it easier to understand.

Copy link
Copy Markdown
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.

@zrphercule has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Copy Markdown
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.

@zrphercule has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Copy Markdown
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!

Comment thread test/onnx/test_pytorch_onnx_caffe2.py Outdated
self.run_model_test(model, train=True, input=c, batch_size=BATCH_SIZE)

def test_rsub(self):
class RsubMod(torch.nn.Module):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

RsubModel?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just noticed other "Mod" does not mean "Model" but means "ExportMod"... I will change its name.

Copy link
Copy Markdown
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.

@zrphercule has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

mrshenli pushed a commit to mrshenli/pytorch that referenced this pull request Jan 6, 2019
Summary:
Before this pr, rsub did not convert two elements into the same dtype, therefore "1 - x" may export to an onnx model that two elements of rsub having different dtype.
By adding this symbolic patch this bug should be fixed.
Related test cases also created.
Pull Request resolved: pytorch#15707

Differential Revision: D13583042

Pulled By: zrphercule

fbshipit-source-id: 3a2de47a1a8d1ded1a0adfb911adbe6ac729cdef
@zrphercule zrphercule deleted the fix_rsub branch January 7, 2019 18:06
@ezyang ezyang added the merged label Jun 25, 2019
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Before this pr, rsub did not convert two elements into the same dtype, therefore "1 - x" may export to an onnx model that two elements of rsub having different dtype.
By adding this symbolic patch this bug should be fixed.
Related test cases also created.
Pull Request resolved: pytorch#15707

Differential Revision: D13583042

Pulled By: zrphercule

fbshipit-source-id: 3a2de47a1a8d1ded1a0adfb911adbe6ac729cdef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants