Skip to content

Conversation

@jhalakpatel
Copy link
Collaborator

@jhalakpatel jhalakpatel commented Oct 1, 2024

Passing a Torch tensor to Tripy operations produces a cryptic error message since both Tripy and Torch use the same qualified name i.e. "Tensor" for their corresponding Tensor class i.e. torch.Tensor and tripy.frontend.tensor.Tensor.

    def test_tensor_mismatch_tripy(self):
        a = torch.arange(1)
        b = torch.arange(1)
        print(tp.equal(a, b))

Error:

E For parameter: 'a', expected an instance of type: 'Tensor' but got argument of type: 'Tensor'.

Fix is to simplify prepend obj.__qualname__ with obj.__module__ to generate a fully qualified name.

E For parameter: 'a', expected an instance of type: 'tripy.frontend.tensor.Tensor' but got argument of type: 'torch.Tensor'.

@jhalakpatel jhalakpatel force-pushed the jhalakp-improve-type-mismatch-error branch from 9f4c617 to edf7999 Compare October 1, 2024 00:14
@jhalakpatel jhalakpatel marked this pull request as ready for review October 1, 2024 00:15
@jhalakpatel
Copy link
Collaborator Author

@pranavm-nvidia will submit a PR that fixes the type mismatch issue and some simplifications. Closing this PR in favor of it.

@jhalakpatel jhalakpatel closed this Oct 1, 2024
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