KEMBAR78
Simplify error message for failed int comparison · Issue #56377 · pytorch/pytorch · GitHub
Skip to content

Simplify error message for failed int comparison #56377

@ezyang

Description

@ezyang

If you use assertEqual to compare two integers you get a message like

AssertionError: False is not true : Scalars failed to compare as equal! Comparing -6 and 0 gives a difference of 6, but the allowed difference with rtol=0 and atol=0 is only 0!

The stuff about rtol and atol is is needlessly obscure and obscures the fact that, e.g., the integers in question are exit codes, for example. One easy fix is to suppress rtol/atol sentence if those are exactly zero; I'd also suggest we shouldn't report "difference" for integer comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    better-engineeringRelatively self-contained tasks for better engineering contributorsmodule: error checkingBugs related to incorrect/lacking error checkingtriagedThis 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