Non-channel and non-sequence concatenation
This issue appears to be resolved (according to the below issue), but has been re-introduced???
See: https://github.com/apple/coremltools/issues/328 for more info
In the Keras converter for coremltools, in _layers2.py, a ValueError is thrown if a Concatenate layer is operating on an axis other than the channels or sequence axis (~line 102 in Coremltools 3):
elif len(keras_layer.input_shape[0]) == 4 and (keras_layer.axis == 3 or keras_layer.axis == -1):
return 'CONCAT'
elif len(keras_layer.input_shape[0]) == 2 and (keras_layer.axis == 1 or keras_layer.axis == -1):
return 'CONCAT'
else:
raise ValueError('Only channel and sequence concatenation are supported.')
By lifting this constraint, model builders will have the freedom to concatenate the output of 2 layers along any axis.
It's unclear why this constraint is there in the first place. If the above feature request is not achievable, can we get at least an explanation as to why this constraint is present?
@srikris A little off topic but in regards to my other open issue: (https://github.com/apple/coremltools/issues/631):
Has anybody been assigned to fix the issue yet? This seems like a pretty critical bug that would affect a lot of users and a lot of different model architectures.
It seems that the solution is to just comment that line out and return 'CONCAT' instead, as conversion still succeeds. (Or add an if statement checking the spec version)
Multi-backend Keras support has been removed in coremltools 6.0.