# 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.

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...

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

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

• ### 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.

• ### 图像去噪--Noise2Noise: Learning Image Restoration without Clean Data

Noise2Noise: Learning Image Restoration without Clean Data ICML 2018