A quick fix is to do

int(old_linear_layer.out_features)

I think there is an issue during model initialization.
In https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/linear.py#L47 69 we directly assing out_features as it is instead of typecasting to int and that creates this problem.
Will follow up further with this issue.