10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyTorchでlist(torch.Tensor, torch.Tensor, ...)をtorch.Tensorにまとめる

Posted at

全ての要素がlistで完結しているなら何も問題はないと思いますが、tensor in list -> tensorsの際にひっかかったため
なお、list内のtensorは全て同じshapeを持つとします。

arrs = [torch.Tensor(), torch.Tensor(), torch.Tensor(), ...]
arrs = torch.cat(arrs).reshape(len(arrs), *arrs[0].shape)
10
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?