Browse Source

upgrade SciSharp.TensorFlow.Redist to 2.1.0.

tags/v0.20
Oceania2018 5 years ago
parent
commit
c83f355853
3 changed files with 19 additions and 2 deletions
  1. +8
    -0
      src/TensorFlowNET.Core/Operations/gen_math_ops.cs
  2. +1
    -1
      test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj
  3. +10
    -1
      test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs

+ 8
- 0
src/TensorFlowNET.Core/Operations/gen_math_ops.cs View File

@@ -321,6 +321,14 @@ namespace Tensorflow

public static Tensor tan(Tensor x, string name = null)
{
if (tf.context.executing_eagerly())
{
var _result = wrap_tfe_src.TFE_FastPathExecute(tf.context, tf.context.device_name,
"Tan", name, null,
x);
return _result;
}

var _op = _op_def_lib._apply_op_helper("Tan", name, args: new { x });

return _op.outputs[0];


+ 1
- 1
test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj View File

@@ -34,7 +34,7 @@
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="NumSharp.Lite" Version="0.1.7" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.15.1" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.1.0" />
</ItemGroup>

<ItemGroup>


+ 10
- 1
test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs View File

@@ -17,10 +17,19 @@ namespace TensorFlowNET.UnitTest.math_test
[TestMethod]
public void Sin()
{
var b = tf.sin(a, name: "sin");
var b = tf.sin(a, name: "Sin");
var expected = new float[] { 0.84147096f, -0.47942555f, -0.2555412f, -0.8632094f /*python output -0.86320937*/, 0f, -0.21511999f };
var actual = b.ToArray<float>();
Assert.IsTrue(Enumerable.SequenceEqual(expected, actual));
}

[TestMethod]
public void Tan()
{
var b = tf.tan(a, name: "Tan");
var expected = new float[] { 1.5574077f, -0.5463025f, 0.264317f, 1.709847f, 0f, -0.2202772f };
var actual = b.ToArray<float>();
Assert.IsTrue(Enumerable.SequenceEqual(expected, actual));
}
}
}

Loading…
Cancel
Save