Open taublast opened 11 months ago
This issue has been ongoing since 2.5.0 (https://github.com/xamarin/XamarinComponents/issues/1319) and seems to affect every version I have tried since up to and including the very latest currently available (2.14.0). I have some older Xamarin projects that use monoandroid so I can't use the modified NuGet from @taublast sadly (but it could be useful after migrating to MAUI if this issue is still not fixed).
@taublast Could you perhaps open a PR to this repo with a fix?
The GPU bindings are also not the only missing bindings in the current Xamarin.Tensorflow.Lite packages as there is a similar issue with the processor builders (https://github.com/xamarin/GooglePlayServicesComponents/issues/754)
@wollac11 unfortunately won't be able to work on a PR here, but could help you with older droid if you provide more details on what sdk level you need bindings to support.
The issue
Inside
Xamarin.TensorFlow.Lite.Gpu" Version="2.12.0.1"
we are missingCompatibilityList.BestOptionsForThisDevice
and constructorGpuDelegate(GpuDelegate.Options options)
to be able to to implement gpu acceleration as described here:
https://www.tensorflow.org/lite/android/delegates/gpu?hl=en#enable_gpu_acceleration_2
and in .net maui like that:
The c# code above started working for me after i implemented the solution described below.
The cause of this is that is either: a -
tensorflow-lite-gpu-api
was not included at all b - both gpu-related aar's where processed is same project: bothtensorflow-lite-gpu-api-2.13.0.aar
andtensorflow-lite-gpu-2.13.0.aar
define classes absolutely for same packagetensorflow/lite/gpu
, that creates a conflict for bindings generator and it just skips one of them (tensorflow-lite-gpu-api
in our case).This makes
GpuDelegateFactory.Options
not to be available and bindings are not generated forCompatibilityList.BestOptionsForThisDevice
and the second constructorGpuDelegate(GpuDelegate.Options options)
The solution
To bind
tensorflow-lite-gpu-api-2.13.0.aar
andtensorflow-lite-gpu-2.13.0.aar
in different projects, the latter would reference the first one with "-api"https://github.com/taublast/AppoMobi.Maui.TensorFlow.Lite
Context
This was all about a .net maui 7.0 for android, trying to use
<PackageReference Include="Xamarin.TensorFlow.Lite.Gpu" Version="2.12.0.1" />