diff --git a/src/TensorFlowNET.Core/APIs/tf.math.cs b/src/TensorFlowNET.Core/APIs/tf.math.cs index 9a405b49..2d91be12 100644 --- a/src/TensorFlowNET.Core/APIs/tf.math.cs +++ b/src/TensorFlowNET.Core/APIs/tf.math.cs @@ -211,6 +211,9 @@ namespace Tensorflow public Tensor logical_and(Tensor x, Tensor y, string name = null) => gen_math_ops.logical_and(x, y, name); + public Tensor logical_and(bool x, bool y, string name = null) + => gen_math_ops.logical_and(x, y, name); + public Tensor logical_not(Tensor x, string name = null) => gen_math_ops.logical_not(x, name); diff --git a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs index bb9cc1c9..f059b9bd 100644 --- a/src/TensorFlowNET.Core/Operations/gen_math_ops.cs +++ b/src/TensorFlowNET.Core/Operations/gen_math_ops.cs @@ -578,10 +578,21 @@ namespace Tensorflow x); public static Tensor logical_and(Tensor x, Tensor y, string name = null) + => tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y }); + + public static Tensor logical_and(bool x, bool y, string name = null) { - var _op = tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y }); + if (tf.Context.executing_eagerly()) + { + var results = tf.Runner.TFE_FastPathExecute(tf.Context, tf.Context.DeviceName, + "LogicalAnd", name, + null, + x, y); - return _op.outputs[0]; + return results[0]; + } + + return tf.OpDefLib._apply_op_helper("LogicalAnd", name, args: new { x, y }); } public static Tensor logical_not(Tensor x, string name = null)