pytensor
pytensor copied to clipboard
Do we need dot Op to handle the vector cases?
Description
A matrix vector dot or a vector dot matrix can be represented as a matrix - col/row dot followed by a squeeze of the useless dims.
I don't think we're making any special use of of the vector cases and it creates more versions of equivalent graphs for us to handle. For instance we have a special blockwise for the matrix matrix dot but not the other cases. We wouldn't need to if our core dot Op only did matrix matrix.
We already do this rewrite anyway here, so why not use that as the canonical representation?
https://github.com/pymc-devs/pytensor/blob/ad27dc752798dfb75ed8d1c0a9b840859a8a898d/pytensor/tensor/rewriting/blas.py#L575
Only reason I can see is if different routines wil be triggered for the special vector cases? I would be surprised if our backends didn't have special handling though :)