question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Based on the provided shape, [256,108], and dtype float32, the tensor should have 27648 values but has 434

See original GitHub issue

TensorFlow.js version

0.13.0

Browser version

Version 69.0.3497.100 - 64 bit

Describe the problem or feature request

I have trained the translation LSTM example here with default values and the parallel corpus provided by Anki (fr-en). I get this error


Error: Based on the provided shape, [256,108], and dtype float32, the tensor should have 27648 values but has 434
    at assert (tf-core.esm.js:17)
    at new e (tf-core.esm.js:17)
    at Function.e.make (tf-core.esm.js:17)
    at tensor (tf-core.esm.js:17)
    at o (tf-core.esm.js:17)
    at Object.decodeWeights (tf-core.esm.js:17)
    at tf-layers.esm.js:17
    at tf-layers.esm.js:17
    at Object.next (tf-layers.esm.js:17)
    at o (tf-layers.esm.js:17)
loadHostedPretrainedModel @ loader.js:50
async function (async)
loadHostedPretrainedModel @ loader.js:42
init @ index.js:41
button.addEventListener @ index.js:206
14:57:42.394 ui.js:19 Loading pretrained model failed.

when loading the model in the tensorflow-js example here

Code to reproduce the bug / link to feature request

I have put model.json here the metadata.json here and you can download the model shard from here

group1-shard1of1.zip

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
AxelWolfcommented, Apr 27, 2019

We can reproduce this error msg in a browser (Chrome) environment:

“Uncaught (in promise) Error: Based on the provided shape, [1280], the tensor should have 1280 values but has 1279”

In our setup, the error occurs up after making small changes to a model (adding a class to the final classification layer), retraining and exporting. When loading the page that imports the model, it seems that the browser delivers the cached shards from the older model but the updated model.json. Solution is to clear the browser cache and reload the page.

3reactions
nebrelbugcommented, Jan 18, 2019

I ran into this issue when using the serve NPM/Yarn package. It seems to not work well with TensorflowJS. When I used Firebase Serve, it worked great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

uncaught error error: based on the provided shape ... - You.com
Error : Based on the provided shape, [12544,100], and dtype float32, the tensor should have 1254400 values but has 0. Asked Jan 24,...
Read more >
Uncaught Error: Based on the provided shape, [1024,3], the ...
js app, it works all good locally, but when I hosted it (I tried Netlify and Vercel on both Firefox and Chrome) I...
Read more >
Error: The shape of dict['input_tensor'] provided in model ...
Hi, I converted my saved model to model json using tensorflowjs_converter tensorflowjs_converter \ --input_format=tf_saved_model ...
Read more >
PyTorch on XLA Devices
If an XLA tensor on a TPU is moved back to the CPU it will be converted from its actual datatype to its...
Read more >
Issue creating custom action mask enviorment - RLlib - Ray
Tensor 'default_policy/Reshape_2:0' shape=(?, 9) dtype=float32>, <tf. ... And what we would apply the action mask logic is right before the return ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found