[POT] Fix for measuring input shape when inference model with batch greater 1 in FBC (#10063)

* fix: diffrent batch shape in prediction and target in ac

* add calculate metric in engine True

* resolve conflicts
This commit is contained in:
Indira Salyahova
2022-02-12 19:12:58 +03:00
committed by GitHub
parent 8e43987cd7
commit ea00eae922
2 changed files with 4 additions and 0 deletions

View File

@@ -212,7 +212,10 @@ class FastBiasCorrection(Algorithm):
if input_node.type == 'FakeQuantize':
input_node = nu.get_node_input(input_node, 0)
calculate_input_shape[input_node.fullname] = {'shape_node': lambda x: x.shape}
calculate_metrics = self._engine.calculate_metrics
self._engine.calculate_metrics = False
_, inputs_shape = self._engine.predict(calculate_input_shape, sampler)
self._engine.calculate_metrics = calculate_metrics
for node_name, shape_node in inputs_shape.items():
inputs_shape[node_name] = shape_node['shape_node'][0]
if len(inputs_shape[node_name]) > 1:

View File

@@ -24,6 +24,7 @@ class Engine(ABC):
self._statistic_graph_builder = StatisticGraphBuilder()
self._stat_requests_number = self.config.get('stat_requests_number', None)
self._eval_requests_number = self.config.get('eval_requests_number', None)
self.calculate_metrics = True
def set_model(self, model):
""" Set/reset model to instance of engine class