Warning
This page was created from a pull request.
jax.numpy.add¶
-
jax.numpy.
add
(x1, x2)¶ Add arguments element-wise.
LAX-backend implementation of
add()
. Original docstring below.add(x1, x2, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj])
- Parameters
x2 (x1,) – The arrays to be added. If
x1.shape != x2.shape
, they must be broadcastable to a common shape (which becomes the shape of the output).- Returns
add – The sum of x1 and x2, element-wise. This is a scalar if both x1 and x2 are scalars.
- Return type
ndarray or scalar
Notes
Equivalent to x1 + x2 in terms of array broadcasting.
Examples
>>> np.add(1.0, 4.0) 5.0 >>> x1 = np.arange(9.0).reshape((3, 3)) >>> x2 = np.arange(3.0) >>> np.add(x1, x2) array([[ 0., 2., 4.], [ 3., 5., 7.], [ 6., 8., 10.]])