megengine.functional.add¶
- add(x, y)[源代码]¶
Element-wise addition.
实际案例
import numpy as np from megengine import tensor import megengine.functional as F x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3)) y = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3)) out = F.add(x, y) print(out.numpy())
输出:
[[ 0. 2. 4.] [ 6. 8. 10.]]