quark.onnx.tools.remove_qdq_mul_add

quark.onnx.tools.remove_qdq_mul_add#

Module Contents#

Functions#

quark.onnx.tools.remove_qdq_mul_add.remove_qdq_mul_add(onnx_model: onnx.ModelProto) Any#

Modify an ONNX quantized model to remove q and dq ops in the mul + q + dq + add structure. Start from Add nodes and traverse upwards.

Parameters:

onnx_model – The input ONNX model.

Returns:

Modified ONNX model with q and dq ops in the mul + q + dq + add structure removed.

quark.onnx.tools.remove_qdq_mul_add.find_node_by_output(nodes: List[onnx.NodeProto], output_name: str) onnx.NodeProto | None#

Find a node that produces the specified output.

Parameters:
  • nodes – List of nodes to search.

  • output_name – The output name to match.

Returns:

The node that matches the output or None if not found.