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

[onnx_importer] Fix constant bool tensor importing #4025

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

Conversation

giacs-epic
Copy link
Contributor

A constant tensor of bools is imported as something like

%0 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<[105, 108, 44]> : tensor<3xui8>} : () -> !torch.vtensor<[22],i1>

which leads to incompatible types errors

b.mlir:4:10: error: 'torch.vtensor.literal' op inferred type(s) '!torch.vtensor<[3],ui8>' are incompatible with return type(s) of operation '!torch.vtensor<[22],i1>'
    %0 = torch.operator "onnx.Constant"() {torch.onnx.value = dense<[105, 108, 44]> : tensor<3xui8>} : () -> !torch.vtensor<[22],i1> 

This PR fixes the translation by removing the numpy.packbits() processing.

Note about e2eshark tests: some tests (e.g. test_sequence_map_identity_1_sequence_expanded) contain scalar constant boolean tensors. Compilation of the constant part seems to work fine, but this is due to the dimension size of the tensor being 1, which means types are compatible.

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