mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Avoid COW materialize in various places (1) (#124984)
Most, not all, of these cases were found automatically with `git grep -n '^\s*\<const\>.*\*.*=.*\<data_ptr\>'` Part of #97856 Pull Request resolved: https://github.com/pytorch/pytorch/pull/124984 Approved by: https://github.com/Skylion007
This commit is contained in:
committed by
PyTorch MergeBot
parent
2ea1e84d40
commit
abcb42cdd2
@ -131,7 +131,7 @@ struct TensorQueue : torch::CustomClassHolder {
|
||||
const std::string key = "queue";
|
||||
at::Tensor size_tensor;
|
||||
size_tensor = dict.at(std::string(key + "/size")).cpu();
|
||||
const auto* size_tensor_acc = size_tensor.data_ptr<int64_t>();
|
||||
const auto* size_tensor_acc = size_tensor.const_data_ptr<int64_t>();
|
||||
int64_t queue_size = size_tensor_acc[0];
|
||||
|
||||
for (const auto index : c10::irange(queue_size)) {
|
||||
|
Reference in New Issue
Block a user