I have a tensor with channel_last format. I need to do some transformation as below:
a = torch.empty((10, 3, 32, 32), memory_format=torch.channels_last)
a.reshape(10, -1, 16).permute(0, 2, 1).contiguous()

However, in this way, I need to do 2 memory copy in reshape and contiguous specifically. Is it possible to save one memory copy?