onnx-coreml icon indicating copy to clipboard operation
onnx-coreml copied to clipboard

dilated convolution does not support weight as input tensor after convert to CoreML

Open edis219 opened this issue 4 years ago • 2 comments

The Conv layer info is as below: <onnx_coreml._graph.Node object at 0x10d1ec978> attrs:{'dilations': [2, 2], 'group': 1, 'kernel_shape': [3, 3], 'pads': [0, 0, 0, 0], 'strides': [1, 1]} children:[<onnx_coreml._graph....10d1ecc18>] input_tensors:{} inputs:['189', '214_transposed'] metadata:{} name:'215' op_type:'Conv' outputs:['215'] parents:[<onnx_coreml._graph....12f766978>, <onnx_coreml._graph....10d1ec780>]

I check the CoreML tools code, the error is caused by: if (layer.input_size() != 1 && ( ((params.dilationfactor_size() > 0 && params.dilationfactor(0) > 1) || (params.dilationfactor_size() > 1 && params.dilationfactor(1) > 1)) )) { std::string err = "Convolution layer: '" + layer.name() + "' , dilated convolution does not support weight as input tensor."; return Result(ResultType::INVALID_MODEL_PARAMETERS, err); }

Is there any work around for this? Or an issue?

edis219 avatar Sep 03 '19 07:09 edis219

@edis219 can you pass weight as a constant?

bhushan23 avatar Sep 05 '19 23:09 bhushan23

@bhushan23, sure, I pass the weights as a constant into the dilated conv layer. Then this issue solved. Will the CoreML support to pass the weights as an input?

@edis219 can you pass weight as a constant?

edis219 avatar Sep 06 '19 05:09 edis219