Back

torch.stack作用分析

torch.stack作用分析

语法

torch.stack(tensors, dim=0, *, out=None) –> Tensor

作用

Concatenates a sequence of tensors along a new dimension.
All tensor need to be of the same size

将一个序列的tensor在新的一维上concatenate起来,所有tensor的shape需要相同。

Parameters

  • tensors(sequence of Tensors) – sequence of tensors to concatenate
  • dim(int) – dimension to insert. Has to be between 0 and the number of dimensions of concanated tensors.

Keyword Arguments

  • out(Tensor, optional) – the output tensor.
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy