tfjs
tfjs copied to clipboard
[tjfs-backend-wasm] Missing Kernel op Atan2
System information
- Have I written custom code : NO
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS 12.1
- TensorFlow.js installed from (npm or script link): 3.15.0
- TensorFlow.js version (use command below): 3.15.0
- Browser version: Chrome 100.0.4896.60
Describe the current behavior
atan2 op is not support in wasm mode
Describe the expected behavior
work
Standalone code to reproduce the issue
tf.getBackend()
const a = tf.tensor1d([1.0, 1.0, -1.0, .7]);
const b = tf.tensor1d([2.0, 13.0, 3.5, .21]);
tf.atan2(a, b).print()
Other info / logs
[Vue warn]: Error in event handler for "shapeMappingChanged": "Error: Kernel 'Atan2' not registered for backend 'wasm'"
Error: Kernel 'Atan2' not registered for backend 'wasm'
at Engine.runKernel (engine.js:400:1)
at atan2_ (atan2.js:43:18)
at Module.atan2__op (operation.js:44:1)
at ImageMapping.js:244:71
at MappingAdapter.fisheyeAlgorithm (ImageMapping.js:258:20)
at MappingAdapter.fisheyeAtant2DistortionCorrectAlgorithm (ImageMapping.js:244:30)
at ImageMapping.js:389:43
at engine.js:328:1
at Engine.scopedRun (engine.js:338:1)
at Engine.tidy (engine.js:327:1)
at Module.tidy (globals.js:175:18)
at MappingAdapter.getMappingResult (ImageMapping.js:362:19)
at projectCoordinateToCameraImage (ImageMapping.js:442:27)
at ImageMapping.js:429:62
at Array.map (<anonymous>)
at getCubeProjectionPointList (ImageMapping.js:429:41)
at MainScene.vue:856:1
at Array.forEach (<anonymous>)
at VueComponent.projectMappingImage (MainScene.vue:839:1)
at VueComponent.handleShapeMappingChanged (MainScene.vue:616:1)
at invokeWithErrorHandling (vue.runtime.esm.js:1854:1)
at Vue.$emit (vue.runtime.esm.js:3888:1)
at MainScene.vue:1341:1
at Array.forEach (<anonymous>)
at MainScene.vue:1340:1
Kernal 'Atan2' is not yet implemented in wasm background, this will be feature request .Do you wish to contribute ?
cc @pyu10055 @ahmedsabie
Atan as well
Missing kernel op Atan2
causes newer variation of FaceMesh-with-Attention model to fail when executing in using WASM backend
Official implementation for a model was added via issue https://github.com/tensorflow/tfjs/issues/6002 and PR https://github.com/tensorflow/tfjs-models/pull/1002 Reference model is https://tfhub.dev/mediapipe/tfjs-model/face_landmarks_detection/attention_mesh/1
Same model executes without issues in browser environments using WebGL backend
Environment: TFJS 3.18.0 on Chrome 101 (Windows 11)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
Why is this marked as awaiting response & stalled? It's an open feature request.
Hi, @naah69
Apologize for the delayed response and I tried to replicate the same issue with latest version of @tensorflow/[email protected]
and @tensorflow/[email protected]
and I haven't got any error so it seems like this issue has resolved with latest version if I'm not wrong and we have updated official documentation for tf.atan, tf.atan2 and for your reference I have added screenshot below so could you please try it from your end and let us know whether your issue got resolved or not ? If have I missed something here please let me know ? Thank you!
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"> </script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf-backend-wasm.js"> </script>
</head>
<body>
<script>
async function main() {
await tf.setBackend('wasm');
const a = tf.tensor1d([1.0, 1.0, -1.0, .7]);
const b = tf.tensor1d([2.0, 13.0, 3.5, .21]);
tf.atan2(a, b).print()
}
main();
console.log("import done successfully!!!")
console.log(tf.getBackend());
</script>
</body>
</html>
Here is output of above code-snippet :
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.
Resolved by #7350