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
5 changes: 5 additions & 0 deletions src/nncf/common/tensor_statistics/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ def collect_statistics(self, model: TModel, graph: NNCFGraph) -> None:
outputs = engine.infer(input_data)
processed_outputs = self._process_outputs(outputs)
self._register_statistics(processed_outputs, merged_statistics)
# Manually dereference output tensors to hint gc to remove them. Without it,
# the processed_outputs and outputs remain during model inference,
# increasing the peak memory consumption.
del processed_outputs
del outputs
processed_samples += 1
if processed_samples == 0:
raise nncf.ValidationError(EMPTY_DATASET_ERROR)
Expand Down