Browse Source

The first API: tf.VERSION

tags/v0.1.0-Tensor
Oceania2018 6 years ago
parent
commit
dc2db55054
10 changed files with 160 additions and 1 deletions
  1. +6
    -0
      .gitignore
  2. +4
    -1
      README.md
  3. +43
    -0
      TensorFlow.NET.sln
  4. +18
    -0
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  5. +17
    -0
      src/TensorFlowNET.Core/Tensorflow.cs
  6. +7
    -0
      tensorflowlib/README.md
  7. +12
    -0
      test/TensorFlowNET.Examples/Program.cs
  8. +13
    -0
      test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj
  9. +20
    -0
      test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj
  10. +20
    -0
      test/TensorFlowNET.UnitTest/VersionTest.cs

+ 6
- 0
.gitignore View File

@@ -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

+ 4
- 1
README.md View File

@@ -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.

+ 43
- 0
TensorFlow.NET.sln View File

@@ -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

+ 18
- 0
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Update="libtensorflow.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

+ 17
- 0
src/TensorFlowNET.Core/Tensorflow.cs View File

@@ -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());
}
}

+ 7
- 0
tensorflowlib/README.md View File

@@ -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

+ 12
- 0
test/TensorFlowNET.Examples/Program.cs View File

@@ -0,0 +1,12 @@
using System;

namespace TensorFlowNET.Examples
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

+ 13
- 0
test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" />
<ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" />
</ItemGroup>

</Project>

+ 20
- 0
test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\NumSharp\src\NumSharp.Core\NumSharp.Core.csproj" />
<ProjectReference Include="..\..\src\TensorFlowNET.Core\TensorFlowNET.Core.csproj" />
</ItemGroup>

</Project>

+ 20
- 0
test/TensorFlowNET.UnitTest/VersionTest.cs View File

@@ -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("."));
}
}
}

Loading…
Cancel
Save