view only works on tensors which are contiguous in memory, so in general you have to write .contiguous().view(sizes)
Also, the Bottle mixin in the SNLI model script (in the examples repo) may do more or less what you’re looking for, at least for some layers (nn.Bottle was the name for this in Torch7)