Browse Source

Fix math_ops.max and min.

tags/v0.100.4-load-saved-model
Haiping Chen 2 years ago
parent
commit
8a21ad2816
3 changed files with 20 additions and 19 deletions
  1. +13
    -12
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs
  2. +3
    -3
      src/TensorFlowNET.Core/Tensorflow.Binding.csproj
  3. +4
    -4
      src/TensorFlowNET.Keras/Tensorflow.Keras.csproj

+ 13
- 12
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -480,26 +480,27 @@ namespace Tensorflow
return _op.outputs[0];
}

/// <summary>
/// Subroutine for Min or Max functions. See _min and _max
/// </summary>
private static Tensor MinOrMax<Tx, Ty>(Tx input, Ty axis, string methodName, bool keep_dims = false, string name = null)
=> tf.Context.ExecuteOp(methodName, name, new ExecuteOpArgs(input, axis)
public static Tensor _max<Tx, Ty>(Tx input, Ty axis, bool keep_dims = false, string name = null)
=> tf.Context.ExecuteOp("Max", name, new ExecuteOpArgs(input, axis)
{
GetGradientAttrs = (op) => new
{
T = op.get_attr<TF_DataType>("T"),
align_corners = op.get_attr<bool>("align_corners"),
half_pixel_centers = op.get_attr<bool>("half_pixel_centers")
keep_dims = op.get_attr<bool>("keep_dims"),
Tidx = op.get_attr<TF_DataType>("Tidx")
}
}.SetAttributes(new { keep_dims, reduction_indices = axis }));

public static Tensor _max<Tx, Ty>(Tx input, Ty axis, bool keep_dims = false, string name = null)
=> MinOrMax(input, axis, "Max", keep_dims: keep_dims, name: name);

public static Tensor _min<Tx, Ty>(Tx input, Ty axis, bool keep_dims = false, string name = null)
=> MinOrMax(input, axis, "Min", keep_dims: keep_dims, name: name);

=> tf.Context.ExecuteOp("Min", name, new ExecuteOpArgs(input, axis)
{
GetGradientAttrs = (op) => new
{
T = op.get_attr<TF_DataType>("T"),
keep_dims = op.get_attr<bool>("keep_dims"),
Tidx = op.get_attr<TF_DataType>("Tidx")
}
}.SetAttributes(new { keep_dims, reduction_indices = axis }));

public static Tensor pow<Tx, Ty>(Tx x, Ty y, string name = null)
=> tf.Context.ExecuteOp("Pow", name, new ExecuteOpArgs(x, y));


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

@@ -5,7 +5,7 @@
<AssemblyName>Tensorflow.Binding</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>2.10.0</TargetTensorFlow>
<Version>0.100.2</Version>
<Version>0.100.3</Version>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
@@ -20,7 +20,7 @@
<Description>Google's TensorFlow full binding in .NET Standard.
Building, training and infering deep learning models.
https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.100.2.0</AssemblyVersion>
<AssemblyVersion>0.100.3.0</AssemblyVersion>
<PackageReleaseNotes>
tf.net 0.100.x and above are based on tensorflow native 2.10.0

@@ -38,7 +38,7 @@ https://tensorflownet.readthedocs.io</Description>
tf.net 0.7x.x aligns with TensorFlow v2.7.x native library.
tf.net 0.10x.x aligns with TensorFlow v2.10.x native library.
</PackageReleaseNotes>
<FileVersion>0.100.2.0</FileVersion>
<FileVersion>0.100.3.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>


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

@@ -7,10 +7,10 @@
<Nullable>enable</Nullable>
<RootNamespace>Tensorflow.Keras</RootNamespace>
<Platforms>AnyCPU;x64</Platforms>
<Version>0.10.2</Version>
<Version>0.10.3</Version>
<Authors>Haiping Chen</Authors>
<Product>Keras for .NET</Product>
<Copyright>Apache 2.0, Haiping Chen 2021</Copyright>
<Copyright>Apache 2.0, Haiping Chen 2023</Copyright>
<PackageId>TensorFlow.Keras</PackageId>
<PackageProjectUrl>https://github.com/SciSharp/TensorFlow.NET</PackageProjectUrl>
<PackageIconUrl>https://avatars3.githubusercontent.com/u/44989469?s=200&amp;v=4</PackageIconUrl>
@@ -37,8 +37,8 @@ Keras is an API designed for human beings, not machines. Keras follows best prac
<RepositoryType>Git</RepositoryType>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>0.10.2.0</AssemblyVersion>
<FileVersion>0.10.2.0</FileVersion>
<AssemblyVersion>0.10.3.0</AssemblyVersion>
<FileVersion>0.10.3.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Configurations>Debug;Release;GPU</Configurations>
</PropertyGroup>


Loading…
Cancel
Save