“Contoh Torch.Stack” Kode Jawaban

Contoh Torch.Stack

a.size()  # 2, 3, 4
b.size()  # 2, 3
b = torch.unsqueeze(b, dim=2)  # 2, 3, 1
# torch.unsqueeze(b, dim=-1) does the same thing

torch.stack([a, b], dim=2)  # 2, 3, 5
Disturbed Dolphin

Torch.Stack

> torch.stack(
    (t1,t2,t3)
    ,dim=0
)
tensor([[1, 1, 1],
        [2, 2, 2],
        [3, 3, 3]])
Disturbed Dolphin

Jawaban yang mirip dengan “Contoh Torch.Stack”

Pertanyaan yang mirip dengan “Contoh Torch.Stack”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya