UNPKG

1.35 kBTypeScriptView Raw
1import { Tensor } from '../tensor';
2import { TensorLike } from '../types';
3/**
4 * Concatenates a list of `tf.Tensor`s along a given axis.
5 *
6 * The tensors ranks and types must match, and their sizes must match in all
7 * dimensions except `axis`.
8 *
9 * Also available are stricter rank-specific methods that assert that
10 * `tensors` are of the given rank:
11 * - `tf.concat1d`
12 * - `tf.concat2d`
13 * - `tf.concat3d`
14 * - `tf.concat4d`
15 *
16 * Except `tf.concat1d` (which does not have axis param), all methods have
17 * same signature as this method.
18 *
19 * ```js
20 * const a = tf.tensor1d([1, 2]);
21 * const b = tf.tensor1d([3, 4]);
22 * a.concat(b).print(); // or a.concat(b)
23 * ```
24 *
25 * ```js
26 * const a = tf.tensor1d([1, 2]);
27 * const b = tf.tensor1d([3, 4]);
28 * const c = tf.tensor1d([5, 6]);
29 * tf.concat([a, b, c]).print();
30 * ```
31 *
32 * ```js
33 * const a = tf.tensor2d([[1, 2], [10, 20]]);
34 * const b = tf.tensor2d([[3, 4], [30, 40]]);
35 * const axis = 1;
36 * tf.concat([a, b], axis).print();
37 * ```
38 * @param tensors A list of tensors to concatenate.
39 * @param axis The axis to concate along. Defaults to 0 (the first dim).
40 *
41 * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}
42 */
43declare function concat_<T extends Tensor>(tensors: Array<T | TensorLike>, axis?: number): T;
44export declare const concat: typeof concat_;
45export {};