Tensor A has N*F elements
Tensor B has N*F elements
Tensor C will have N*N*F*2 elements. I would have expected you to want N*F*2 elements in C.
If you wanted C to have shape (N, 2*F) then torch.cat([A, B], dim=1) would do.