(builder, # type : NeuralNetworkBuilder
                             inputs, # type: List[EdgeInfo]
                             outputs # type: List[EdgeInfo]
                             )
Make sure ONNX input/output data types are mapped to the equivalent CoreML types
Make sure ONNX input/output data types are mapped to the equivalent CoreML types
Make sure ONNX input / output data types are mapped to the equivalent CoreML types
def _transform_coreml_dtypes(builder, # type : NeuralNetworkBuilder
                             inputs, # type: List[EdgeInfo]
                             outputs # type: List[EdgeInfo]
                             ):
    # type: (...) -> None

    ''' Make sure ONNX input/output data types are mapped to the equivalent CoreML types
    '''
    for i, input_ in enumerate(inputs):
        onnx_type = input_[1]
        if onnx_type == TensorProto.FLOAT:
            _update_multiarray_to_float32(builder.spec.description.input[i])
        elif onnx_type == TensorProto.DOUBLE:
            continue
        elif onnx_type == TensorProto.INT32 or onnx_type == TensorProto.INT64:
            _update_multiarray_to_int32(builder.spec.description.input[i])
        elif onnx_type == TensorProto.BOOL:
            _update_multiarray_to_float32(builder.spec.description.input[i])
        else:
            raise TypeError("Input must be of of type FLOAT, DOUBLE, INT32 or INT64")

    for i, output_ in enumerate(outputs):
        onnx_type = output_[1]
        if onnx_type == TensorProto.FLOAT:
            _update_multiarray_to_float32(builder.spec.description.output[i])
        elif onnx_type == TensorProto.DOUBLE:
            continue
        elif onnx_type == TensorProto.INT32 or onnx_type == TensorProto.INT64:
            _update_multiarray_to_int32(builder.spec.description.output[i])
        elif onnx_type == TensorProto.BOOL:
            _update_multiarray_to_float32(builder.spec.description.output[i])
        else:
            raise TypeError("Output must be of of type FLOAT, DOUBLE, INT32 or INT64")
def _transform_coreml_dtypes ( builder , # type : NeuralNetworkBuilder inputs , # type: List[EdgeInfo] outputs # type: List[EdgeInfo] ) : # type: (...) -> None for i , input_ in enumerate ( inputs ) : onnx_type = input_ [ 1 ] if onnx_type == TensorProto . FLOAT : _update_multiarray_to_float32 ( builder . spec . description . input [ i ] ) elif onnx_type == TensorProto . DOUBLE : continue elif onnx_type == TensorProto . INT32 or onnx_type == TensorProto . INT64 : _update_multiarray_to_int32 ( builder . spec . description . input [ i ] ) elif onnx_type == TensorProto . BOOL : _update_multiarray_to_float32 ( builder . spec . description . input [ i ] ) else : raise TypeError ( "Input must be of of type FLOAT, DOUBLE, INT32 or INT64" ) for i , output_ in enumerate ( outputs ) : onnx_type = output_ [ 1 ] if onnx_type == TensorProto . FLOAT : _update_multiarray_to_float32 ( builder . spec . description . output [ i ] ) elif onnx_type == TensorProto . DOUBLE : continue elif onnx_type == TensorProto . INT32 or onnx_type == TensorProto . INT64 : _update_multiarray_to_int32 ( builder . spec . description . output [ i ] ) elif onnx_type == TensorProto . BOOL : _update_multiarray_to_float32 ( builder . spec . description . output [ i ] ) else : raise TypeError ( "Output must be of of type FLOAT, DOUBLE, INT32 or INT64" )