Skip to content

Commit 9964e90

Browse files
Dmitry Sidnevanzhella-pankratova
andauthored
Fix getting shape
Co-authored-by: Anzhella Pankratova <[email protected]>
1 parent 4011a95 commit 9964e90

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

demos/common/python/openvino/model_zoo/model_api/models/background_matting.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,9 @@ def _get_inputs(self):
112112
return image_blob_names, image_info_blob_names
113113

114114
def set_input_shape(self):
115-
shapes = []
116-
for name in self.image_blob_names:
117-
shapes.append(self.inputs[name].shape)
118-
for i in range(1, len(shapes)):
119-
if shapes[i] != shapes[i - 1]:
120-
raise WrapperError(self.__model__, 'Image inputs have incompatible shapes: {}'.format(shapes))
115+
shapes = [tuple(self.inputs[name].shape) for name in self.image_blob_names]
116+
if len(set(shapes)) != 1:
117+
raise WrapperError(self.__model__, 'Image inputs have incompatible shapes: {}'.format(shapes))
121118
return shapes[0]
122119

123120
def _get_outputs(self):

0 commit comments

Comments
 (0)