-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Port is_set_to from TH/THC to ATen. #28425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[ghstack-poisoned]
| return result.copy_(self); | ||
| } | ||
|
|
||
| bool is_set_to(const Tensor &self, const Tensor& src) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tensor & vs Tensor&?
| self.storage_offset() == src.storage_offset() && | ||
| self.dim() == src.dim()) | ||
| { | ||
| for (int64_t d = 0; d < self.dim(); ++d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (auto d = decltype(self.dim()){0}; d < ...
| auto result = at::empty_like(self, self.options(), memory_format); | ||
| return result.copy_(self); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function need a comment? The name isn't super clear.
| for (int64_t d = 0; d < self.dim(); ++d) | ||
| { | ||
| if (self.size(d) != src.size(d) || self.stride(d) != src.stride(d)) { | ||
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not return false here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to verify return values. Style comments optional (but comments are always nice).
Differential Revision: [D18063328](https://our.internmc.facebook.com/intern/diff/D18063328) [ghstack-poisoned]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving (assuming you'll fix lint).
Differential Revision: [D18063328](https://our.internmc.facebook.com/intern/diff/D18063328) [ghstack-poisoned]
Differential Revision: [D18063328](https://our.internmc.facebook.com/intern/diff/D18063328) [ghstack-poisoned]
Differential Revision: [D18063328](https://our.internmc.facebook.com/intern/diff/D18063328) [ghstack-poisoned]
Summary: Pull Request resolved: pytorch/pytorch#28425 Test Plan: Imported from OSS Differential Revision: D18063328 Pulled By: gchanan fbshipit-source-id: 86af01a630d88c30947b8c85d1fac86dd7b40585
Summary: Pull Request resolved: pytorch#28425 Test Plan: Imported from OSS Differential Revision: D18063328 Pulled By: gchanan fbshipit-source-id: 86af01a630d88c30947b8c85d1fac86dd7b40585
Stack from ghstack:
Differential Revision: D18063328