diff options
author | Annie Tallund <annie.tallund@arm.com> | 2023-09-19 16:34:14 +0200 |
---|---|---|
committer | Annie Tallund <annie.tallund@arm.com> | 2023-09-26 14:24:39 +0200 |
commit | 8dec455c467b8019223a40e107378845e1419f5d (patch) | |
tree | 823051d364c78e3ce7f70023eb94021d8b051274 /src/mlia/nn/tensorflow/utils.py | |
parent | ba251631768f25b840e93ece6a4af3db119e6dd1 (diff) | |
download | mlia-8dec455c467b8019223a40e107378845e1419f5d.tar.gz |
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 <annie.tallund@arm.com>
Change-Id: I198dae2b53860f449f2fdbc71575babceed1ffcf
Diffstat (limited to 'src/mlia/nn/tensorflow/utils.py')
-rw-r--r-- | src/mlia/nn/tensorflow/utils.py | 4 |
1 files changed, 1 insertions, 3 deletions
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 |