| @@ -4,12 +4,13 @@ | |||||
| [](https://gitter.im/sci-sharp/community) | [](https://gitter.im/sci-sharp/community) | ||||
| [](https://ci.appveyor.com/project/Haiping-Chen/tensorflow-net) | [](https://ci.appveyor.com/project/Haiping-Chen/tensorflow-net) | ||||
| [](https://codecov.io/gh/SciSharp/NumSharp) | |||||
| [](https://www.nuget.org/packages/TensorFlow.NET) | [](https://www.nuget.org/packages/TensorFlow.NET) | ||||
| [](https://tensorflownet.readthedocs.io/en/latest/?badge=latest) | [](https://tensorflownet.readthedocs.io/en/latest/?badge=latest) | ||||
| [](https://996.icu/#/en_US) | [](https://996.icu/#/en_US) | ||||
| [](https://mybinder.org/v2/gh/javiercp/BinderTF.NET/master?urlpath=lab) | [](https://mybinder.org/v2/gh/javiercp/BinderTF.NET/master?urlpath=lab) | ||||
| *master branch is based on tensorflow 2.1 now, v0.15-tensorflow1.15 is from tensorflow1.15.* | |||||
| TF.NET is a member project of [SciSharp STACK](https://github.com/SciSharp). | TF.NET is a member project of [SciSharp STACK](https://github.com/SciSharp). | ||||
| @@ -29,10 +30,9 @@ In comparison to other projects, like for instance TensorFlowSharp which only pr | |||||
| | TensorFlow | tf 1.13 | tf 1.14 | tf 1.15 | tf 2.0 | | | TensorFlow | tf 1.13 | tf 1.14 | tf 1.15 | tf 2.0 | | ||||
| | ----------- | ------- | ------- | ------- | ------ | | | ----------- | ------- | ------- | ------- | ------ | | ||||
| | tf.net 0.14 | | x | x | | | |||||
| | tf.net 0.13 | | x | x | | | |||||
| | tf.net 0.12 | x | x | | | | |||||
| | tf.net 0.11 | x | x | | | | |||||
| | tf.net 0.20 | | | x | x | | |||||
| | tf.net 0.15 | | x | x | | | |||||
| | tf.net 0.14 | x | x | | | | |||||
| Install TF.NET and TensorFlow binary through NuGet. | Install TF.NET and TensorFlow binary through NuGet. | ||||
| ```sh | ```sh | ||||
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public abstract class DataSetBase : IDataSet | public abstract class DataSetBase : IDataSet | ||||
| { | { | ||||
| @@ -1,6 +0,0 @@ | |||||
| namespace Tensorflow.Data | |||||
| { | |||||
| public class DatasetV1 : DatasetV2 | |||||
| { | |||||
| } | |||||
| } | |||||
| @@ -1,9 +0,0 @@ | |||||
| namespace Tensorflow.Data | |||||
| { | |||||
| /// <summary> | |||||
| /// Wraps a V2 `Dataset` object in the `tf.compat.v1.data.Dataset` API. | |||||
| /// </summary> | |||||
| public class DatasetV1Adapter : DatasetV1 | |||||
| { | |||||
| } | |||||
| } | |||||
| @@ -1,21 +0,0 @@ | |||||
| using System; | |||||
| namespace Tensorflow.Data | |||||
| { | |||||
| /// <summary> | |||||
| /// Represents a potentially large set of elements. | |||||
| /// | |||||
| /// A `Dataset` can be used to represent an input pipeline as a | |||||
| /// collection of elements (nested structures of tensors) and a "logical | |||||
| /// plan" of transformations that act on those elements. | |||||
| /// | |||||
| /// tensorflow\python\data\ops\dataset_ops.py | |||||
| /// </summary> | |||||
| public class DatasetV2 | |||||
| { | |||||
| public static DatasetV2 from_generator() | |||||
| { | |||||
| throw new NotImplementedException(""); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public class Datasets<TDataSet> where TDataSet : IDataSet | public class Datasets<TDataSet> where TDataSet : IDataSet | ||||
| { | { | ||||
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public interface IDataSet | public interface IDataSet | ||||
| { | { | ||||
| @@ -4,7 +4,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public interface IModelLoader<TDataSet> | public interface IModelLoader<TDataSet> | ||||
| where TDataSet : IDataSet | where TDataSet : IDataSet | ||||
| @@ -3,9 +3,8 @@ using System.Collections.Generic; | |||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| using Tensorflow; | |||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public class MnistDataSet : DataSetBase | public class MnistDataSet : DataSetBase | ||||
| { | { | ||||
| @@ -5,7 +5,7 @@ using System.Text; | |||||
| using System.IO; | using System.IO; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public class MnistModelLoader : IModelLoader<MnistDataSet> | public class MnistModelLoader : IModelLoader<MnistDataSet> | ||||
| { | { | ||||
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using NumSharp; | using NumSharp; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public class ModelLoadSetting | public class ModelLoadSetting | ||||
| { | { | ||||
| @@ -7,7 +7,7 @@ using System.Text; | |||||
| using System.Threading; | using System.Threading; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| namespace Tensorflow.Hub | |||||
| namespace Tensorflow | |||||
| { | { | ||||
| public static class Utils | public static class Utils | ||||
| { | { | ||||
| @@ -5,7 +5,7 @@ | |||||
| <AssemblyName>TensorFlow.NET</AssemblyName> | <AssemblyName>TensorFlow.NET</AssemblyName> | ||||
| <RootNamespace>Tensorflow</RootNamespace> | <RootNamespace>Tensorflow</RootNamespace> | ||||
| <TargetTensorFlow>1.14.1</TargetTensorFlow> | <TargetTensorFlow>1.14.1</TargetTensorFlow> | ||||
| <Version>0.15.0</Version> | |||||
| <Version>0.20.0</Version> | |||||
| <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> | <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> | ||||
| <Company>SciSharp STACK</Company> | <Company>SciSharp STACK</Company> | ||||
| <GeneratePackageOnBuild>true</GeneratePackageOnBuild> | <GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||||
| @@ -18,15 +18,15 @@ | |||||
| <Description>Google's TensorFlow full binding in .NET Standard. | <Description>Google's TensorFlow full binding in .NET Standard. | ||||
| Building, training and infering deep learning models. | Building, training and infering deep learning models. | ||||
| https://tensorflownet.readthedocs.io</Description> | https://tensorflownet.readthedocs.io</Description> | ||||
| <AssemblyVersion>0.15.0.0</AssemblyVersion> | |||||
| <PackageReleaseNotes>Changes since v0.14.0: | |||||
| <AssemblyVersion>0.20.0.0</AssemblyVersion> | |||||
| <PackageReleaseNotes>Changes since v0.15.0: | |||||
| 1: Add TransformGraphWithStringInputs. | 1: Add TransformGraphWithStringInputs. | ||||
| 2: tf.trainer.load_graph, tf.trainer.freeze_graph | 2: tf.trainer.load_graph, tf.trainer.freeze_graph | ||||
| 3: Import Protobuf.Text | 3: Import Protobuf.Text | ||||
| 4: Support YOLOv3 object detection | 4: Support YOLOv3 object detection | ||||
| 5: Add implicitation for Operation to RefVariable</PackageReleaseNotes> | 5: Add implicitation for Operation to RefVariable</PackageReleaseNotes> | ||||
| <LangVersion>7.3</LangVersion> | <LangVersion>7.3</LangVersion> | ||||
| <FileVersion>0.15.0.0</FileVersion> | |||||
| <FileVersion>0.20.0.0</FileVersion> | |||||
| <PackageLicenseFile>LICENSE</PackageLicenseFile> | <PackageLicenseFile>LICENSE</PackageLicenseFile> | ||||
| <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||||
| <SignAssembly>true</SignAssembly> | <SignAssembly>true</SignAssembly> | ||||
| @@ -3,14 +3,12 @@ using NumSharp; | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow.Data; | |||||
| using Tensorflow.Keras.Initializers; | using Tensorflow.Keras.Initializers; | ||||
| namespace Tensorflow.Keras.Engine | namespace Tensorflow.Keras.Engine | ||||
| { | { | ||||
| public abstract class PreprocessingLayer : Layer | public abstract class PreprocessingLayer : Layer | ||||
| { | { | ||||
| public abstract void adapt(Data.DatasetV1 data, bool reset_state = true); | |||||
| } | } | ||||
| public abstract class Combiner | public abstract class Combiner | ||||
| @@ -44,15 +42,6 @@ namespace Tensorflow.Keras.Engine | |||||
| private Dictionary<string, NDArray> _restore_updates() => throw new NotImplementedException(); | private Dictionary<string, NDArray> _restore_updates() => throw new NotImplementedException(); | ||||
| private bool _dataset_is_infinite(DatasetV1 dataset) => throw new NotImplementedException(); | |||||
| private dynamic _get_dataset_iterator(DatasetV1 dataset) => throw new NotImplementedException(); | |||||
| private void _set_state_variables(Dictionary<string, Tensor> updates) => throw new NotImplementedException(); | private void _set_state_variables(Dictionary<string, Tensor> updates) => throw new NotImplementedException(); | ||||
| public override void adapt(DatasetV1 data, bool reset_state = true) | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <OutputType>Exe</OutputType> | <OutputType>Exe</OutputType> | ||||
| <TargetFramework>netcoreapp2.2</TargetFramework> | |||||
| <TargetFramework>netcoreapp3.1</TargetFramework> | |||||
| </PropertyGroup> | </PropertyGroup> | ||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||||
| @@ -20,7 +20,7 @@ | |||||
| <ItemGroup> | <ItemGroup> | ||||
| <PackageReference Include="BenchmarkDotNet" Version="0.12.0" /> | <PackageReference Include="BenchmarkDotNet" Version="0.12.0" /> | ||||
| <PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.15.1" /> | <PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.15.1" /> | ||||
| <PackageReference Include="TensorFlow.NET" Version="0.14.2" /> | |||||
| <PackageReference Include="TensorFlow.NET" Version="0.15.0" /> | |||||
| </ItemGroup> | </ItemGroup> | ||||
| </Project> | </Project> | ||||
| @@ -18,40 +18,34 @@ sudo apt install libgdiplus | |||||
| More information about [System.Drawing on Linux](<https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx>). | More information about [System.Drawing on Linux](<https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx>). | ||||
| ### Run TensorFlow in GPU | |||||
| ### Run TensorFlow with GPU | |||||
| Before running verify you installed CUDA and cuDNN (TensorFlow v1.15 is compatible with CUDA v10.0 and cuDNN v7.4 , TensorFlow v2.x is compatible with CUDA v10.2 and cuDNN v7.65), and make sure the corresponding cuda version is compatible. | Before running verify you installed CUDA and cuDNN (TensorFlow v1.15 is compatible with CUDA v10.0 and cuDNN v7.4 , TensorFlow v2.x is compatible with CUDA v10.2 and cuDNN v7.65), and make sure the corresponding cuda version is compatible. | ||||
| #### Run in Mac OS | |||||
| #### Mac OS | |||||
| There is no GPU support for macOS. | There is no GPU support for macOS. | ||||
| #### Tensorflow GPU for Windows | |||||
| #### GPU for Windows | |||||
| ```powershell | ```powershell | ||||
| PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU | PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU | ||||
| ``` | ``` | ||||
| #### Tensorflow GPU for Linux | |||||
| #### GPU for Linux | |||||
| ```powershell | ```powershell | ||||
| PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU | PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU | ||||
| ``` | ``` | ||||
| ### Download prebuild binary manually | ### Download prebuild binary manually | ||||
| 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.15.0.tar.gz | |||||
| - GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.15.0.tar.gz | |||||
| - Mac: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.15.0.tar.gz | |||||
| - Windows | |||||
| - CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.15.0.zip | |||||
| - GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.15.0.zip | |||||
| We can't found official prebuild binaries for each platform since tensorflow 2.0. If you know where we can download, please PR here. | |||||
| ### Build from source for Windows | ### Build from source for Windows | ||||
| https://www.tensorflow.org/install/source_windows | https://www.tensorflow.org/install/source_windows | ||||
| Download [Bazel 0.29.1](https://github.com/bazelbuild/bazel/releases/tag/0.29.1) to build tensorflow2.x. We build customized binary to export c_api from this [fork](https://github.com/SciSharp/tensorflow). | |||||
| `pacman -S git patch unzip` | `pacman -S git patch unzip` | ||||
| 1. Build static library | 1. Build static library | ||||
| @@ -81,4 +75,4 @@ TF_CAPI_EXPORT extern void RemoveAllControlInputs(TF_Graph* graph, TF_Operation* | |||||
| ``` | ``` | ||||
| For Linux version, these APIs symbols should also be put into `tensorflow/c/version_script.lds` to be exported. | For Linux version, these APIs symbols should also be put into `tensorflow/c/version_script.lds` to be exported. | ||||
| Please refer to commit `https://github.com/SciSharp/tensorflow/commit/58122da06be3e7707500ad889dfd5c760a3e0424` | |||||
| Please refer to commit `https://github.com/SciSharp/tensorflow/commit/58122da06be3e7707500ad889dfd5c760a3e0424` | |||||
| @@ -1,6 +1,6 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| using Tensorflow.Hub; | |||||
| using Tensorflow; | |||||
| namespace TensorFlowNET.UnitTest | namespace TensorFlowNET.UnitTest | ||||
| { | { | ||||
| @@ -1,11 +1,11 @@ | |||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <TargetFramework>netcoreapp3.0</TargetFramework> | |||||
| <TargetFramework>netcoreapp3.1</TargetFramework> | |||||
| <IsPackable>false</IsPackable> | <IsPackable>false</IsPackable> | ||||
| <SignAssembly>true</SignAssembly> | |||||
| <SignAssembly>false</SignAssembly> | |||||
| <DelaySign>false</DelaySign> | <DelaySign>false</DelaySign> | ||||