Skip to content

Commit 49cbae0

Browse files
Sebastian-rokoEsther2013
authored andcommitted
Fix sign function in eager mode
1 parent fb903d8 commit 49cbae0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,16 @@ public static Tensor sigmoid_grad(Tensor y, Tensor dy, string name = "SigmoidGra
374374

375375
public static Tensor sign<T>(T x, string name = "Sign")
376376
{
377+
if (tf.executing_eagerly())
378+
{
379+
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
380+
"Sign", name,
381+
null,
382+
x);
383+
384+
return results[0];
385+
}
386+
377387
var op = tf.OpDefLib._apply_op_helper("Sign", name: name, args: new { x });
378388

379389
return op.outputs[0];

0 commit comments

Comments
 (0)