Microsoft.ML and Xamarin Forms (Android)

Sergey 6 Reputation points
2021-12-09T23:21:23.737+00:00

Hello!

I'm trying to use Microsoft.ML on Xamarin Forms (Android) application. It compiles well and runs on x64 platform, but when I deploy it on a device (Arm64) and it tries to call Fit() of IEstimator<ITransformer> interface, it crashes with System.DllNotFoundException exception related to CpuMathNative.dll.

Does Microsoft.ML supports Xamarin (Android)?

Thank you!

The full exception is here:

System.InvalidOperationException: Splitter/consolidator worker encountered exception while consuming source data ---> System.DllNotFoundException: CpuMathNative assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Microsoft.ML.Internal.CpuMath.Thunk.SumSqU(single*,int)
at Microsoft.ML.Internal.CpuMath.CpuMathUtils.SumSq (System.Single mean, System.ReadOnlySpan1[T] src) [0x00029] in <e618816ffda34c5b8c31d9040ad4a686>:0 at Microsoft.ML.Transforms.LpNormNormalizingTransformer+Mapper.L2Norm (System.ReadOnlySpan1[T] values, System.Single mean) [0x0000f] in <48b51ac409f44123bf2f867570f5ae92>:0
at Microsoft.ML.Transforms.LpNormNormalizingTransformer+Mapper+<>c__DisplayClass8_0.<MakeGetter>b__5 (Microsoft.ML.Data.VBuffer1[System.Single]& dst) [0x0001c] in <48b51ac409f44123bf2f867570f5ae92>:0 at Microsoft.ML.Data.ColumnConcatenatingTransformer+Mapper+BoundColumn+<>c__DisplayClass20_01[T].<MakeGetter>b__0 (Microsoft.ML.Data.VBuffer1[T]& dst) [0x00028] in <7c44b50bf6104428bdde89c1398991a5>:0 at Microsoft.ML.Data.ColumnConcatenatingTransformer+Mapper+BoundColumn+<>c__DisplayClass20_01[T].<MakeGetter>b__0 (Microsoft.ML.Data.VBuffer1[T]& dst) [0x00028] in <7c44b50bf6104428bdde89c1398991a5>:0 at Microsoft.ML.Data.DataViewUtils+Splitter+InPipe+Impl1[T].Fill () [0x00031] in <7c44b50bf6104428bdde89c1398991a5>:0
at Microsoft.ML.Data.DataViewUtils+Splitter+<>c__DisplayClass7_1.<ConsolidateCore>b__2 () [0x00120] in <7c44b50bf6104428bdde89c1398991a5>:0
--- End of inner exception stack trace ---
at Microsoft.ML.Data.DataViewUtils+Splitter+Batch.SetAll (Microsoft.ML.Data.DataViewUtils+Splitter+OutPipe[] pipes) [0x00018] in <7c44b50bf6104428bdde89c1398991a5>:0
at Microsoft.ML.Data.DataViewUtils+Splitter+Cursor.MoveNextCore () [0x00062] in <7c44b50bf6104428bdde89c1398991a5>:0
at Microsoft.ML.Data.RootCursorBase.MoveNext () [0x0000a] in <3cf2cbe11d4549029ea8d0e092502b7d>:0
at Microsoft.ML.Transforms.NormalizingTransformer.Train (Microsoft.ML.Runtime.IHostEnvironment env, Microsoft.ML.IDataView data, Microsoft.ML.Transforms.NormalizingEstimator+ColumnOptionsBase[] columns) [0x00207] in <7c44b50bf6104428bdde89c1398991a5>:0
at Microsoft.ML.Transforms.NormalizingEstimator.Fit (Microsoft.ML.IDataView input) [0x00011] in <7c44b50bf6104428bdde89c1398991a5>:0
at Microsoft.ML.Data.EstimatorChain`1[TLastTransformer].Fit (Microsoft.ML.IDataView input) [0x0002f] in <7c44b50bf6104428bdde89c1398991a5>:0
at NOVA_ML.DeviceUpdater.RetrainPipeline (Microsoft.ML.MLContext context, Microsoft.ML.IDataView trainData)

.NET Machine learning
.NET Machine learning
.NET: Microsoft Technologies based on the .NET software framework.Machine learning: A type of artificial intelligence focused on enabling computers to use observed data to evolve new behaviors that have not been explicitly programmed.
150 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Sergey Bogdanov 6 Reputation points
    2022-01-06T00:59:55.58+00:00

    Just have found that it works on .NET 6.0.101