Error: TensorList shape mismatch: Shapes -1 and 3 must match – CONTINUE

I’ve been working for a week. This error appears to be from open source applications that were not in previous versions. I even tried from old models. They are working. But the one I just created doesn’t work.

This error continues. How do we fix this?

tfjs-core: ^3.0.0
tfjs-converter: ^3.0.0
TF 2.4.1
Python 3.6.9

Originally posted by @umitkacar in #4641 (comment)

12 thoughts on “Error: TensorList shape mismatch: Shapes -1 and 3 must match – CONTINUE

  1. I am getting the same:

    Uncaught (in promise) Error: TensorList shape mismatch:  Shapes -1 and 3 must match
        at Module.assert (:3000/static/js/0.chunk.js:102327)
        at assertShapesMatchAllowUndefinedSize (:3000/static/js/0.chunk.js:40206)
        at TensorList.setItem (:3000/static/js/0.chunk.js:39991)
        at _callee2$ (:3000/static/js/0.chunk.js:41111)
        at tryCatch (:3000/static/js/0.chunk.js:141550)
        at Generator.invoke [as _invoke] (:3000/static/js/0.chunk.js:141769)
        at Generator.prototype.<computed> [as next] (:3000/static/js/0.chunk.js:141603)
        at asyncGeneratorStep (:3000/static/js/0.chunk.js:140798)
        at _next (:3000/static/js/0.chunk.js:140820)
        at :3000/static/js/0.chunk.js:140827
        at new Promise (<anonymous>)
        at Module.<anonymous> (:3000/static/js/0.chunk.js:140816)
        at Module.executeOp (:3000/static/js/0.chunk.js:41213)
        at :3000/static/js/0.chunk.js:47719
        at executeOp (:3000/static/js/0.chunk.js:47799)
        at _loop (:3000/static/js/0.chunk.js:38002)
        at GraphExecutor.processStack (:3000/static/js/0.chunk.js:38038)
        at GraphExecutor._callee4$ (:3000/static/js/0.chunk.js:37928)
        at tryCatch (:3000/static/js/0.chunk.js:141550)
        at Generator.invoke [as _invoke] (:3000/static/js/0.chunk.js:141769)
        at Generator.prototype.<computed> [as next] (:3000/static/js/0.chunk.js:141603)
        at asyncGeneratorStep (:3000/static/js/0.chunk.js:140798)
        at _next (:3000/static/js/0.chunk.js:140820)
    
  2. The current package on NPM doesn’t included this change yet. If you are using NPM or the <script> tag to pull in the package it won’t have the change yet. I am not sure how to build and run the packages directly from Github, but if you figure that out, you should be able to try out the fix that has been merged in.

    https://www.npmjs.com/package/@tensorflow/tfjs is still on ver 3.0.0

  3. The models we just created do not work. I think a new update generated such an error while creating the model.

  4. However, older models are working. This is really interesting. Where are we doing wrong?

    Any chance you can post a link to an SSD MobileNet V2 FPNLite 320×320 model that is working?

  5. Please give me sometime. I’ll try this example and get back to you. Everyone is in trouble with this new version. Actually I’m thinking of a video conference to discuss.

  6. I pulled in some of Hugo’s code. I think the only major difference is that he was looking at different Output Tensor Arrays:
    I found the Classes, Scores and Boxes in these arrays:
    https://github.com/luke-iqt/SkyScan-Web-App/blob/main/src/App.js#L110
    I think he was using 4,5,6 in the output array.

    My model only had one class. You may need to adjust things. Probably best to put a Breakpoint and examine the output from the inference in the Chrome Web Developer panel. Your model could be outputing things differently.

  7. I trained Kangaroo dataset again. I used this code below to convert javascript. This model is running my demo code not React. As a results, the model is OK. I think that React is problem. I didn’t use React before.

    tensorflowjs_converter \
        --input_format=tf_saved_model \
        --output_format=tfjs_graph_model \
        --signature_name=serving_default \
        --saved_model_tags=serve \
        saved_model \
        web_model