"info.backend.decComplexRef is not a function" when using tfjs-models
See original GitHub issueSystem information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): YES
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04.2 LTS
- TensorFlow.js installed from (npm or script link): @tensorflow/tfjs-node-gpu
- TensorFlow.js version (use command below): 3.6.1
- Browser version: N/A (Nodejs 14)
- Tensorflow.js Converter Version: ???
Describe the current behavior
(node:2070191) UnhandledPromiseRejectionWarning: TypeError: info.backend.decComplexRef is not a function
Describe the expected behavior No errors
Standalone code to reproduce the issue
Minimal repro program (test.ts
):
import * as use from '@tensorflow-models/universal-sentence-encoder';
import * as tf from '@tensorflow/tfjs-node-gpu';
async function main() {
// Dropping this line makes the error go away, although the error is in .add below.
const sentenceModel = await use.load();
const model = tf.sequential();
model.add(tf.layers.dense({
units: 16,
activation: 'sigmoid',
inputShape: [3],
}));
}
main();
package.json is generated by running these commands:
npm init
npm install --save-dev @tensorflow-models/universal-sentence-encoder @tensorflow/tfjs-node-gpu ts-node typescript
I run the main script like so:
node_modules/.bin/ts-node test.ts
Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
(node:2070982) UnhandledPromiseRejectionWarning: TypeError: info.backend.decComplexRef is not a function
at Engine.disposeTensor (/tmp/kk/node_modules/@tensorflow/tfjs-core/src/engine.ts:874:20)
at Tensor.dispose (/tmp/kk/node_modules/@tensorflow/tfjs-core/src/tensor.ts:388:17)
at Dense.Layer.addWeight (/tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/engine/topology.ts:1298:15)
at Dense.build (/tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/layers/core.ts:244:26)
at /tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/engine/topology.ts:993:14
at nameScope (/tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/common.ts:48:20)
at Dense.Layer.apply (/tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/engine/topology.ts:979:12)
at Sequential.add (/tmp/kk/node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-layers/src/models.ts:478:15)
at /tmp/kk/test.ts:8:9
at step (/tmp/kk/test.ts:33:23)
Note: If I drop the line initializing the universal sentence encoder, the error disappears.
Issue Analytics
- State:
- Created 2 years ago
- Comments:18
Top Results From Across the Web
info.backend.decComplexRef is not a function · Issue #4609 ...
Try to run wasm backend on bidirectional GRU. Wasm won't create the model. import * as tf from '@tensorflow/tfjs ...
Read more >Platform and environment | TensorFlow.js
Here are a few useful things to know when using this backend: \ ... Tensor s that are not returned by a function...
Read more >Model.predict() not a function - Google Groups
I am trying to do image segementation of cell images to identify cells in tensor flow using data provided in ...
Read more >i.detect is not a function when tried to use cocoSSD model in ...
I am trying to use the coco SSD model to detect the object in a given image. I have imported the required libraries...
Read more >@tensorflow/tfjs - npm
Use flexible and intuitive APIs to build models from scratch using the low-level JavaScript linear algebra library or the high-level layers API.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I could also reproduce this bug when using node v14, npm v7.14 and the following deps in package.json:
It wasn’t reproducible with npm v6.
I can confirm this resolved the issue. Thanks everyone!