def get_shape_onnx(x, unknown_dim_size=1):
    """
    Extract shape from onnx input.
    Replace unknown dimension by default with 1.

    Parameters
    ----------
    x: onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto
    unknown_dim_size: int
        Default: 1
    """
    shape = x.type.tensor_type.shape.dim
    # replace unknown dimensions by default with 1
    shape = [i.dim_value if i.dim_value else unknown_dim_size for i in shape]
    return shape