diff --git a/.gitignore b/.gitignore index 3e759b75..91dc694a 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,9 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ +/tensorflowlib/win7-x64/native/libtensorflow.dll +/tensorflowlib/osx/native/libtensorflow_framework.dylib +/tensorflowlib/osx/native/libtensorflow.dylib +/tensorflowlib/linux/native/libtensorflow_framework.so +/tensorflowlib/linux/native/libtensorflow.so +/src/TensorFlowNET.Core/libtensorflow.dll diff --git a/README.md b/README.md index e729b272..46827774 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # TensorFlow.NET -TensorFlow binding for .NET Standard +TensorFlow.NET provides .NET Standard binding for [TensorFlow](https://www.tensorflow.org/). + + +TensorFlow.NET is a member project of SciSharp stack. \ No newline at end of file diff --git a/TensorFlow.NET.sln b/TensorFlow.NET.sln new file mode 100644 index 00000000..9b9875c1 --- /dev/null +++ b/TensorFlow.NET.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.UnitTest", "test\TensorFlowNET.UnitTest\TensorFlowNET.UnitTest.csproj", "{029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Core", "src\TensorFlowNET.Core\TensorFlowNET.Core.csproj", "{1B1BC950-2CB0-48E2-B4CD-8172AFF67A10}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NumSharp.Core", "..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj", "{D314AE83-D586-4589-B653-1937F1138A5A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TensorFlowNET.Examples", "test\TensorFlowNET.Examples\TensorFlowNET.Examples.csproj", "{1FE60088-157C-4140-91AB-E96B915E4BAE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {029A8CF1-CF95-4DCB-98AA-9D3D96A83B3E}.Release|Any CPU.Build.0 = Release|Any CPU + {1B1BC950-2CB0-48E2-B4CD-8172AFF67A10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B1BC950-2CB0-48E2-B4CD-8172AFF67A10}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B1BC950-2CB0-48E2-B4CD-8172AFF67A10}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B1BC950-2CB0-48E2-B4CD-8172AFF67A10}.Release|Any CPU.Build.0 = Release|Any CPU + {D314AE83-D586-4589-B653-1937F1138A5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D314AE83-D586-4589-B653-1937F1138A5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D314AE83-D586-4589-B653-1937F1138A5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D314AE83-D586-4589-B653-1937F1138A5A}.Release|Any CPU.Build.0 = Release|Any CPU + {1FE60088-157C-4140-91AB-E96B915E4BAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FE60088-157C-4140-91AB-E96B915E4BAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FE60088-157C-4140-91AB-E96B915E4BAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FE60088-157C-4140-91AB-E96B915E4BAE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2DEAD3CC-486B-4918-A607-50B0DE7B114A} + EndGlobalSection +EndGlobal diff --git a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj new file mode 100644 index 00000000..43821acd --- /dev/null +++ b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + + + + true + DEBUG;TRACE + + + + + PreserveNewest + + + + diff --git a/src/TensorFlowNET.Core/Tensorflow.cs b/src/TensorFlowNET.Core/Tensorflow.cs new file mode 100644 index 00000000..613fb177 --- /dev/null +++ b/src/TensorFlowNET.Core/Tensorflow.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace TensorFlowNET.Core +{ + public static class Tensorflow + { + public const string TensorFlowLibName = "libtensorflow"; + + [DllImport(TensorFlowLibName)] + public static extern unsafe IntPtr TF_Version(); + + public static string VERSION => Marshal.PtrToStringAnsi(TF_Version()); + } +} diff --git a/tensorflowlib/README.md b/tensorflowlib/README.md new file mode 100644 index 00000000..4b1107cc --- /dev/null +++ b/tensorflowlib/README.md @@ -0,0 +1,7 @@ +Here are some pre-built TensorFlow binaries you can use for each platform: + +- Linux + - CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz + - GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.12.0.tar.gz +- Mac: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.12.0.tar.gz +- Windows: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.12.0-rc0.zip \ No newline at end of file diff --git a/test/TensorFlowNET.Examples/Program.cs b/test/TensorFlowNET.Examples/Program.cs new file mode 100644 index 00000000..8bc8b25a --- /dev/null +++ b/test/TensorFlowNET.Examples/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace TensorFlowNET.Examples +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj b/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj new file mode 100644 index 00000000..8081a6b7 --- /dev/null +++ b/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp2.1 + + + + + + + + diff --git a/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj b/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj new file mode 100644 index 00000000..d7a5f65e --- /dev/null +++ b/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.1 + + false + + + + + + + + + + + + + + diff --git a/test/TensorFlowNET.UnitTest/VersionTest.cs b/test/TensorFlowNET.UnitTest/VersionTest.cs new file mode 100644 index 00000000..a0e723d6 --- /dev/null +++ b/test/TensorFlowNET.UnitTest/VersionTest.cs @@ -0,0 +1,20 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Text; +using TensorFlowNET.Core; +using tf = TensorFlowNET.Core.Tensorflow; + +namespace TensorFlowNET.UnitTest +{ + [TestClass] + public class VersionTest + { + [TestMethod] + public void GetVersion() + { + var ver = tf.VERSION; + Assert.IsTrue(ver.Contains(".")); + } + } +}