RuntimeError: The expanded size of the tensor (7) must match the existing size (128) at non-singleton dimension 3
When I run AdaIN code
def adaptive_instance_normalization(content_feat, style_mean, style_std):
    size = content_feat.size()
    content_mean, content_std = calc_mean_std(content_feat)

    normalized_feat = (content_feat - content_mean.expand(
        size)) / content_std.expand(size)
    return normalized_feat * style_std.expand(size) + style_mean.expand(size)

I got the following error
RuntimeError: The expanded size of the tensor (7) must match the existing size (128) at non-singleton dimension 3.  Target sizes: [100, 128, 7, 7].  Tensor sizes: [100, 128]

You should be more precise and descriptive while explaining your issue. You cannot expect from people to read your mind or be familiar with your exact problem. So first, what should be the expected output and which line is failing ? I guess from the expand calls that you would like to enable broadcasting. Unfortunately, as you can read it from the official documentation, expand works the same as usual broadcasting, and add the required extra dimensions at the beginning, not the end.
So you should use reshape(size[:2] + (1, 1)) in place of expand(size).
