Skip to content

Commit 67a661a

Browse files
committed
add overload for math.logical_and.
1 parent b59f5a7 commit 67a661a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/TensorFlowNET.Core/APIs/tf.math.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ public Tensor log1p(Tensor x, string name = null)
211211
public Tensor logical_and(Tensor x, Tensor y, string name = null)
212212
=> gen_math_ops.logical_and(x, y, name);
213213

214+
public Tensor logical_and(bool x, bool y, string name = null)
215+
=> gen_math_ops.logical_and(x, y, name);
216+
214217
public Tensor logical_not(Tensor x, string name = null)
215218
=> gen_math_ops.logical_not(x, name);
216219

src/TensorFlowNET.Core/Operations/gen_math_ops.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,21 @@ public static Tensor log1p(Tensor x, string name = null)
578578
x);
579579

580580
public static Tensor logical_and(Tensor x, Tensor y, string name = null)
581+
=> tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y });
582+
583+
public static Tensor logical_and(bool x, bool y, string name = null)
581584
{
582-
var _op = tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y });
585+
if (tf.Context.executing_eagerly())
586+
{
587+
var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName,
588+
"LogicalAnd", name,
589+
null,
590+
x, y);
583591

584-
return _op.outputs[0];
592+
return results[0];
593+
}
594+
595+
return tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y });
585596
}
586597

587598
public static Tensor logical_not(Tensor x, string name = null)

0 commit comments

Comments
 (0)