import torch

a = torch.rand([4, 1, 28, 28])
print(a.shape)
print(a.unsqueeze(0).shape)
print(a.unsqueeze(-1).shape)
print(a.unsqueeze(4).shape)
print(a.unsqueeze(-4).shape)
print(a.unsqueeze(-5).shape)
# print(a.squeeze(5).shape)
a = torch.tensor([1.2, 2.3])
print(a.unsqueeze(-1))

print(a.unsqueeze(0))

b = torch.rand(32)
print(b.shape)
f = torch.rand(4, 32, 14, 14)
b=b.unsqueeze(1).unsqueeze(2).unsqueeze(0)
print(b.shape)
b=torch.rand(1,32,1,1)
print(b.shape)
print(b.squeeze().shape)
print(b.squeeze(0).shape)
print(b.squeeze(-1).shape)
print(b.squeeze(1).shape)
print(b.squeeze(-4).shape)
a=torch.rand(4,32,14,14)
print(a.shape)
print(b.shape)
print(b.expand(4, 32, 14, 14).shape)

print(b.expand(-1, 32, -1, -1).shape)
print(b.expand(-1, 32, -1, -4).shape)


fae2fd81ad0d27cc9cb550343a918cb2a7981b32
<mask token>

<mask token>
print(a.shape)
print(a.unsqueeze(0).shape)
print(a.unsqueeze(-1).shape)
print(a.unsqueeze(4).shape)
print(a.unsqueeze(-4).shape)
print(a.unsqueeze(-5).shape)
<mask token>
print(a.unsqueeze(-1))
print(a.unsqueeze(0))
<mask token>
print(b.shape)
<mask token>
print(b.shape)
<mask token>
print(b.shape)
print(b.squeeze().shape)
print(b.squeeze(0).shape)
print(b.squeeze(-1).shape)
print(b.squeeze(1).shape)
print(b.squeeze(-4).shape)
<mask token>
print(a.shape)
print(b.shape)
print(b.expand(4, 32, 14, 14).shape)
print(b.expand(-1, 32, -1, -1).shape)
print(b.expand(-1, 32, -1, -4).shape)

<mask token>
a = torch.rand([4, 1, 28, 28])
print(a.shape)
print(a.unsqueeze(0).shape)
print(a.unsqueeze(-1).shape)
print(a.unsqueeze(4).shape)
print(a.unsqueeze(-4).shape)
print(a.unsqueeze(-5).shape)
a = torch.tensor([1.2, 2.3])
print(a.unsqueeze(-1))
print(a.unsqueeze(0))
b = torch.rand(32)
print(b.shape)
f = torch.rand(4, 32, 14, 14)
b = b.unsqueeze(1).unsqueeze(2).unsqueeze(0)
print(b.shape)
b = torch.rand(1, 32, 1, 1)
print(b.shape)
print(b.squeeze().shape)
print(b.squeeze(0).shape)
print(b.squeeze(-1).shape)
print(b.squeeze(1).shape)
print(b.squeeze(-4).shape)
a = torch.rand(4, 32, 14, 14)
print(a.shape)
print(b.shape)
print(b.expand(4, 32, 14, 14).shape)
print(b.expand(-1, 32, -1, -1).shape)
print(b.expand(-1, 32, -1, -4).shape)

import torch
a = torch.rand([4, 1, 28, 28])
print(a.shape)
print(a.unsqueeze(0).shape)
print(a.unsqueeze(-1).shape)
print(a.unsqueeze(4).shape)
print(a.unsqueeze(-4).shape)
print(a.unsqueeze(-5).shape)
a = torch.tensor([1.2, 2.3])
print(a.unsqueeze(-1))
print(a.unsqueeze(0))
b = torch.rand(32)
print(b.shape)
f = torch.rand(4, 32, 14, 14)
b = b.unsqueeze(1).unsqueeze(2).unsqueeze(0)
print(b.shape)
b = torch.rand(1, 32, 1, 1)
print(b.shape)
print(b.squeeze().shape)
print(b.squeeze(0).shape)
print(b.squeeze(-1).shape)
print(b.squeeze(1).shape)
print(b.squeeze(-4).shape)
a = torch.rand(4, 32, 14, 14)
print(a.shape)
print(b.shape)
print(b.expand(4, 32, 14, 14).shape)
print(b.expand(-1, 32, -1, -1).shape)
print(b.expand(-1, 32, -1, -4).shape)

import torch

a = torch.rand([4, 1, 28, 28])
print(a.shape)
print(a.unsqueeze(0).shape)
print(a.unsqueeze(-1).shape)
print(a.unsqueeze(4).shape)
print(a.unsqueeze(-4).shape)
print(a.unsqueeze(-5).shape)
# print(a.squeeze(5).shape)
a = torch.tensor([1.2, 2.3])
print(a.unsqueeze(-1))

print(a.unsqueeze(0))

b = torch.rand(32)
print(b.shape)
f = torch.rand(4, 32, 14, 14)
b=b.unsqueeze(1).unsqueeze(2).unsqueeze(0)
print(b.shape)
b=torch.rand(1,32,1,1)
print(b.shape)
print(b.squeeze().shape)
print(b.squeeze(0).shape)
print(b.squeeze(-1).shape)
print(b.squeeze(1).shape)
print(b.squeeze(-4).shape)
a=torch.rand(4,32,14,14)
print(a.shape)
print(b.shape)
print(b.expand(4, 32, 14, 14).shape)

print(b.expand(-1, 32, -1, -1).shape)
print(b.expand(-1, 32, -1, -4).shape)

