tf-coreml / tf-coreml

TensorFlow to CoreML Converter
Apache License 2.0
1.33k stars 168 forks source link

AssertionError: Concat axis case not handled. output shape = [5733, 8], axis = 0 #390

Open feifeiwei opened 4 years ago

feifeiwei commented 4 years ago

My model produce error AssertionError: Concat axis case not handled. my model contain concat layer

location_pred = tf.concat(location_pred, axis=0) 
cls_pred = tf.concat(cls_pred, axis=0)
1185/1190: Analysing op name: Reshape_2 ( type:  Reshape )
1186/1190: Analysing op name: concat ( type:  ConcatV2 )
Traceback (most recent call last):
  File "pb2coreml.py", line 22, in <module>
    minimum_ios_deployment_target='12')
  File "/Users/feifeiwei/anaconda3/envs/py36/lib/python3.6/site-packages/tfcoreml/_tf_coreml_converter.py", line 718, in convert
    custom_conversion_functions=custom_conversion_functions)
  File "/Users/feifeiwei/anaconda3/envs/py36/lib/python3.6/site-packages/tfcoreml/_tf_coreml_converter.py", line 411, in _convert_pb_to_mlmodel
    convert_ops_to_layers(context)
  File "/Users/feifeiwei/anaconda3/envs/py36/lib/python3.6/site-packages/tfcoreml/_ops_to_layers.py", line 186, in convert_ops_to_layers
    translator(op, context)
  File "/Users/feifeiwei/anaconda3/envs/py36/lib/python3.6/site-packages/tfcoreml/_layers.py", line 119, in concat
    ss_layers._add_concat(op, context)
  File "/Users/feifeiwei/anaconda3/envs/py36/lib/python3.6/site-packages/tfcoreml/_shape_sensitive_layers.py", line 138, in _add_concat
    assert False, ('Concat axis case not handled. output shape = {}, axis = {}'.format(str(output_shape), axis))
AssertionError: Concat axis case not handled. output shape = [5733, 8], axis = 0
1duo commented 4 years ago

Hi @feifeiwei, thanks for reporting the issue. Can you try out using minimum_ios_deployment_target='13' when call convert()? This allows to convert model using different path. If it still fails, do you mind share your original model so that we can repro on our side, thanks!