From c83f3558535ff9115ecd6e09e31721a6cf116a4f Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Sat, 14 Mar 2020 15:54:22 -0500 Subject: [PATCH] upgrade SciSharp.TensorFlow.Redist to 2.1.0. --- src/TensorFlowNET.Core/Operations/gen_math_ops.cs | 8 ++++++++ .../TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj | 2 +- .../math_test/MathOperationTest.cs | 11 ++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs index 0a053808..e66e326b 100644 --- a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs @@ -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]; diff --git a/test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj b/test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj index ef09f5e6..d269bcdc 100644 --- a/test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj +++ b/test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj @@ -34,7 +34,7 @@ - + diff --git a/test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs b/test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs index ac729704..0840b318 100644 --- a/test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs +++ b/test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs @@ -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(); 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(); + Assert.IsTrue(Enumerable.SequenceEqual(expected, actual)); + } } }