Let me guess…
Do you mean
u -> (A, B, batch_1, batch_2)
b -> (B, A, batch_1, batch_2)
result -> (A, A, batch_1, batch_2)

which result[:, :, i, j] equals to u[:, :, i, j] @ v[:, :, i, j]?
Just like a 4-dim bmm?