Skip to content

Commit

Permalink
quant: throw a nice error message for allclose with quantized inputs
Browse files Browse the repository at this point in the history
Summary:

Currently `torch.allclose` is not supported with quantized inputs.
Throw a nice error message instead of a cryptic one.

Test Plan:

```
torch.allclose(x_fp32, y_fp32)

torch.allclose(x_int8, y_int8)
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 9b80d89941a420581acf2d72bcbc5de6880438e2
Pull Request resolved: #49802
  • Loading branch information
vkuzo committed Jan 4, 2021
1 parent c439a65 commit 0e3569e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aten/src/ATen/native/TensorCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Tensor isclose(const Tensor& self, const Tensor& other, double rtol, double atol
TORCH_CHECK(self.scalar_type() == other.scalar_type(), self.scalar_type(), " did not match ", other.scalar_type());
TORCH_CHECK(!(self.is_complex() && equal_nan),
"isclose with equal_nan=True is not supported for complex inputs.");
TORCH_CHECK(!(self.is_quantized() || other.is_quantized()),
"isclose is not supported for quantized inputs.");

// Checks that rtol and atol are non-negative
// Note: consistent with Python's isclose but divergent from NumPy's, which
Expand Down

0 comments on commit 0e3569e

Please sign in to comment.