Skip to content

Commit a5365a2

Browse files
committed
Remove redundant checks related to quantized type
1 parent 915df1a commit a5365a2

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

mlir/lib/Dialect/Quant/IR/QuantTypes.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ LogicalResult UniformQuantizedType::verifyInvariants(
322322
// Verify scale.
323323
double minScale = getMinScale(expressedType);
324324
double maxScale = getMaxScale(expressedType);
325-
if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale))
326-
return emitError() << "illegal scale: " << scale;
327325
if (scale < minScale || scale > maxScale)
328326
return emitError() << "scale out of expressed type range [" << minScale
329327
<< ", " << maxScale << "]";
@@ -388,8 +386,6 @@ LogicalResult UniformQuantizedPerAxisType::verifyInvariants(
388386
double minScale = getMinScale(expressedType);
389387
double maxScale = getMaxScale(expressedType);
390388
for (double scale : scales) {
391-
if (scale <= 0.0 || std::isinf(scale) || std::isnan(scale))
392-
return emitError() << "illegal scale: " << scale;
393389
if (scale < minScale || scale > maxScale)
394390
return emitError() << "scale out of expressed type range [" << minScale
395391
<< ", " << maxScale << "]";

mlir/test/Dialect/Quant/parse-uniform-invalid.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
// -----
109109
// Illegal scale: negative
110-
// expected-error@+1 {{illegal scale: -1.000000}}
110+
// expected-error@+1 {{scale out of expressed type range}}
111111
!qalias = !quant.uniform<i8<-4:3>:f32, -1.0:127>
112112

113113
// -----

0 commit comments

Comments
 (0)