Strange error: Uncaught (in promise) TypeError: Cannot read property '0' of null

586 views
Skip to first unread message

Emmanuel Goldstein

unread,
Aug 16, 2018, 4:35:11 AM8/16/18
to TensorFlow.js Discussion
Hi,
I'm trying to run a FrozenModel on tfjs.
At first there's something wrong with input dimension. In fact, when I first created the model in python, I wrote:
self.scalarInput =  tf.placeholder(shape=[None,21168],dtype=tf.float32, name=myScope+"_scalarinput")
When I run the model on tfjs I get:
Error: The shape of dict['main_scalarinput'] provided in model.execute(dict) must be [], but was [21168]
Why does it require a scalar?

However, I tried to feed in a dummy scalar, and I got (in firefox):
TypeError: r is null tf-core.esm.js:17:200981

More details:
Promise { "rejected" }
<state>: "rejected"
<reason>: TypeError: r is null Stack trace: parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</MathBackendWebGL</e.prototype.getValuesFromTexture@http://localhost:1234/ml4.29d6f37a.js:27227:50 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</MathBackendWebGL</e.prototype.readSync@http://localhost:1234/ml4.29d6f37a.js:27213:76 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.readSync@http://localhost:1234/ml4.29d6f37a.js:25077:12 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Tensor</e.prototype.dataSync@http://localhost:1234/ml4.29d6f37a.js:24679:36 runProgram/<@http://localhost:1234/ml4.29d6f37a.js:26388:52 runProgram@http://localhost:1234/ml4.29d6f37a.js:26384:90 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</MathBackendWebGL</e.prototype.compileAndRun@http://localhost:1234/ml4.29d6f37a.js:27593:73 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</MathBackendWebGL</e.prototype.concat@http://localhost:1234/ml4.29d6f37a.js:27283:56 concat2Tensors/<@http://localhost:1234/ml4.29d6f37a.js:32996:12 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.runKernel/<@http://localhost:1234/ml4.29d6f37a.js:25000:12 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.scopedRun@http://localhost:1234/ml4.29d6f37a.js:24982:15 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.runKernel@http://localhost:1234/ml4.29d6f37a.js:24993:39 concat2Tensors@http://localhost:1234/ml4.29d6f37a.js:32995:26 concat_@http://localhost:1234/ml4.29d6f37a.js:32986:110 o@http://localhost:1234/ml4.29d6f37a.js:31630:15 stack_@http://localhost:1234/ml4.29d6f37a.js:33371:13 o@http://localhost:1234/ml4.29d6f37a.js:31630:15 executeOp$13/<@http://localhost:1234/ml4.29d6f37a.js:41764:21 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.tidy/<@http://localhost:1234/ml4.29d6f37a.js:24978:19 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.scopedRun@http://localhost:1234/ml4.29d6f37a.js:24982:15 parcelRequire<["node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Engine</e.prototype.tidy@http://localhost:1234/ml4.29d6f37a.js:24973:13 parcelRequire<["node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js"]</Environment</e.tidy@http://localhost:1234/ml4.29d6f37a.js:31422:38 executeOp$13@http://localhost:1234/ml4.29d6f37a.js:41757:15 executeOp$15@http://localhost:1234/ml4.29d6f37a.js:41800:14 parcelRequire<["node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js"]</GraphExecutor</e.prototype.executeWithControlFlow/</<@http://localhost:1234/ml4.29d6f37a.js:41916:208 i/</<@http://localhost:1234/ml4.29d6f37a.js:40499:64 i/<@http://localhost:1234/ml4.29d6f37a.js:40484:14 s@http://localhost:1234/ml4.29d6f37a.js:40457:11
 
When using Chrome, I get:
Uncaught (in promise) TypeError: Cannot read property '0' of null
    at e.getValuesFromTexture (tf-core.esm.js:17)
    at e.readSync (tf-core.esm.js:17)
    at e.readSync (tf-core.esm.js:17)
    at e.dataSync (tf-core.esm.js:17)
    at tf-core.esm.js:17
    at Array.forEach (<anonymous>)
    at runProgram (tf-core.esm.js:17)
    at e.compileAndRun (tf-core.esm.js:17)
    at e.concat (tf-core.esm.js:17)
    at ENV.engine.runKernel.a (tf-core.esm.js:17)

I believe that the two problems are related.. So what could I do?
Thanks a lot for your help

Daniel Smilkov

unread,
Aug 17, 2018, 11:51:19 AM8/17/18
to webb...@gmail.com, Ping Yu, TensorFlow.js Discussion
+Ping Yu Any ideas what might be happening? Thank you!

Daniel


--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/6ac0c9da-a9be-4aab-9a10-2e699daebd2c%40tensorflow.org.

Ping Yu

unread,
Aug 22, 2018, 4:57:33 PM8/22/18
to Daniel Smilkov, webb...@gmail.com, TensorFlow.js Discussion
Thank you Daniel, I have been working on this issue in https://github.com/tensorflow/tfjs/issues/615.

I have identified the causes and submitted a fix PR with the converter, will  push out a new release soon.

Ping
Reply all
Reply to author
Forward
0 new messages