Skip to content
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

Use resultElementType for tensor creation for AtenMemoryFormatOp with none dtype. #3941

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sahas3
Copy link
Contributor

@sahas3 sahas3 commented Jan 6, 2025

Prior to the change in this PR torch-mlir-opt --convert-torch-to-linalg was running into the following error:

error: 'tensor.cast' op operand type 'tensor<200x200x26xf32>' and result type 'tensor<200x200x26xf64>' are cast incompatible
    %1 = torch.aten.empty.memory_format %0, %none, %none, %none, %false, %none : !torch.list<int>, !torch.none, !torch.none, !torch.none, !torch.bool, !torch.none -> !torch.vtensor<[200,200,26],f64>
         ^
note: see current operation: %12 = "tensor.cast"(%11) : (tensor<200x200x26xf32>) -> tensor<200x200x26xf64

This is because when dtype of the aten.empty.memory_format is none, by default f32 was being selected as the element type of the resulting tensor which doesn't match with the actual element type of the result.

@sahas3 sahas3 requested a review from ramiro050 January 6, 2025 04:53
@sahas3
Copy link
Contributor Author

sahas3 commented Jan 6, 2025

Hi @ramiro050, I see that I am reverting your change here. It's not clear to me why the resultElementType was changed in that commit. I verified that the test you added passes with my change. Can you please take a look at this PR? Thanks!

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.

1 participant