@@ -321,6 +321,14 @@ namespace Tensorflow | |||||
public static Tensor tan(Tensor x, string name = null) | 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 }); | var _op = _op_def_lib._apply_op_helper("Tan", name, args: new { x }); | ||||
return _op.outputs[0]; | return _op.outputs[0]; | ||||
@@ -34,7 +34,7 @@ | |||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> | <PackageReference Include="MSTest.TestAdapter" Version="2.1.0" /> | ||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> | <PackageReference Include="MSTest.TestFramework" Version="2.1.0" /> | ||||
<PackageReference Include="NumSharp.Lite" Version="0.1.7" /> | <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> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -17,10 +17,19 @@ namespace TensorFlowNET.UnitTest.math_test | |||||
[TestMethod] | [TestMethod] | ||||
public void Sin() | 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 expected = new float[] { 0.84147096f, -0.47942555f, -0.2555412f, -0.8632094f /*python output -0.86320937*/, 0f, -0.21511999f }; | ||||
var actual = b.ToArray<float>(); | var actual = b.ToArray<float>(); | ||||
Assert.IsTrue(Enumerable.SequenceEqual(expected, actual)); | 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)); | |||||
} | |||||
} | } | ||||
} | } |