Hi,
You can use matrix multiplication functions like matmul() which is quite general and handle arbitrary batching (mm and bmm are available as well if you want more specific functions).
You should use .unsqueeze() to add dimensions of size 1 such your dot product is actuall a matrix multiplication of 1xn @ nx1 matrices.