The output result is:
Vector a: tensor([1., 2., 3.])Vector b: tensor([4., 5., 6.])Inner product result: tensor(32.)
Example - Matrix Inner Product
import torch
# Create two matrices
A = torch.randn(2,3)
B = torch.randn(2,3)
# Compute inner product on the last dimension
result = torch.inner(A, B)
print("A Shape:", A.shape)
print("B Shape:", B.shape)
print("Result Shape:", result.shape)
YouTip