简体   繁体   中英

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')

I am experiencing the following error in my code: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend'). This error is occurring when I am trying to access the 'backend' property of an object, but it is returning as undefined. I have checked my code multiple times and cannot figure out why this is happening.

Here is the error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')
    at Engine.moveData (engine.ts:426:1)
    at DataStorage.get (backend.ts:55:1)
    at MathBackendCPU.incRef (backend_cpu.ts:106:1)
    at Object.reshape [as kernelFunc] (Reshape.ts:40:1)
    at kernelFunc (engine.ts:646:1)
    at engine.ts:712:1
    at Engine.scopedRun (engine.ts:480:1)
    at Engine.runKernelFunc (engine.ts:708:1)
    at Engine.runKernel (engine.ts:553:1)
    at reshape_ (reshape.ts:60:1)

Dependencies:

 "@tensorflow/tfjs": "^4.1.0",
 "@tensorflow/tfjs-converter": "^4.1.0",
 "@tensorflow/tfjs-core": "^4.1.0",
 "@tensorflow/tfjs-node": "^1.7.4",

If anyone has experienced this error or has any suggestions on how to fix it, please let me know.

@tensorflow/tfjs-node is a bundle package of tjfs-core , tfjs-converter and others.
@tensorflow/tfjs is also a bundle package, but for browsers.

so you have dependency on TWO different bundles - of which there could be only one. and then you have MAJOR version incompatibility: v4 vs v1.

and on top of that you have individual packages like tfjs-core and tfjs-converter . really, this has no chance of working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM