UNPKG

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