(builder, node, graph, err)
Perform cast operation in CoreML
        e.g. Casting from Float (assumed) to Int maps to Floor Layer
             For Others, add copy layer
Perform cast operation in CoreML
        e.g. Casting from Float (assumed) to Int maps to Floor Layer
             For Others, add copy layer
Perform cast operation in CoreML e . g . Casting from Float ( assumed ) to Int maps to Floor Layer For Others add copy layer
def _convert_cast(builder, node, graph, err):
    '''
    Perform cast operation in CoreML
        e.g. Casting from Float (assumed) to Int maps to Floor Layer
             For Others, add copy layer
    '''
    convert_to = node.attrs.get('to')
    convert_to_int = set({TensorProto.UINT8, TensorProto.INT8, TensorProto.UINT16, TensorProto.INT32,
                          TensorProto.INT64, TensorProto.UINT32, TensorProto.UINT64})

    ## TODO: Add support for conversion from STRING TO FLOAT
    ## Currently, such input will error out in parsing
    if convert_to in convert_to_int:
        builder.add_floor(
            name=node.name,
            input_name=node.inputs[0],
            output_name=node.outputs[0]
        )
    else:
        load_input_constants(builder, node, graph, err)
        builder.add_activation(
            name=node.name,
            non_linearity = 'LINEAR',
            input_name=node.inputs[0],
            output_name=node.outputs[0],
            params=[1.0, 0.0]
        )
def _convert_cast ( builder , node , graph , err ) : convert_to = node . attrs . get ( 'to' ) convert_to_int = set ( { TensorProto . UINT8 , TensorProto . INT8 , TensorProto . UINT16 , TensorProto . INT32 , TensorProto . INT64 , TensorProto . UINT32 , TensorProto . UINT64 } ) ## TODO: Add support for conversion from STRING TO FLOAT ## Currently, such input will error out in parsing if convert_to in convert_to_int : builder . add_floor ( name = node . name , input_name = node . inputs [ 0 ] , output_name = node . outputs [ 0 ] ) else : load_input_constants ( builder , node , graph , err ) builder . add_activation ( name = node . name , non_linearity = 'LINEAR' , input_name = node . inputs [ 0 ] , output_name = node . outputs [ 0 ] , params = [ 1.0 , 0.0 ] )