Skip to content

Conversation

@xuhdev
Copy link
Collaborator

@xuhdev xuhdev commented Aug 25, 2020

torch.range still hasn't been removed way after version 0.5. This PR fixes the warning message. Alternatively, we can remove torch.range.

@zasdfgbnm
Copy link
Collaborator

I do have a PR removing range, but unfortunately it can not be removed because it is still being used a lot:
See: #33374

@xuhdev
Copy link
Collaborator Author

xuhdev commented Aug 25, 2020

@zasdfgbnm Thanks for the pointer. Perhaps we should just modify the warning message in this PR?

@zasdfgbnm
Copy link
Collaborator

@xuhdev Yes, agree. This PR LGTM

@dr-ci
Copy link

dr-ci bot commented Aug 25, 2020

💊 CI failures summary and remediations

As of commit b413a7f (more details on the Dr. CI page):


None of the CI failures appear to be your fault 💚



🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

Since your merge base is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 9 times.

@mruberry mruberry self-requested a review August 26, 2020 04:17
@mruberry
Copy link
Collaborator

Let me follow-up and see if this is removable now.

@mruberry mruberry added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module topic: operator labels Aug 26, 2020
Copy link
Collaborator

Choose a reason for hiding this comment

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

Updating this warning message is a good idea. I had the opportunity to review the history of this deprecation with @gchanan and we'd like to clarify why the function is being deprecated too, and that's because it's inconsistent with Python's range function (see the ancient #733).

What about a sentence like, "torch.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Use torch.arange, which produces values in [start, end), instead."

We could also update the warning in the documentation for torch.range to something like:

"This function is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin. Use torch.arange, which produces values in [start, end), instead."

Do you think that would improve these warnings, @xuhdev?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely, I agree the new message is more informative. In addition, I also added that torch.arange runs faster as an additional incentive. (arange is vectorized but range is not)

@xuhdev xuhdev requested a review from mruberry August 28, 2020 20:37
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this, @xuhdev! I slightly tweaked your wording to remove the claim that arange is faster, just because performance is so highly variable and system dependent. I actually checked and from code review and empiric timings arange IS faster, though.

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.

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

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in 6da26cf.

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

Labels

Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants