Skip to content
Advertisement

Tag: linear-algebra

np.linalg.multi_dot for R

I’m trying to do a nested dot result is effectively x.dot(M.dot(M)): In python this loop can be reduced by: Is there something similar for R? Answer As @akrun commented, you could also use Reduce:

How does pytorch broadcasting work?

produces a Tensor with size: torch.Size([4,4]). Can someone provide a logic behind this? Answer PyTorch broadcasting is based on numpy broadcasting semantics which can be understood by reading numpy broadcasting rules or PyTorch broadcasting guide. Expounding the concept with an example would be intuitive to understand it better. So, please see the example below: Now for torch.add(t_rand, t_ones), visualize it

Advertisement