Skip to content

Conversation

@peterbell10
Copy link
Collaborator

Fixes gh-40287

The int -> bool conversion takes higher precedence than int -> IntArrayRef. So, calling std(0) in C++ would select the std(unbiased=False) overload instead.

The int->bool conversion taking higher precedence than int->IntArrayRef. So,
calling std(0) in c++ wouldn't select the dimension overload.
@dr-ci
Copy link

dr-ci bot commented Jun 23, 2020

💊 CI failures summary and remediations

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


💚 💚 Looks good so far! There are no failures yet. 💚 💚


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 3 times.

return at::native::var(self, IntArrayRef{dim});
}

inline std::tuple<Tensor,Tensor> var_mean(const Tensor& self, int dim) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be int64_t?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

std(0) will only work if the type is an exact match for operator overloading, so dim must be exactly int. I could add more overloads to accept other integral types, but an int overload would still be needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to explicitly mention this in the comment!

@zou3519 zou3519 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 23, 2020
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.

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

@facebook-github-bot
Copy link
Contributor

@ezyang merged this pull request in 16f276c.

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.

Libtorch tensor.std(0) gets confused about which overload to use (expected vector, not scalar)

5 participants