Unity-Technologies / barracuda-release

Other
567 stars 77 forks source link

AssertionException: Assertion failure. Values are not equal. #277

Closed SestoAle closed 2 years ago

SestoAle commented 2 years ago

Hi,

I have a problem on importing my custom Tensorflow model. I was able to convert it in .onnx format, but when I import it to Unity it says:

ual[T] (T expected, T actual, System.String message, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertGeneric.cs:31)
UnityEngine.Assertions.Assert.AreEqual[T] (T expected, T actual, System.String message) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertGeneric.cs:19)
UnityEngine.Assertions.Assert.AreEqual (System.Int32 expected, System.Int32 actual) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Assertions/Assert/AssertPrimitiveTypes.cs:176)
Unity.Barracuda.BurstCPUOps.CopyAndReshape (Unity.Barracuda.Tensor X, Unity.Barracuda.TensorShape shape) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/BarracudaBurstCPU.Ops.cs:1614)
Unity.Barracuda.BurstCPUOps.Reshape (Unity.Barracuda.Tensor X, Unity.Barracuda.TensorShape newShape) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/BarracudaBurstCPU.Ops.cs:1629)
Unity.Barracuda.ReferenceCPUOps.MatMul (Unity.Barracuda.Tensor X, System.Int32 rankX, Unity.Barracuda.Tensor Y, System.Int32 rankY) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/BarracudaReferenceCPU.cs:724)
Unity.Barracuda.BurstCPUOps.MatMul (Unity.Barracuda.Tensor X, System.Int32 rankX, Unity.Barracuda.Tensor Y, System.Int32 rankY) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/BarracudaBurstCPU.Ops.cs:158)
Unity.Barracuda.StatsOps.Unity.Barracuda.IOps.MatMul (Unity.Barracuda.Tensor X, System.Int32 rankX, Unity.Barracuda.Tensor Y, System.Int32 rankY) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/StatsOps.cs:92)
Unity.Barracuda.GenericWorker+<StartManualSchedule>d__36.MoveNext () (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/GenericWorker.cs:308)
Unity.Barracuda.GenericWorker.Execute () (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/GenericWorker.cs:187)
Unity.Barracuda.GenericWorker.Execute (System.Collections.Generic.IDictionary`2[TKey,TValue] inputs) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Backends/GenericWorker.cs:172)
Unity.Barracuda.Compiler.Passes.IRShapeInferenceAndConstantFusing.FuseShapesIntoConstants (Unity.Barracuda.Model& model, System.Collections.Generic.IDictionary`2[TKey,TValue] shapesByName, System.Collections.Generic.IDictionary`2[TKey,TValue] ranksByName, System.Collections.Generic.List`1[Unity.Barracuda.Model+ImporterWarning]& warnings) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Compiler/Passes/IRShapeInferenceAndConstantFusing.cs:141)
Unity.Barracuda.Compiler.Passes.IRShapeInferenceAndConstantFusing.Run (Unity.Barracuda.Model& model, System.Collections.Generic.List`1[T] warnings) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Compiler/Passes/IRShapeInferenceAndConstantFusing.cs:30)
Unity.Barracuda.Compiler.Passes.IntermediateToRunnableNHWCPass.Run (Unity.Barracuda.Model& model) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/Core/Compiler/Passes/IntermediateToRunnableNHWCPass.cs:15)
Unity.Barracuda.ONNX.ONNXModelConverter.Convert (Google.Protobuf.CodedInputStream inputStream) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:188)
Unity.Barracuda.ONNX.ONNXModelConverter.Convert (System.String filePath) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:98)
Unity.Barracuda.ONNXModelImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Editor/ONNXModelImporter.cs:65)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /Users/bokken/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22)

Here is my model: https://drive.google.com/file/d/1Sb9l0pdb6b4wJimKBZJ_h0VOb5mfDjzE/view?usp=sharing

I am on Unity 2021.3.0f1 and I am using Barracuda 3.0.0

SestoAle commented 2 years ago

I solved the problem, it was an error in the graph. Sorry.