Skip to content

Commit c83f355

Browse files
committed
upgrade SciSharp.TensorFlow.Redist to 2.1.0.
1 parent e802957 commit c83f355

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎src/TensorFlowNET.Core/Operations/gen_math_ops.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ public static Tensor unsorted_segment_sum(Tensor data, Tensor segment_ids, Tenso
321321

322322
public static Tensor tan(Tensor x, string name = null)
323323
{
324+
if (tf.context.executing_eagerly())
325+
{
326+
var _result = wrap_tfe_src.TFE_FastPathExecute(tf.context, tf.context.device_name,
327+
"Tan", name, null,
328+
x);
329+
return _result;
330+
}
331+
324332
var _op = _op_def_lib._apply_op_helper("Tan", name, args: new { x });
325333

326334
return _op.outputs[0];

‎test/TensorFlowNET.UnitTest/Tensorflow.UnitTest.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
3535
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
3636
<PackageReference Include="NumSharp.Lite" Version="0.1.7" />
37-
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.15.1" />
37+
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.1.0" />
3838
</ItemGroup>
3939

4040
<ItemGroup>

‎test/TensorFlowNET.UnitTest/math_test/MathOperationTest.cs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,19 @@ public class MathOperationTest
1717
[TestMethod]
1818
public void Sin()
1919
{
20-
var b = tf.sin(a, name: "sin");
20+
var b = tf.sin(a, name: "Sin");
2121
var expected = new float[] { 0.84147096f, -0.47942555f, -0.2555412f, -0.8632094f /*python output -0.86320937*/, 0f, -0.21511999f };
2222
var actual = b.ToArray<float>();
2323
Assert.IsTrue(Enumerable.SequenceEqual(expected, actual));
2424
}
25+
26+
[TestMethod]
27+
public void Tan()
28+
{
29+
var b = tf.tan(a, name: "Tan");
30+
var expected = new float[] { 1.5574077f, -0.5463025f, 0.264317f, 1.709847f, 0f, -0.2202772f };
31+
var actual = b.ToArray<float>();
32+
Assert.IsTrue(Enumerable.SequenceEqual(expected, actual));
33+
}
2534
}
2635
}

0 commit comments

Comments
 (0)