mars.tensor.add(x1, x2, out=None, where=None, **kwargs)[source]

Add arguments element-wise.

x1, x2 : array_like
The tensors to be added. If x1.shape != x2.shape, they must be broadcastable to a common shape (which may be the shape of one or the other).
out : Tensor, None, or tuple of Tensor 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 tensor is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
where : array_like, optional
Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.


add : Tensor or scalar
The sum of x1 and x2, element-wise. Returns a scalar if both x1 and x2 are scalars.

Equivalent to x1 + x2 in terms of tensor broadcasting.

>>> import mars.tensor as mt
>>> mt.add(1.0, 4.0).execute()
>>> x1 = mt.arange(9.0).reshape((3, 3))
>>> x2 = mt.arange(3.0)
>>> mt.add(x1, x2).execute()
array([[  0.,   2.,   4.],
       [  3.,   5.,   7.],
       [  6.,   8.,  10.]])