Skip to content

Add const cast for DLManagedTensor #19982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

ajindal1
Copy link
Contributor

Description

Add Const Cast for DLManagedTensor as PyTorch has changed it's code which creates incompatibility.

Motivation and Context

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*

@ajindal1 ajindal1 requested review from wschin and baijumeswani March 19, 2024 21:36
@ajindal1 ajindal1 merged commit 6fe0206 into main Mar 20, 2024
@ajindal1 ajindal1 deleted the abjindal/add_const_cast_dlmanagedtensor branch March 20, 2024 00:00
ajindal1 added a commit that referenced this pull request Mar 22, 2024
### Description
<!-- Describe your changes. -->
Removing const_cast as it might lead to unknown behavior. Specifying
DLMangedTensor as a const doesn't seem to be necessary and I have tested
this by running torch_ort.configure. Not sure what other tests which
needs to be done. Background can be found in this
[PR](#19982)


### 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. -->
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request May 7, 2024
### Description
<!-- Describe your changes. -->
Add Const Cast for DLManagedTensor as PyTorch has changed it's
[code](pytorch/pytorch#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*
```
TedThemistokleous pushed a commit to TedThemistokleous/onnxruntime that referenced this pull request May 7, 2024
### Description
<!-- Describe your changes. -->
Removing const_cast as it might lead to unknown behavior. Specifying
DLMangedTensor as a const doesn't seem to be necessary and I have tested
this by running torch_ort.configure. Not sure what other tests which
needs to be done. Background can be found in this
[PR](microsoft#19982)


### 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. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants