Unity UWP build error
I trained a model with ML-agents and plan to run the trained model as internal brain in HoloLens. While building UWP, three errors are shown:
Assets\ML-Agents\Scripts\CoreBrainInternal.cs(12,7): error CS0246: The type or namespace name 'TensorFlow' could not be found (are you missing a using directive or an assembly reference?) Assets\ML-Agents\Scripts\CoreBrainInternal.cs(70,5): error CS0246: The type or namespace name 'TFGraph' could not be found (are you missing a using directive or an assembly reference?) Assets\ML-Agents\Scripts\CoreBrainInternal.cs(71,5): error CS0246: The type or namespace name 'TFSession' could not be found (are you missing a using directive or an assembly reference?)
I did follow the instruction to import TensorflowSharp package and define ENABLE_TENSORFLOW, and the project runs well in Unity editor.
Also, an error was shown in the inspector when brain was switched to internal saying:
You cannot have ENABLE_TENSORFLOW without NET_4_6.
However, I have net 4.6 framework installed.
This is the Setting->Player

Hi @keanudicap, we haven't tested this on hololens yet. Does this error happen on Windows also or it is only for hololens build?
Hi @keanudicap, we haven't tested this on hololens yet. Does this error happen on Windows also or it is only for hololens build?
It happened when switch the build platform to Universal Windows Platform (UWP). We didn't really include HoloLens toolkit (Mixed reality toolkit) in the project for testing.
I guess the main problem would be failure in finding NET_4_6 which results in the disability of ENABLE_TENSORFLOW. However, as the image I showed above, I switched Api compatibility level to .NET 4.x.
Not sure how this works on hololens.....
It is easy to reproduce the error.
- Having any Unity project using ML-agents, for instance, we could use 3D ball example.
- Import Tensorflowshap.package, and do all the settings, e.g. create ENABLE_TENSORFLOW
- File->Build setting-> switch platform to UWP

- When build, the error shall be shown.
So we won't have any file within TensorFlowSharp.package to support UWP. We have someone actively working on supporting WinML, which can potentially support this. Hopefully that will solve your problem.
Thanks for your quick reply. Could I say that ml-agents does not support UWP build for now?
It does not support UWP for now, it only experimentally supports inference on mac, windows, linux, ios and android.
Please consider about supporting this on UWP, or you can give me some hints, maybe it is not so hard.
You can contribute to https://github.com/migueldeicaza/TensorFlowSharp to help supporting it.
@xiaomaogy
I have the same issue as described here and on few other posts:

and wherever I search issue was related to unsupported setup (which is not my case), or was not resolved at all. Could you point to what may be wrong?
When I remove "ENABLE_TENSORFLOW" from Scripting Runtime Symbols, error disappears - I assume it's due to #if ENABLE_TENSORFLOW line.
Brute force removing #if ENABLE_TENSORFLOW didn't help either.
I have Unity 2018.3.0f2 Tried it on both ML Agents 0.5 and ML Agents 0.6 no success in either case.
What am I missing?
Hi @oddEventHorizon , as we discussed above, the UWP is not supported by our TFSharp solution right now....And I'm not able to help you on this issue...
thanks for short, reply. I'm not using UWP yet I see the same error. Should I start a new issue then?

@oddEventHorizon Yes you should start another issue if it is not related with this issue's title.
你好@xiaomaogy ,我也遇到了相同的问题,请问它现在能支持UWP了吗?
你好 @lh784116211 , 目前我们已经不用tensorflowsharp,转为使用Barracuda了。理论上Barracuda应该支持UWP, 不过我们没有试过,你可以试一下,要是不行的话可以再post一个新的issue。
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.