(builder, node, graph, err)
convert to CoreML Upsample or Resize Bilinear Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2139
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2178
convert to CoreML Upsample or Resize Bilinear Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2139
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2178
convert to CoreML Upsample or Resize Bilinear Layer : https : // github . com / apple / coremltools / blob / 655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492 / mlmodel / format / NeuralNetwork . proto#L2139 https : // github . com / apple / coremltools / blob / 655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492 / mlmodel / format / NeuralNetwork . proto#L2178
def _convert_resize(builder, node, graph, err):
    '''
    convert to CoreML Upsample or Resize Bilinear Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2139
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L2178
    '''
    mode = node.attrs.get('mode', 'nearest')
    if node.inputs[1] not in node.input_tensors:
        return err.unsupported_op_configuration(builder, node, graph, "Scaling factor unknown!! CoreML does not support dynamic scaling for Resize")
    
    mode = 'NN' if mode == 'nearest' else 'BILINEAR'
    scale = node.input_tensors[node.inputs[1]]
    
    builder.add_upsample(
        name=node.name,
        scaling_factor_h=scale[-2],
        scaling_factor_w=scale[-1],
        input_name=node.inputs[0],
        output_name=node.outputs[0],
        mode=mode
    )
def _convert_resize ( builder , node , graph , err ) : mode = node . attrs . get ( 'mode' , 'nearest' ) if node . inputs [ 1 ] not in node . input_tensors : return err . unsupported_op_configuration ( builder , node , graph , "Scaling factor unknown!! CoreML does not support dynamic scaling for Resize" ) mode = 'NN' if mode == 'nearest' else 'BILINEAR' scale = node . input_tensors [ node . inputs [ 1 ] ] builder . add_upsample ( name = node . name , scaling_factor_h = scale [ - 2 ] , scaling_factor_w = scale [ - 1 ] , input_name = node . inputs [ 0 ] , output_name = node . outputs [ 0 ] , mode = mode )