Skip to content

Interpretable Error Message for ScalarType Mismatch #6850

@proshian

Description

@proshian

🚀 The feature, motivation and pitch

Currently, when a module is provided with input of a wrong type (ex. long instead of integer), an error is raised with a message like below:

The 0-th input tensor's scalartype does not meet requirement: found 3 but expected 4

It is not immediately obvious that 3 corresponds to Int and 4 corresponds to Long. This lack of clarity can cause confusion

Possible solutions

  1. Replace numbers with string representations. For example by defining a function with a switch condition for every enum value. I see that this may become a maintainance disaster, but there are better options too like boost/preprocessor usage in this stack overflow answer.
  2. Just provide a link to the file containing the ScalarType class (as far as I can see the link is: https://github.com/pytorch/pytorch/blob/main/torchgen/executorch/model.py)

While this is a small improvement, I believe it would make the error message more clear and helpful

Thank you for executorch :)

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionableItems in the backlog waiting for an appropriate impl/fixgood first issueGood for newcomersmodule: runtimeIssues related to the core runtime and code under runtime/triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions