Is it possible to use Machine Learning and Deep Learning frameworks through OCaml?

I was wondering if this was possible at all?

The reason I am asking is because there has been some attempts at doing this but from Python to OCaml like languages. Outlined here:

Yes it is totally possible, see these resources:

If you are interested in improving the OCaml capabilites in this area, I think joining Owl development is the way to go, you can see their repositories here:
They have some ideas on possible improvements of the library at Proposed Projects page. I personally think, that saving and loading ONNX format is the most important improvement, to be able to load networks created in third-party tools, see the IR specification itself.

See the example on how to code the simple object-detection convolutional neural network (Mask R-CNN) at


There’s also a couple of followup posts to that first one:


Update: It seems that Owl project started to implement ONNX integration. Wish them luck, and more pull requests!

1 Like

An update about MLIR from Google - it was merged in the LLVM mainstream and now officially a part of the project - see

It should be released together with LLVM 10 and you can expect wider adoption after that move.

related: [ANN] PyTorch bindings

1 Like