numpy.logical_or

numpy.logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'logical_or'>

Compute the truth value of x1 OR x2 element-wise.

Parameters:

x1, x2 : array_like Logical OR is applied to the elements of x1 and x2. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output). out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized. **kwargs For other keyword-only arguments, see the ufunc docs.

Returns:

y : ndarray or bool Boolean result of the logical OR operation applied to the elements of x1 and x2; the shape is determined by broadcasting. This is a scalar if both x1 and x2 are scalars.

See also

logical_and, logical_not, logical_xor, bitwise_or

Examples

>>> np.logical_or(True, False)
True
>>> np.logical_or([True, False], [False, False])
array([ True, False])

>>> x = np.arange(5)
>>> np.logical_or(x < 1, x > 3)
array([ True, False, False, False,  True])

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • numpy.geomspace

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明...

    于小勇
  • 理解CheckPoint及其在Tensorflow & Keras & Pytorch中的使用

    Checkpointing Tutorial for TensorFlow, Keras, and PyTorch

    于小勇
  • 数据压缩和归档(二)、zipfile

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...

    于小勇
  • Using Gaussian processes for regression降维之高斯过程

    In this recipe, we'll use the Gaussian process for regression. In the linear mod...

    到不了的都叫做远方
  • 聊聊flink的RpcServer

    flink-release-1.7.2/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/Rpc...

    codecraft
  • 锁的分类以及相关讲解

    Lock的使用 lock与synchronized的区别 lock 获取锁与释放锁的过程,都需要程序员手动的控制 Lock用的是乐观锁方式。

    Dream城堡
  • ReentrantLock实现原理同步状态源码

    一个会写诗的程序员
  • jdk7 AbstractQueuedSynchronizer(AQS) 应用分析

    //先拿ReentrantLock分析看看 public class ReentrantLock implements Lock, java.io.Serial...

    技术蓝海
  • 【2019年8月】OCP 071认证考试最新版本的考试原题-第14题

    A) The subquery is executed before the UPDATE statement is executed.

    用户5892232
  • 图像去噪--Noise2Noise: Learning Image Restoration without Clean Data

    Noise2Noise: Learning Image Restoration without Clean Data ICML 2018

    用户1148525

扫码关注云+社区

领取腾讯云代金券