0
0

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 3 years have passed since last update.

torchvision.utils.make_gridの結合の順番を確認する

Posted at

なにこれ

  • torchvision.utils.make_gridで結合したテンソルが、縦横どちらに向かって結合されていくかを確認する
  • 結論:Zの字の方向に結合する。

実行するコード

  • save_imageはmake_gridを呼ぶ仕様なので、save_imageに直接tensorを渡す
  • 少しずつ濃くなるタイルを生成して、順番に並べる
import torch
from torchvision.utils import save_image
imgs = list()
for i in range(9):
    imgs.append(torch.ones([1, 64, 64])*i/10)
imgs = torch.stack(imgs)
save_image(imgs, "grid.png", 3)

出力

grid.png

結論

  • 左上から、行方向に進む
  • Zの字の方向に結合する。
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?