• Stacks a list of rank-R tf.Tensors into one rank-(R+1) tf.Tensor.

    const a = tf.tensor1d([1, 2]);
    const b = tf.tensor1d([3, 4]);
    const c = tf.tensor1d([5, 6]);
    tf.stack([a, b, c]).print();

    Type Parameters

    Parameters

    • tensors: (TensorLike | T)[]

      A list of tensor objects with the same shape and dtype.

    • Optional axis: number

      The axis to stack along. Defaults to 0 (the first dim).

    Returns Tensor

    Doc