I am having similary problems:
Warning: grad and param do not obey the gradient layout contract. This is not an error, but may impair performance.
grad.sizes() = [256, 64, 1, 1], strides() = [64, 1, 1, 1]
param.sizes() = [256, 64, 1, 1], strides() = [64, 1, 64, 64] (function operator())
I am using pretrained resnet50 within my model. Considering the dimension, I believe it is related to the resnet part.