# Execute baddbmm
result = torch.baddbmm(input, batch1, batch2)
print("Input Batch Matrix Shape:",input.shape)
print("Batch Matrix 1 Shape:", batch1.shape)
print("Batch Matrix 2 Shape:", batch2.shape)
print("Result Shape:", result.shape)
print(result)# Print First Result
Output result is:
Input Batch Matrix Shape: torch.Size([10, 3, 3])Batch Matrix 1 Shape: torch.Size([10, 3, 4])Batch Matrix 2 Shape: torch.Size([10, 4, 3])Result Shape: torch.Size([10, 3, 3]) tensor([[-1.0917, 0.0174, -0.6599], [ 1.0403, -0.3905, -0.6314], [ 0.0988, -0.3047, 0.4841]])
Pytorch torch Reference Manual