There’s no way to avoid the permute calls, although you can use .t() (transpose) instead of permute(1, 0). Typically we have the left-most dimension as the batch dimension.
Greg is working on NumPy-style broadcasting which will make the unsqueeze calls unnecessary.