`def least_square(from_p, to_p, dim=-1): to_p = to_p.float() beta = (to_p * from_p).sum(dim=dim, keepdim=True) / (from_p **2).sum(dim=dim, keepdim=True) return beta ` Why use the product form (to_p and from_p) instead of the subtraction form?
`def least_square(from_p, to_p, dim=-1):
to_p = to_p.float()
`
Why use the product form (to_p and from_p) instead of the subtraction form?