Skip to content

Commit

Permalink
[PyTorch] Check is_same instead of data_ptr in addmm_out_cuda_impl (p…
Browse files Browse the repository at this point in the history
…ytorch#55111)

Summary:
Pull Request resolved: pytorch#55111

I don't see how we could have ended up with !is_same but also identical data_ptr, and is_same is cheaper.
ghstack-source-id: 125438822

Test Plan: Existing CI?

Reviewed By: ngimel

Differential Revision: D27484914

fbshipit-source-id: 22125b29e6e09d312a2b92e893d08c69059e4435
  • Loading branch information
swolchok authored and facebook-github-bot committed Apr 1, 2021
1 parent 7824d82 commit d2aab53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/native/cuda/LinearAlgebra.cu
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma
result_ptr, result_ld
);
});
if (result.data_ptr() != result_->data_ptr()) {
if (!result.is_same(*result_)) {
result.copy_(*result_);
}
return result;
Expand Down

0 comments on commit d2aab53

Please sign in to comment.