Spatial Orientation preserved with tensor.view() after convolutional layer

I have a question regarding pytorch tensor.view() function which I couldn’t confirm after googling.

a = torch.view(-1, C, H, W)
encoder = nn.Conv2d(C, C_out, 3, stride=2) 
a = encoder(a)
_, C_out, H_out, W_out = a.size()
a = a.view(B, S, C_out, H_out, W_out)

So will this sequence of operations preserve the spatial orientation of a at the end?

Hi @hmishfaq,

Were you able to use this successfully?