Skip to content

Various example code fixes#12707

Closed
t-vi wants to merge 4 commits intopytorch:masterfrom
t-vi:misc_doc_fixes
Closed

Various example code fixes#12707
t-vi wants to merge 4 commits intopytorch:masterfrom
t-vi:misc_doc_fixes

Conversation

@t-vi
Copy link
Copy Markdown
Collaborator

@t-vi t-vi commented Oct 16, 2018

  • Fix broken sparse_coo_examples, update output
  • Tensor(...) to tensor(...)
  • Fix arguments to math.log to be floats

While the last might be debateable, mypy currently complains when passing an int to math.log. As it is not essential for our examples, let's be clean w.r.t. other people's expectations.

These popped up while checking examples in the context of #12500 .

t-vi added 3 commits October 16, 2018 12:30
- Fix broken sparse_coo_examples, update output
- Tensor(...) to tensor(...)
- Fix arguments to math.log to be floats
  While the last might be debateable, mypy currently complains
  when passing an int to math.log. As it is not essential
  for our examples, let's be clean w.r.t. other people's
  expectations.
Comment thread torch/_torch_docs.py Outdated
values=tensor([], size=(0,)),
size=(0,), nnz=0, layout=torch.sparse_coo)

>>> torch.sparse_coo_tensor(torch.zeros(0, 1), 11.7, [])) # Create a scalar sparse Tensor

This comment was marked as off-topic.

Copy link
Copy Markdown
Collaborator

@ssnl ssnl left a comment

Choose a reason for hiding this comment

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

Could you undo the sparse_coo_tensor examples? Those are fixed in #12221, which I think is landing (soon).

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.

SsnL is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
- Fix broken sparse_coo_examples, update output
- Tensor(...) to tensor(...)
- Fix arguments to math.log to be floats

While the last might be debateable, mypy currently complains when passing an int to math.log. As it is not essential for our examples, let's be clean w.r.t. other people's expectations.

These popped up while checking examples in the context of  pytorch#12500 .
Pull Request resolved: pytorch#12707

Differential Revision: D10415256

Pulled By: SsnL

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants