Skip to content

Commit 4053080

Browse files
committed
sigmoid_grad eager.
1 parent 623afd5 commit 4053080

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,19 @@ public static Tensor sigmoid(Tensor x, string name = "Sigmoid")
354354
/// </remarks>
355355
public static Tensor sigmoid_grad(Tensor y, Tensor dy, string name = "SigmoidGrad")
356356
{
357+
if (tf.executing_eagerly())
358+
{
359+
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
360+
"SigmoidGrad", name,
361+
null,
362+
y, dy);
363+
364+
return results[0];
365+
}
366+
357367
var op = tf.OpDefLib._apply_op_helper("SigmoidGrad", name: name, args: new { y, dy });
358368

359-
return op.outputs[0];
369+
return op.output;
360370
}
361371

362372
public static Tensor sign<T>(T x, string name = "Sign")
@@ -410,7 +420,7 @@ public static Tensor unsorted_segment_sum(Tensor data, Tensor segment_ids, Tenso
410420

411421
public static Tensor tan(Tensor x, string name = null)
412422
{
413-
if (tf.Context.executing_eagerly())
423+
if (tf.executing_eagerly())
414424
{
415425
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
416426
"Tan", name,
@@ -422,12 +432,12 @@ public static Tensor tan(Tensor x, string name = null)
422432

423433
var _op = tf.OpDefLib._apply_op_helper("Tan", name, args: new { x });
424434

425-
return _op.outputs[0];
435+
return _op.output;
426436
}
427437

428438
public static Tensor tanh(Tensor x, string name = null)
429439
{
430-
if (tf.Context.executing_eagerly())
440+
if (tf.executing_eagerly())
431441
{
432442
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
433443
"Tanh", name,

0 commit comments

Comments
 (0)