Browse Source

Release v0.60.2, change to .net standard 2.0.

tags/TensorFlowOpLayer
Oceania2018 4 years ago
parent
commit
e10e2807af
9 changed files with 26 additions and 25 deletions
  1. +0
    -3
      src/TensorFlowNET.Core/NumPy/AutoNumPyAttribute.cs
  2. +1
    -1
      src/TensorFlowNET.Core/Operations/array_ops.cs
  3. +3
    -2
      src/TensorFlowNET.Core/Operations/linalg_ops.cs
  4. +6
    -6
      src/TensorFlowNET.Core/Tensorflow.Binding.csproj
  5. +6
    -4
      src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs
  6. +2
    -1
      src/TensorFlowNET.Keras/Layers/StackedRNNCells.cs
  7. +4
    -4
      src/TensorFlowNET.Keras/Tensorflow.Keras.csproj
  8. +2
    -2
      src/TensorFlowNET.Recommenders/Tensorflow.Recommenders.csproj
  9. +2
    -2
      src/TensorFlowNET.Text/Tensorflow.Text.csproj

+ 0
- 3
src/TensorFlowNET.Core/NumPy/AutoNumPyAttribute.cs View File

@@ -2,9 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using Tensorflow.Eager;
using Tensorflow.Functions;
using static Tensorflow.Binding; using static Tensorflow.Binding;


namespace Tensorflow.NumPy namespace Tensorflow.NumPy


+ 1
- 1
src/TensorFlowNET.Core/Operations/array_ops.cs View File

@@ -798,7 +798,7 @@ namespace Tensorflow
var output = new List<Tensor>(); var output = new List<Tensor>();
foreach (var (i, x) in enumerate(array)) foreach (var (i, x) in enumerate(array))
{ {
var shape = s0[..i].concat(new[] { -1 }).concat(s0[(i + 1)..]);
var shape = s0.Take(i).ToArray().concat(new[] { -1 }).concat(s0.Skip(i + 1).ToArray());
output.add(reshape(stack(x), shape)); output.add(reshape(stack(x), shape));
} }




+ 3
- 2
src/TensorFlowNET.Core/Operations/linalg_ops.cs View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using static Tensorflow.Binding; using static Tensorflow.Binding;


namespace Tensorflow namespace Tensorflow
@@ -53,7 +54,7 @@ namespace Tensorflow


Tensor _composite_impl(Tensor matrix, Tensor rhs, Tensor l2_regularizer = null) Tensor _composite_impl(Tensor matrix, Tensor rhs, Tensor l2_regularizer = null)
{ {
Shape matrix_shape = matrix.shape[^2..];
Shape matrix_shape = matrix.shape.dims.Skip(matrix.shape.ndim - 2).ToArray();
if (matrix_shape.IsFullyDefined) if (matrix_shape.IsFullyDefined)
{ {
if (matrix_shape[-2] >= matrix_shape[-1]) if (matrix_shape[-2] >= matrix_shape[-1])
@@ -88,7 +89,7 @@ namespace Tensorflow
var small_dim = first_kind ? matrix_shape[-1] : matrix_shape[-2]; var small_dim = first_kind ? matrix_shape[-1] : matrix_shape[-2];
var identity = eye(small_dim.numpy(), batch_shape: batch_shape.shape, dtype: matrix.dtype); var identity = eye(small_dim.numpy(), batch_shape: batch_shape.shape, dtype: matrix.dtype);
var small_dim_static = matrix.shape[first_kind ? -1 : -2]; var small_dim_static = matrix.shape[first_kind ? -1 : -2];
identity.shape = matrix.shape[..^2].concat(new[] { small_dim_static, small_dim_static });
identity.shape = matrix.shape.dims.Take(matrix.shape.ndim - 2).ToArray().concat(new[] { small_dim_static, small_dim_static });
gramian += l2_regularizer * identity; gramian += l2_regularizer * identity;
} }




+ 6
- 6
src/TensorFlowNET.Core/Tensorflow.Binding.csproj View File

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


<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>TensorFlow.NET</AssemblyName> <AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace> <RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>2.2.0</TargetTensorFlow> <TargetTensorFlow>2.2.0</TargetTensorFlow>
<Version>0.60.1</Version>
<Version>0.60.2</Version>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
@@ -20,7 +20,7 @@
<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.60.1.0</AssemblyVersion>
<AssemblyVersion>0.60.2.0</AssemblyVersion>
<PackageReleaseNotes>tf.net 0.60.x and above are based on tensorflow native 2.6.0 <PackageReleaseNotes>tf.net 0.60.x and above are based on tensorflow native 2.6.0


* Eager Mode is added finally. * Eager Mode is added finally.
@@ -35,7 +35,7 @@ Keras API is a separate package released as TensorFlow.Keras.
tf.net 0.4x.x aligns with TensorFlow v2.4.1 native library. tf.net 0.4x.x aligns with TensorFlow v2.4.1 native library.
tf.net 0.5x.x aligns with TensorFlow v2.5.x native library. tf.net 0.5x.x aligns with TensorFlow v2.5.x native library.
tf.net 0.6x.x aligns with TensorFlow v2.6.x native library.</PackageReleaseNotes> tf.net 0.6x.x aligns with TensorFlow v2.6.x native library.</PackageReleaseNotes>
<FileVersion>0.60.1.0</FileVersion>
<FileVersion>0.60.2.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
@@ -90,8 +90,8 @@ tf.net 0.6x.x aligns with TensorFlow v2.6.x native library.</PackageReleaseNotes


<ItemGroup> <ItemGroup>
<PackageReference Include="MethodBoundaryAspect.Fody" Version="2.0.139" /> <PackageReference Include="MethodBoundaryAspect.Fody" Version="2.0.139" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Protobuf.Text" Version="0.5.0" /> <PackageReference Include="Protobuf.Text" Version="0.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

+ 6
- 4
src/TensorFlowNET.Keras/Engine/Model.Evaluate.cs View File

@@ -62,7 +62,7 @@ namespace Tensorflow.Keras.Engine
} }
} }


