![](/img/trans.png)
[英]Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'state')
[英]Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')
我在我的代码中遇到以下错误:Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')。 当我尝试访问 object 的“后端”属性时发生此错误,但它返回为未定义。 我已经多次检查我的代码,但无法弄清楚为什么会这样。
这是错误:
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)
依赖项:
"@tensorflow/tfjs": "^4.1.0",
"@tensorflow/tfjs-converter": "^4.1.0",
"@tensorflow/tfjs-core": "^4.1.0",
"@tensorflow/tfjs-node": "^1.7.4",
如果有人遇到此错误或对如何修复它有任何建议,请告诉我。
@tensorflow/tfjs-node
是tjfs-core
、 tfjs-converter
等的捆绑包 package。
@tensorflow/tfjs
也是一个包 package,但用于浏览器。
所以你依赖于两个不同的包 - 其中可能只有一个。 然后你有主要版本不兼容:v4 vs v1。
最重要的是你有单独的包,比如tfjs-core
和tfjs-converter
。 真的,这没有工作的机会。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.