Skip to content

Enable 0-dim tensors in TH.#10412

Closed
gchanan wants to merge 2 commits intopytorch:masterfrom
gchanan:zerodim_test_th5
Closed

Enable 0-dim tensors in TH.#10412
gchanan wants to merge 2 commits intopytorch:masterfrom
gchanan:zerodim_test_th5

Conversation

@gchanan
Copy link
Contributor

@gchanan gchanan commented Aug 10, 2018

This does the following:

  1. Delete USE_TH_SCALAR ifdefs, since this is now enabled.
  2. sizes_, strides_ in THTensor are always at least size 1 (and may have is_zero_dim_ set).
    A future PR will remove is_zero_dim_, so sizes_ and strides_ will just be size 0.
  3. Allow IntList sizes with nullptr; this wasn't allowed previously because sizes were always at least size 1 in TH.
  4. Get rid of get_intlist_size_th compatibility call in ATen; we now just use the IntList size directly.
    We still use the stride compatibility call; a future PR will remove this.
  5. Fix a case in TensorIterator where a tensor was resized with shape length 0 and stride length 1.

This does the following:
1) Delete USE_TH_SCALAR ifdefs, since this is now enabled.
2) sizes_, strides_ in THTensor are always at least size 1 (and may have is_zero_dim_ set).
A future PR will remove is_zero_dim_, so sizes_ and strides_ will just be size 0.
3) Allow IntList sizes with nullptr; this wasn't allowed previously because sizes were always at least size 1 in TH.
4) Get rid of get_intlist_size_th compatibility call in ATen; we now just use the IntList size directly.
We still use the stride compatibility call; a future PR will remove this.
5) Fix a case in TensorIterator where a tensor was resized with shape length 0 and stride length 1.
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.

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

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.

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

@gchanan
Copy link
Contributor Author

gchanan commented Aug 10, 2018

Closing in favor of #10414.

@gchanan gchanan closed this Aug 10, 2018
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.

3 participants