TensorFlow.js Op support matrix - if you are having Python model conversion issues, check this first!

So I have seen a few forum posts around conversion of TF Python models to TensorFlow.js format and sometimes running into an issue where the Python model uses some unsupported op.

Well, I am pleased to share a nice easy to view spreadsheet that shows the current state of op support in TensorFlow.js across the many backends we support such as CPU, WASM, WebGL, Node, WebGPU (each is like its own version of TensorFlow) for which each op needs to be written in that backend for it to be supported on that backend. As such, not all backends are equal in op parity right now as there are a lot to implement!

If you find one that is not supported and are willing to contribute its implementation, please do!

Here is the spreadsheet (created by our wonderful SWE @Jing_Jin) which we aim to update over time:

TFJS Ops Matrix (last updated: 2021-8-26) - Google Sheets.

One other thing to note is that some ops are partially implemented. What this means is that some parts of the function definition work, but maybe extra non essential parameters are not. In this case if function definition is something of the form:

function (a, b, c, d, e) { 
   // code... 
}

But a given backend’s implementation of that op is partial eg:

function (a, b, c) { 
   // code... 
}

Then clearly here if you attempt to use parameters d and e, it may not behave as expected which can cause issue. Of course if you are not using these parameters then it will work as intended. Something to consider if you are finding odd issues with a converted model where all ops are “supported” you may find one of those ops is partial leading to the issue you see.

We hope to update the spreadsheet above in the future showing which are partial but this is a work in progress right now.

2 Likes

Thank you @Jason! This info really helpful :smiley:

1 Like

Happy to hear it! Happy hacking :slight_smile: