Skip to content

Commit

Permalink
Add Test
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlizarraga committed Jan 30, 2024
1 parent 32b71bb commit 2f17f18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions onnxruntime/test/python/quantization/test_qdq.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,13 @@ def verify_qdq(self, per_channel, activation_type, weight_type, extra_options=No
)
check_model_correctness(self, model_fp32_path, model_qdq_path, data_reader.get_next())

# If the model uses Q/DQ ops with "com.microsoft" domain (e.g., for int16 support),
# then ensure the model has the appropriate opset import.
if extra_options and extra_options.get("UseQDQContribOps", False):
qdq_model = onnx.load_model(model_qdq_path)
ms_opset = next((opset for opset in qdq_model.opset_import if opset.domain == "com.microsoft"), None)
self.assertTrue(ms_opset is not None)

Check notice

Code scanning / CodeQL

Imprecise assert Note test

assertTrue(a is not b) cannot provide an informative message. Using assertIsNot(a, b) instead will give more informative messages.

def verify_qop(self, per_channel, is_quant_type_int8):
np.random.seed(1)
model_fp32_path = str(Path(self._tmp_model_dir.name) / f"conv_relu_fp32.{per_channel}.onnx")
Expand Down

0 comments on commit 2f17f18

Please sign in to comment.