Lines Matching +full:zero +full:- +full:point
1 //===- quant.c - Test of Quant dialect C API ------------------------------===//
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 // RUN: mlir-capi-quant-test 2>&1 | FileCheck %s
12 #include "mlir-c/Dialect/Quant.h"
13 #include "mlir-c/BuiltinTypes.h"
14 #include "mlir-c/IR.h"
21 // CHECK-LABEL: testTypeHierarchy
27 ctx, mlirStringRefCreateFromCString("!quant.any<i8<-8:7>:f32>")); in testTypeHierarchy()
30 "!quant.uniform<i8<-8:7>:f32, 0.99872:127>")); in testTypeHierarchy()
36 mlirStringRefCreateFromCString("!quant.calibrated<f32<-0.998:1.2321>>")); in testTypeHierarchy()
82 // CHECK-LABEL: testAnyQuantizedType
87 ctx, mlirStringRefCreateFromCString("!quant.any<i8<-8:7>:f32>")); in testAnyQuantizedType()
92 mlirAnyQuantizedTypeGet(mlirQuantizedTypeGetSignedFlag(), i8, f32, -8, 7); in testAnyQuantizedType()
106 // CHECK: storage min: -8 in testAnyQuantizedType()
115 // CHECK: quantized element type: !quant.any<i8<-8:7>:f32> in testAnyQuantizedType()
122 // CHECK: !quant.any<i8<-8:7>:f32> in testAnyQuantizedType()
127 // CHECK-LABEL: testUniformType
133 "!quant.uniform<i8<-8:7>:f32, 0.99872:127>")); in testUniformType()
138 mlirQuantizedTypeGetSignedFlag(), i8, f32, 0.99872, 127, -8, 7); in testUniformType()
142 // CHECK: zero point: 127 in testUniformType()
143 fprintf(stderr, "zero point: %" PRId64 "\n", in testUniformType()
145 // CHECK: fixed point: 0 in testUniformType()
146 fprintf(stderr, "fixed point: %d\n", in testUniformType()
151 // CHECK: !quant.uniform<i8<-8:7>:f32, 9.987200e-01:127> in testUniformType()
156 // CHECK-LABEL: testUniformPerAxisType
186 // CHECK: zero point 0: 0 in testUniformPerAxisType()
187 fprintf(stderr, "zero point 0: %" PRId64 "\n", in testUniformPerAxisType()
189 // CHECK: zero point 1: 120 in testUniformPerAxisType()
190 fprintf(stderr, "zero point 1: %" PRId64 "\n", in testUniformPerAxisType()
195 // CHECK: fixed point: 0 in testUniformPerAxisType()
196 fprintf(stderr, "fixed point: %d\n", in testUniformPerAxisType()
201 // CHECK: !quant.uniform<i8:f32:1, {2.000000e+02,9.987200e-01:120}> in testUniformPerAxisType()
206 // CHECK-LABEL: testCalibratedType
212 mlirStringRefCreateFromCString("!quant.calibrated<f32<-0.998:1.2321>>")); in testCalibratedType()
215 MlirType calibrated = mlirCalibratedQuantizedTypeGet(f32, -0.998, 1.2321); in testCalibratedType()
217 // CHECK: min: -0.998000 in testCalibratedType()
224 // CHECK: !quant.calibrated<f32<-0.998:1.232100e+00>> in testCalibratedType()