From 8dec455c467b8019223a40e107378845e1419f5d Mon Sep 17 00:00:00 2001 From: Annie Tallund Date: Tue, 19 Sep 2023 16:34:14 +0200 Subject: MLIA-469 Support batch size > 1 for optimizations - Add a PruningPolicy to skip layers that are not supported by the Keras pruning API - Make dataset generation more generic to support use-cases beyond classification Signed-off-by: Annie Tallund Change-Id: I198dae2b53860f449f2fdbc71575babceed1ffcf --- src/mlia/nn/tensorflow/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mlia/nn/tensorflow/utils.py') diff --git a/src/mlia/nn/tensorflow/utils.py b/src/mlia/nn/tensorflow/utils.py index d688a63..77ac529 100644 --- a/src/mlia/nn/tensorflow/utils.py +++ b/src/mlia/nn/tensorflow/utils.py @@ -21,12 +21,10 @@ def representative_dataset( input_shape: Any, sample_count: int = 100, input_dtype: type = np.float32 ) -> Callable: """Sample dataset used for quantization.""" - if input_shape[0] != 1: - raise ValueError("Only the input batch_size=1 is supported!") def dataset() -> Iterable: for _ in range(sample_count): - data = np.random.rand(*input_shape) + data = np.random.rand(1, *input_shape[1:]) yield [data.astype(input_dtype)] return dataset -- cgit v1.2.1