(builder, node, graph, err)
convert to CoreML Fill Static Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3641
convert to CoreML Fill Static Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3641
convert to CoreML Fill Static Layer : https : // github . com / apple / coremltools / blob / 655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492 / mlmodel / format / NeuralNetwork . proto#L3641
def _convert_constant_of_shape(builder, node, graph, err):
    '''
    convert to CoreML Fill Static Layer:
    https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3641
    '''
    value = node.attrs.get('value', [0.0])
    # if shape is known, create tensor of given shape
    # otherwise create tensor at runtime
    if node.inputs[0] in node.input_tensors:
        output_shape = node.input_tensors[node.inputs[0]]
        # add_fill_static requires shape to be more than rank-1
        if len(output_shape.shape) == 1:
            output_shape = output_shape.reshape(output_shape.shape[0], 1)
        builder.add_fill_static(
            name=node.name,
            output_name=node.outputs[0],
            output_shape=output_shape,
            value=value[0]
        )
    else:
        builder.add_fill_dynamic(
            name=node.name,
            input_name=node.inputs[0],
            output_name=node.outputs[0],
            value=value[0]
        )
def _convert_constant_of_shape ( builder , node , graph , err ) : value = node . attrs . get ( 'value' , [ 0.0 ] ) # if shape is known, create tensor of given shape # otherwise create tensor at runtime if node . inputs [ 0 ] in node . input_tensors : output_shape = node . input_tensors [ node . inputs [ 0 ] ] # add_fill_static requires shape to be more than rank-1 if len ( output_shape . shape ) == 1 : output_shape = output_shape . reshape ( output_shape . shape [ 0 ] , 1 ) builder . add_fill_static ( name = node . name , output_name = node . outputs [ 0 ] , output_shape = output_shape , value = value [ 0 ] ) else : builder . add_fill_dynamic ( name = node . name , input_name = node . inputs [ 0 ] , output_name = node . outputs [ 0 ] , value = value [ 0 ] )