mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-06 00:03:22 +00:00
Add const cast for DLManagedTensor (#19982)
### Description <!-- Describe your changes. --> Add Const Cast for DLManagedTensor as PyTorch has changed it's [code](https://github.com/pytorch/pytorch/pull/121102) which creates incompatibility. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Fix the below error while configuring ORT-training with nightly PyTorch ``` aten_op_executor.cc:60:40: error: invalid conversion from ‘const DLManagedTensor*’ to ‘DLManagedTensor*’ [-fpermissive] 60 | at::Tensor tensor = at::fromDLPack(dlpack); | ^~~~~~ | | | const DLManagedTensor* ```
This commit is contained in:
parent
c45cff60cf
commit
6fe02068af
1 changed files with 1 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ struct ATenOperator {
|
|||
c10::IValue i_value;
|
||||
// Create the torch tensor from this DLPack no matter we need it or not below,
|
||||
// so that the dlpack's deleter will be triggered when torch tensor is out of scope.
|
||||
at::Tensor tensor = at::fromDLPack(dlpack);
|
||||
at::Tensor tensor = at::fromDLPack(const_cast<DLManagedTensor*>(dlpack));
|
||||
switch (elem_kinds[index]) {
|
||||
case c10::TypeKind::TensorType: {
|
||||
i_value = is_optional ? c10::IValue(c10::optional<at::Tensor>(tensor)) : c10::IValue(tensor);
|
||||
|
|
|
|||
Loading…
Reference in a new issue