Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions backends/arm/test/tester/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Callable,
Dict,
Generic,
Iterable,
List,
Optional,
Sequence,
Expand Down Expand Up @@ -246,6 +247,20 @@ def quantizer(self) -> TOSAQuantizer:
f"First argument of quantize stage was {type(quantize_stage).__name__}, not Quantize as expected."
)

def set_quantization_calibration(
self,
calibration_samples: Iterable[Any],
dynamic_shapes: Optional[Tuple[Any, ...]] = None,
):
"""Calibrates the quantize stage with the given samples instead of the
test data.
"""
quantize_stage = self._stages[self.find_pos("quantize")].args[0]
quantize_stage.calibration_samples = calibration_samples
if dynamic_shapes is not None:
quantize_stage.dynamic_shapes = dynamic_shapes
return self

def pop_stage(self, identifier: int | str):
"""Removes and returns the stage at postion pos."""
if isinstance(identifier, int):
Expand Down
Loading