tfjs: "info.backend.decComplexRef is not a function" when using tfjs-models
System 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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (6 by maintainers)
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.