Skip to content

Commit a81505b

Browse files
dbortfacebook-github-bot
authored andcommitted
Fix aten-mode copy_tensor_data()
Summary: I modified this function in D48076575 but got the pointers wrong, causing test failures like https://www.internalfb.com/intern/testinfra/diagnostics/2251800007429278.562950048980124.1691447874/. Restore the previous logic, which seems to work again. Reviewed By: larryliu0820 Differential Revision: D48135616 fbshipit-source-id: aa9b22789d82cd20c62a2b3b6a956a5594862a9d
1 parent 14711d3 commit a81505b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

runtime/core/exec_aten/util/tensor_util_aten.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ Error share_tensor_data(const at::Tensor& t_dst, const at::Tensor& t_src) {
5858
}
5959

6060
Error copy_tensor_data(const at::Tensor& t_dst, const at::Tensor& t_src) {
61-
void* dst_data_ptr = t_dst.mutable_data_ptr();
61+
void* dst_data_ptr = t_dst.unsafeGetTensorImpl()
62+
->unsafe_storage()
63+
.unsafeGetStorageImpl()
64+
->data_ptr()
65+
.get();
6266

6367
// Currently even 0 sized tensors receive a dataptr in pre_allocated
6468
// memory planning so we can do this check.

0 commit comments

Comments
 (0)