public void evaluate(IDatasetV2 x)
public KeyValuePair<string, float>[] evaluate(IDatasetV2 x)
{ {
data_handler = new DataHandler(new DataHandlerArgs data_handler = new DataHandler(new DataHandlerArgs
{ {
@@ -72,19 +72,21 @@ namespace Tensorflow.Keras.Engine
}); });


Binding.tf_output_redirect.WriteLine($"Testing..."); Binding.tf_output_redirect.WriteLine($"Testing...");
IEnumerable<(string, Tensor)> logs = null;
foreach (var (epoch, iterator) in data_handler.enumerate_epochs()) foreach (var (epoch, iterator) in data_handler.enumerate_epochs())
{ {
reset_metrics(); reset_metrics();
// callbacks.on_epoch_begin(epoch) // callbacks.on_epoch_begin(epoch)
// data_handler.catch_stop_iteration(); // data_handler.catch_stop_iteration();
IEnumerable<(string, Tensor)> results = null;
foreach (var step in data_handler.steps()) foreach (var step in data_handler.steps())
{ {
// callbacks.on_train_batch_begin(step) // callbacks.on_train_batch_begin(step)
results = test_function(iterator);
logs = test_function(iterator);
} }
Binding.tf_output_redirect.WriteLine($"iterator: {epoch + 1}, " + string.Join(", ", results.Select(x => $"{x.Item1}: {(float)x.Item2}")));
Binding.tf_output_redirect.WriteLine($"iterator: {epoch + 1}, " + string.Join(", ", logs.Select(x => $"{x.Item1}: {(float)x.Item2}")));
} }
return logs.Select(x => new KeyValuePair<string, float>(x.Item1, (float)x.Item2)).ToArray();
} }


IEnumerable<(string, Tensor)> test_function(OwnedIterator iterator) IEnumerable<(string, Tensor)> test_function(OwnedIterator iterator)


+ 2
- 1
src/TensorFlowNET.Keras/Layers/StackedRNNCells.cs View File

@@ -51,7 +51,8 @@ namespace Tensorflow.Keras.Layers
} }
else if (RNN._is_multiple_state(lastCell.state_size)) else if (RNN._is_multiple_state(lastCell.state_size))
{ {
return ((dynamic)Cells[-1].state_size)[0];
// return ((dynamic)Cells[-1].state_size)[0];
throw new NotImplementedException("");
} }
else else
{ {


+ 4
- 4
src/TensorFlowNET.Keras/Tensorflow.Keras.csproj View File

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


<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Tensorflow.Keras</AssemblyName> <AssemblyName>Tensorflow.Keras</AssemblyName>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<RootNamespace>Tensorflow.Keras</RootNamespace> <RootNamespace>Tensorflow.Keras</RootNamespace>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<Version>0.6.1</Version>
<Version>0.6.2</Version>
<Authors>Haiping Chen</Authors> <Authors>Haiping Chen</Authors>
<Product>Keras for .NET</Product> <Product>Keras for .NET</Product>
<Copyright>Apache 2.0, Haiping Chen 2021</Copyright> <Copyright>Apache 2.0, Haiping Chen 2021</Copyright>
@@ -37,8 +37,8 @@ Keras is an API designed for human beings, not machines. Keras follows best prac
<RepositoryType>Git</RepositoryType> <RepositoryType>Git</RepositoryType>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>0.6.1.0</AssemblyVersion>
<FileVersion>0.6.1.0</FileVersion>
<AssemblyVersion>0.6.2.0</AssemblyVersion>
<FileVersion>0.6.2.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup> </PropertyGroup>




+ 2
- 2
src/TensorFlowNET.Recommenders/Tensorflow.Recommenders.csproj View File

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


<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>0.0.1</Version> <Version>0.0.1</Version>
<Description>TensorFlow Recommenders is a library for building recommender system models using TensorFlow.</Description> <Description>TensorFlow Recommenders is a library for building recommender system models using TensorFlow.</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>


+ 2
- 2
src/TensorFlowNET.Text/Tensorflow.Text.csproj View File

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


<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Tensorflow.Text</RootNamespace> <RootNamespace>Tensorflow.Text</RootNamespace>
<AssemblyName>Tensorflow.Text</AssemblyName> <AssemblyName>Tensorflow.Text</AssemblyName>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>


Loading…
Cancel
Save