Browse Source

fix stop_gradient in eager mode.

tags/TensorFlowOpLayer
Oceania2018 4 years ago
parent
commit
1fa2f1d7b2
3 changed files with 3 additions and 21 deletions
  1. +1
    -1
      src/TensorFlowNET.Console/Tensorflow.Console.csproj
  2. +1
    -19
      src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs
  3. +1
    -1
      src/TensorFlowNET.Core/Operations/array_ops.cs

+ 1
- 1
src/TensorFlowNET.Console/Tensorflow.Console.csproj View File

@@ -19,7 +19,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.5.0" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.6.0" />
</ItemGroup>

<ItemGroup>


+ 1
- 19
src/TensorFlowNET.Core/Operations/Distributions/distribution.py.cs View File

@@ -60,25 +60,7 @@ namespace Tensorflow
{
return tf_with(ops.name_scope(name, "moments", new { value }), scope =>
{
try
{
return _log_prob(value);
}
#pragma warning disable CS0168 // Variable is declared but never used
catch (Exception e1)
#pragma warning restore CS0168 // Variable is declared but never used
{
try
{
return math_ops.log(_prob(value));
#pragma warning disable CS0168 // Variable is declared but never used
}
catch (Exception e2)
#pragma warning restore CS0168 // Variable is declared but never used
{
throw new NotImplementedException();
}
}
return math_ops.log(value);
});
}



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

@@ -656,7 +656,7 @@ namespace Tensorflow
/// <param name="name"></param>
/// <returns></returns>
public static Tensor stop_gradient(Tensor input, string name = null)
=> gen_array_ops.stop_gradient(input, name);
=> tf.Context.ExecuteOp("StopGradient", name, new ExecuteOpArgs(input));

/// <summary>
/// Extracts a strided slice of a tensor (generalized python array indexing).


Loading…
Cancel
Save