mindspore.ops.logical_and
- mindspore.ops.logical_and(input, other)[源代码]
逐元素计算两个tensor的逻辑与运算。
说明
支持广播。
支持隐式类型转换。
- 参数:
input (Union[Tensor, bool]) - 第一个输入。
other (Union[Tensor, bool]) - 第二个输入。
- 返回:
Tensor
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import mindspore >>> x = mindspore.tensor([True, False, True], mindspore.bool_) >>> y = mindspore.tensor([True, True, False], mindspore.bool_) >>> output = mindspore.ops.logical_and(x, y) >>> print(output) [ True False False] >>> x = mindspore.tensor(1, mindspore.bool_) >>> y = mindspore.tensor(0, mindspore.bool_) >>> output = mindspore.ops.logical_and(x, y) >>> print(output) False >>> x = True >>> y = mindspore.tensor(0, mindspore.bool_) >>> output = mindspore.ops.logical_and(x, y) >>> print(output) False >>> x = True >>> y = mindspore.tensor([True, False], mindspore.bool_) >>> output = mindspore.ops.logical_and(x, y) >>> print(output) [True False]