Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

pooling3d operation for onnx

uelor
Novice
521 Views

Hi: 
I have been trying to convert to a ONNX model to intermediate representation using model optimizer, and I have an error in the max pooling operation. This is the error: 
[ ERROR ]  operands could not be broadcast together with shapes (2,) (3,) 
looking in the model optimizer code I see that is a numpy error, in pooling.py file line  116.

output_spatial_shape = np.array(rounding( np.array(input_spatial_shape + pad_spatial_shape - window_spatial_shape, dtype=np.float) / stride_spatial), dtype=np.int64) + 1

all variables sizes are 2 except pad_spatial_shape which is 3.

So my conclusion is that the pooling.py class is developed to use MaxPooling2D and the Pytorch operation makes 3D max pooling. 
https://pytorch.org/docs/stable/_modules/torch/nn/modules/pooling.html
After digging in the ONNX conversor from Pytorch I see that the pooling3D operation is transformed to pooling operation but with the 3 dimensions of the pooling (window_x, window_y, window_z). its like MaxPool(stride_x, stride_y,stride_z). 
But in the code of pooling.py we see that is discarding this  z variable. 

I see that model optimizer can make custom operators.  But no for ONNX.

https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer.html

So, my questions are: 
Is it implemented 3D pooling in openvino model optimizer?
Are you going to add custom operation framework for ONNx files?
Thanks in advance. 

0 Kudos
0 Replies
Reply