Closed Lutra-Fs closed 9 months ago
add proper handling for DT.COMPLEX64 in https://github.com/tensorflow/tfjs/blob/master/tfjs-converter/src/operations/operation_mapper.ts?rgh-link-date=2023-11-23T20%3A35%3A02Z#L482 fix the issue. I am interested in submitting a PR but have no idea which test needs to be written to test this case.
Hi, @Lutra-Fs
Thank you for bringing this issue to our attention and I was trying to replicate the same issue from my end and I'm also getting the same error message which you mentioned above in issue template, It seems like we haven't complex64
as dtype
if I'm not wrong for reference I have added error log below
If you want to submit PR to take care of this issue please feel free to do it and please refer this file which may help you to write test cases for this issue, once you submit PR our team may help or guide you to write test cases if possible. Thank you.
(base) gaikwadrahul-macbookpro:tfjs-node-3.10 gaikwadrahul$ node index.js
testing keras model...
[ 1, 10 ]
/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:12836
throw new Error("Failed to cast to unknown dtype ".concat(dtype));
^
Error: Failed to cast to unknown dtype null
at cast_ (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:12836:15)
at Object.cast__op [as cast] (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:12217:29)
at executeOp$1 (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:30075:25)
at /Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:30188:50
at /Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4562:22
at Engine.scopedRun (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4572:23)
at Engine.tidy (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4561:21)
at tidy (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:8307:19)
at /Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:30188:24
at executeOp (/Users/gaikwadrahul/Desktop/tfjs-node-testing-to-update-doc/tfjs-node-3.10/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:30204:7)
Node.js v18.17.0
(base) gaikwadrahul-macbookpro:tfjs-node-3.10 gaikwadrahul$
PR opened
Hi, @Lutra-Fs
We really appreciate your submission of the PR addressing this issue. Our team will thoroughly review your PR and take the necessary actions accordingly. Thank you for your contribution
System information
Describe the current behavior currently if a model has
tf.cast(x, tf.complex64)
it could be exported correctly but the browser/nodejs throws an error withSee also https://github.com/kymatio/kymatio/issues/980. That issue's author meets the same issue.
Describe the expected behavior model runs without error
Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.
I am trying to build one with the minimal info. Our Python code is in https://github.com/techlauncher-mlai-edge-physics/neural_net_physics_tf. I will update this field after I create the link. the tfjs model if helps: FNO2dLite_from_saved_model.zip a minimal tfjs
model.json
build with only a cast call. accepts [-1,10] shape. tfjs_test_model.zipOther info / logs I am aware of https://github.com/tensorflow/tfjs/blob/master/tfjs-converter/src/operations/operation_mapper.ts#L482 and it seems like the DT_COMPLEX64 is not handled in that function, so a null will always return.