Skip to content

Commit 765c3fc

Browse files
ajindal1malfet
authored andcommitted
fix breaking changes for ONNX Runtime Training (#122000)
Fixes breaking changes for ONNX Runtime Training. PR #121102 introduced incompatibility with ORT training because of change in parameter type. Creating a PR to add previous parameter types and verified that it works with ORT training. Error with current scenario: ``` site-packages/onnxruntime/training/ortmodule/torch_cpp_extensions/cpu/aten_op_executor/aten_op_executor.cc:60:40: error: invalid conversion from ‘const DLManagedTensor*’ to ‘DLManagedTensor*’ [-fpermissive] at::Tensor tensor = at::fromDLPack(dlpack); site-packages/torch/include/ATen/DLConvertor.h:15:46: note: initializing argument 1 of ‘at::Tensor at::fromDLPack(DLManagedTensor*)’ TORCH_API Tensor fromDLPack(DLManagedTensor* src); ``` Co-authored-by: Nikita Shulga <[email protected]> Pull Request resolved: #122000 Approved by: https://github.com/malfet
1 parent c2651a7 commit 765c3fc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

aten/src/ATen/DLConvertor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ namespace at {
1313
TORCH_API ScalarType toScalarType(const DLDataType& dtype);
1414
TORCH_API DLManagedTensor* toDLPack(const Tensor& src);
1515
TORCH_API Tensor fromDLPack(DLManagedTensor* src);
16+
C10_DEPRECATED_MESSAGE("Please migrate to a non-const variant")
17+
inline Tensor fromDLPack(const DLManagedTensor* src) {
18+
return fromDLPack(const_cast<DLManagedTensor*>(src));
19+
}
1620
TORCH_API Tensor
1721
fromDLPack(DLManagedTensor* src, std::function<void(void*)> deleter);
1822
TORCH_API DLDataType getDLDataType(const Tensor& t);

0 commit comments

Comments
 (0)