Skip to content

Commit 1ba408b

Browse files
authored
AC: fix bert cls adapter for not 2D output (#2948)
1 parent 94a87fe commit 1ba408b

File tree

1 file changed

+5
-1
lines changed
  • tools/accuracy_checker/openvino/tools/accuracy_checker/adapters

1 file changed

+5
-1
lines changed

tools/accuracy_checker/openvino/tools/accuracy_checker/adapters/nlp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ def process(self, raw, identifiers=None, frame_meta=None):
336336
if not self.outputs_checked:
337337
self.select_output_blob(outputs)
338338
outputs = outputs[self.classification_out]
339-
if not self.single_score and outputs.shape[1] != self.num_classes:
339+
if outputs.ndim >= 3:
340+
outputs = np.squeeze(outputs)
341+
if outputs.ndim == 1 and len(identifiers) == 1:
342+
outputs = np.expand_dims(outputs, 0)
343+
if not self.single_score and outputs.shape[-1] != self.num_classes:
340344
_, hidden_size = outputs.shape
341345
output_weights = np.random.normal(scale=0.02, size=(self.num_classes, hidden_size))
342346
output_bias = np.zeros(self.num_classes)

0 commit comments

Comments
 (0)