Hello, when I run the very simple example (read handwritten digit) presented here, I get the error
AssertionException: TensorShape.ValueError: operands could not be broadcast together with shapes (1, 8, 32, 32), (8) (full output below). Do you have any suggestions on how to fix this?
I have the same issue with both Sentis 1.0.0 and 1.1.0.
AssertionException: TensorShape.ValueError: operands could not be broadcast together with shapes (1, 8, 32, 32), (8)
Assertion failure. Value was False
UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) (at /Users/bokken/build/output/unity/unity/Runtime/Export/Assertions/Assert/AssertBase.cs:29)
UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) (at /Users/bokken/build/output/unity/unity/Runtime/Export/Assertions/Assert/AssertBool.cs:20)
Unity.Sentis.Logger.AssertIsTrue (System.Boolean condition, System.String msg, System.Object msgParam0, System.Object msgParam1) (at Library/PackageCacheemail@example.com/Runtime/Core/Logger.cs:65)
Unity.Sentis.TensorShape.Broadcast (Unity.Sentis.TensorShape other) (at Library/PackageCachefirstname.lastname@example.org/Runtime/Core/TensorShape.cs:754)
Unity.Sentis.TensorShapeHelper.BroadcastShape (Unity.Sentis.Tensor a, Unity.Sentis.Tensor b) (at Library/PackageCacheemail@example.com/Runtime/Core/ShapeInference/TensorShapeInferenceHelper.cs:35)
Unity.Sentis.GPUComputeOps.Add (Unity.Sentis.TensorFloat A, Unity.Sentis.TensorFloat B) (at Library/PackageCachefirstname.lastname@example.org/Runtime/Core/Backends/GPUCompute/Compute.Ops.gen.cs:48)
Unity.Sentis.Layers.Add.Execute (Unity.Sentis.Tensor inputTensors, Unity.Sentis.ExecutionContext ctx) (at Library/PackageCacheemail@example.com/Runtime/Core/Layers/Layer.Math.cs:59)
Unity.Sentis.GenericWorker+<StartManualSchedule>d__33.MoveNext () (at Library/PackageCachefirstname.lastname@example.org/Runtime/Core/Backends/GenericWorker.cs:234)
Unity.Sentis.GenericWorker.Execute () (at Library/PackageCacheemail@example.com/Runtime/Core/Backends/GenericWorker.cs:167)
Unity.Sentis.GenericWorker.Execute (Unity.Sentis.Tensor input) (at Library/PackageCachefirstname.lastname@example.org/Runtime/Core/Backends/GenericWorker.cs:159)
ClassifyHandwrittenDigit.Start () (at Assets/ClassifyHandwrittenDigit.cs:25)
Thanks for reporting the issue.
The information that you provided was not enough to reproduce the issue. Could you please provide me with more details by doing the following:
- Upload an example project by using SendSafely: Unity
- Define the exact steps needed to reproduce the said problem (preferably using your attached project)
I’ll be waiting for your response.
Customer QA Team
The error message does not seem to be quite the same I had when first trying the MNIST sample, but the values 32,32 in your error message indicate it might be related to the same issue I had at first, so check the following things…
There were a couple of things that weren’t explicitly stated in the MNIST example that you’ll have to do or you’ll get errors:
- The MNIST example model assumes 28x28 textures, so the digit texture should be imported as non-power of 2 texture. By default, when you add it, you get it converted to a power of two texture, so it will be 32x32, and that won’t match the model. Go to the texture import settings and change it to NPOT to fix (Advanced > Non-Power of 2 to None).
- The model also assumes grascaly colors, so only a single color channel. So, go change the texture to R 8 format from the default RGB format.
After those steps you should get a 28x28 single channel image to the model, and there should not be errors due to the wrong size.
After that, you’ll might still get an error about the output tensor not being readable (at least I got one), so just bluntly add outputTensor.MakeReadable(); to the script to get past that.
After those 3 steps the sample seemed to work as expected for me.
Thank you very much for your feedback!
We’ve added a task to add a note to the documentation that the model expects greyscale colors. It’s internally known as issue 92.
If there are still errors after completing the above steps that @jpkokkon wrote. You can refer to the steps in this link which will guide you to submit a bug report.
Customer QA Team
I followed this and still had issues.
I discovered not all of the MNIST ONNX versions are compatible:
- MNIST | ONNX version 1.0 (Didn’t work)
- MNIST | ONNX version 1.2 (Worked)
- MNIST | ONNX version 1.3 (Worked)
- MNIST-12 | ONNX version 1.9 (Worked)
- MNIST-12-int8 | ONNX version 1.9 (Didn’t work)
Thank you for your feedback. We have added a note to the task to mention which exact model to use.