Your input seems to be created in a channels-last memory layout, while PyTorch expects channels-first tensors in the shape [batch_size, channels, height, width].
Assuming your current input has the shape [batch_size, height, width, channels] you could permute the input tensor via:
x = x.permute(0, 3, 1, 2)