Skip to content

Conversation

Gouvernathor
Copy link
Contributor

@Gouvernathor Gouvernathor commented May 11, 2022

This PR provides a clearer message than TypeError: tensor or list of tensors expected, got <class 'list'>, when having (for example) a list of numpy arrays.

so that the type-check stfu
incidentally speeds up the thing, since all() possibly checked all elements and we don't.
@datumbox datumbox changed the title Even better TypeError message than #5994 Clarify TypeError message May 12, 2022
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Gouvernathor.

@datumbox datumbox merged commit 18b39e3 into pytorch:main May 12, 2022
@Gouvernathor Gouvernathor deleted the patch-2 branch May 12, 2022 09:26
facebook-github-bot pushed a commit that referenced this pull request May 24, 2022
Summary:
* Clarify TypeError message

* typo

* Wrap tye() in repr()

so that the type-check stfu

* Even better message

incidentally speeds up the thing, since all() possibly checked all elements and we don't.

Reviewed By: datumbox

Differential Revision: D36413347

fbshipit-source-id: ddd904bcd3b5b433a76e44cea949e809434b914a

Co-authored-by: Vasilis Vryniotis <datumbox@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants