Can I write my own layer in CoreML?

Can I write my own layer in CoreML? If possible, how? The layer I want is similar to the select_index layer in pytorch (http://pytorch.org/docs/master/torch.html#torch.index_select).

Replies

You cannot. However, if that is the very last layer in the network, you can use Core ML up to that layer and then implement the layer in Swift.

What happens if there are many such layers in the middle of the network? I don't think this is hard to implement but wonder why there is no such simple layer in coreML 😟