Return the inner product between two tensors

def inner(tensor0: BKTensor, tensor1: BKTensor) -> BKTensor:
    """Return the inner product between two tensors"""
    N = torch.numel(tensor0[0])
    tensor0_real = tensor0[0].contiguous().view(N)
    tensor0_imag = tensor0[1].contiguous().view(N)
    tensor1_real = tensor1[0].contiguous().view(N)
    tensor1_imag = tensor1[1].contiguous().view(N)

    res = (torch.matmul(tensor0_real, tensor1_real)
           + torch.matmul(tensor0_imag, tensor1_imag),
           torch.matmul(tensor0_real, tensor1_imag)
           - torch.matmul(tensor0_imag, tensor1_real))

    return _DTYPE(res)