-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Make torch.randint have default dtype int64 #11040
Conversation
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.
SsnL has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@pytorchbot retest this please |
test/test_torch.py
Outdated
@@ -2853,6 +2853,25 @@ def test_arange_inference(self): | |||
torch.tensor(1, dtype=torch.int16)).dtype) | |||
torch.set_default_dtype(saved_dtype) | |||
|
|||
def test_randint_inference(self): | |||
saved_dtype = torch.get_default_dtype() | |||
torch.set_default_dtype(torch.float32) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
auto size = r.intlist(1); | ||
auto generator = r.generator(2); | ||
// NOTE: r.scalartype(X) gives the default dtype if r.isNone(X) | ||
auto dtype = r.isNone(4) ? at::ScalarType::Long : r.scalartype(4); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
auto high = r.toInt64(0); | ||
auto size = r.intlist(1); | ||
// NOTE: r.scalartype(X) gives the default dtype if r.isNone(X) | ||
auto dtype = r.isNone(3) ? at::ScalarType::Long : r.scalartype(3); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
auto high = r.toInt64(1); | ||
auto size = r.intlist(2); | ||
// NOTE: r.scalartype(X) gives the default dtype if r.isNone(X) | ||
auto dtype = r.isNone(4) ? at::ScalarType::Long : r.scalartype(4); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
SsnL is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: cc gchanan apaszke Pull Request resolved: pytorch#11040 Differential Revision: D9565728 Pulled By: SsnL fbshipit-source-id: eb5be9609f30c88f52746fa7e13ad71e2856648e
cc @gchanan @apaszke