Gradient icon indicating copy to clipboard operation
Gradient copied to clipboard

Unity package

Open lostmsu opened this issue 5 years ago • 1 comments

Ship a package for Unity

lostmsu avatar Jun 09 '20 04:06 lostmsu

Moving this to 2.x for now. Current runtime is unable to survive reload of its assemblies.

Unofficially, you should be able to use TensorFlow in Unity by adding the following .NET Standard 2.0 assemblies from their respective NuGet packages:

Gradient.dll // will be renamed LostTech.TensorFlow.dll by RC0
IndexRange.dll
LostTech.Gradient.dll
LostTech.NumPy.dll
LostTech.WhichPython.dll
Python.Runtime.dll
SharPy.Runtime.dll
System.Buffers.dll
System.Memory.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Security.Permissions.dll

And disabling Domain Reload.

Unfortunately Unity Editor will reload the domain regardless whenever the project is recompiled, after which an attempt to initialize Gradient again will crash the editor with Access Violation/segfault.

Extra hint: using GPU acceleration for TensorFlow requires CUDA and cudnn to be distributed (so an NVidia GPU). Calling tf.test.is_gpu_available() will tell if all components work as expected.

lostmsu avatar Jun 23 '20 05:06 lostmsu