UNPKG

847 BTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/add" />
2import { Tensor } from '../tensor';
3import { TensorLike } from '../types';
4/**
5 * Adds two `tf.Tensor`s element-wise, A + B. Supports broadcasting.
6 *
7 *
8 * ```js
9 * const a = tf.tensor1d([1, 2, 3, 4]);
10 * const b = tf.tensor1d([10, 20, 30, 40]);
11 *
12 * a.add(b).print(); // or tf.add(a, b)
13 * ```
14 *
15 * ```js
16 * // Broadcast add a with b.
17 * const a = tf.scalar(5);
18 * const b = tf.tensor1d([10, 20, 30, 40]);
19 *
20 * a.add(b).print(); // or tf.add(a, b)
21 * ```
22 * @param a The first `tf.Tensor` to add.
23 * @param b The second `tf.Tensor` to add. Must have the same type as `a`.
24 *
25 * @doc {heading: 'Operations', subheading: 'Arithmetic'}
26 */
27declare function add_<T extends Tensor>(a: Tensor | TensorLike, b: Tensor | TensorLike): T;
28export declare const add: typeof add_;
29export {};