Skip to content

Conversation

@gchanan
Copy link
Contributor

@gchanan gchanan commented Aug 9, 2018

Before we had 0-dim tensors in TH, we were flexible in what we accepted wrt to the difference between size [] and size [1] tensors in backwards functions because they were identical in TH. So, we had backwards definitions that were technically incorrect, but happened to work. This often masks shape issues, adds greatly to code complexity and thus IMO isn't worth keeping.

Before we had 0-dim tensors in TH, we were flexible in what we accepted wrt to the difference between size [] and size [1]
tensors in backwards functions because they were identical in TH.  This often masks shape issues, adds greatly to code complexity  and thus IMO isn't worth keeping.
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.

Copy link
Member

@colesbury colesbury 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

do we have test cases that cover these regressions?


Tensor index_select_backward(Tensor grad, int64_t dim, Tensor indices, IntList sizes, bool keepdim) {
if (!keepdim) {
if (!keepdim && sizes.size() > 0) {

This comment was marked as off-topic.

This comment was marked as off-topic.

if (dims_to_unsqueeze[i])
res = res.unsqueeze(i);
if (dims_to_unsqueeze[i]) {
res = res.unsqueeze(i);

This comment was marked as off-topic.

This comment was marked as off-topic.

PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Aug 10, 2018
Summary:
Before we had 0-dim tensors in TH, we were flexible in what we accepted wrt to the difference between size [] and size [1] tensors in backwards functions because they were identical in TH.  So, we had backwards definitions that were technically incorrect, but happened to work.  This often masks shape issues, adds greatly to code complexity  and thus IMO isn't worth keeping.
Pull Request resolved: pytorch#10382

Differential Revision: D9244618

Pulled By: gchanan

fbshipit-source-id: 2c29c53a8ffe8710843451202cad6b4323af10e8
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
Before we had 0-dim tensors in TH, we were flexible in what we accepted wrt to the difference between size [] and size [1] tensors in backwards functions because they were identical in TH.  So, we had backwards definitions that were technically incorrect, but happened to work.  This often masks shape issues, adds greatly to code complexity  and thus IMO isn't worth keeping.
Pull Request resolved: pytorch#10382

Differential Revision: D9244618

Pulled By: gchanan

fbshipit-source-id: 2c29c53a8ffe8710843451202cad6b4323af10e8
@ezyang ezyang added the merged label Jun 26, 2019
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