(builder, node, graph, err)
convert to CoreML Pooling Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L477
convert to CoreML Pooling Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L477
convert to CoreML Pooling Layer : https : // github . com / apple / coremltools / blob / 655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492 / mlmodel / format / NeuralNetwork . proto#L477
def _convert_pool(builder, node, graph, err):
    '''
    convert to CoreML Pooling Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L477
    '''
    params_dict = dict()
    params_dict['is_global'] = False
    if node.op_type.startswith('Global'):
        params_dict['is_global'] = True
    if node.op_type.endswith("MaxPool"):
        params_dict['layer_type'] = "MAX"
    elif node.op_type.endswith("AveragePool"):
        params_dict['layer_type'] = "AVERAGE"
    else:
        return err.unsupported_op_configuration(builder, node, graph, "Unsupported pool type")

    if len(node.outputs) == 2:
        return err.unsupported_op_configuration(builder, node, graph, "argmax with pool unsupported")

    if 'ceil_mode' in node.attrs and node.attrs['ceil_mode'] == 1:
        return err.unsupported_op_configuration(builder, node, graph, "ceil_mode=1 not supported")

    if 'dilations' in node.attrs:
        return err.unsupported_op_configuration(builder, node, graph, "dilations not supported")

    _add_conv_like_op(_add_pool, _get_pool_params, params_dict,
                      builder, node, graph, err)
def _convert_pool ( builder , node , graph , err ) : params_dict = dict ( ) params_dict [ 'is_global' ] = False if node . op_type . startswith ( 'Global' ) : params_dict [ 'is_global' ] = True if node . op_type . endswith ( "MaxPool" ) : params_dict [ 'layer_type' ] = "MAX" elif node . op_type . endswith ( "AveragePool" ) : params_dict [ 'layer_type' ] = "AVERAGE" else : return err . unsupported_op_configuration ( builder , node , graph , "Unsupported pool type" ) if len ( node . outputs ) == 2 : return err . unsupported_op_configuration ( builder , node , graph , "argmax with pool unsupported" ) if 'ceil_mode' in node . attrs and node . attrs [ 'ceil_mode' ] == 1 : return err . unsupported_op_configuration ( builder , node , graph , "ceil_mode=1 not supported" ) if 'dilations' in node . attrs : return err . unsupported_op_configuration ( builder , node , graph , "dilations not supported" ) _add_conv_like_op ( _add_pool , _get_pool_params , params_dict , builder , node , graph , err )