cornellius-gp / linear_operator

A LinearOperator implementation to wrap the numerical nuts and bolts of GPyTorch
MIT License
95 stars 28 forks source link

Register torch.linalg.solve_triangular with LinearOperator #29

Closed Balandat closed 2 years ago

Balandat commented 2 years ago

This is useful since in some torch code (such as in torch.distributions) torch.linalg.solve_triangular may be called on LinearOperator objects.

This PR shows nicely how the interface of having to pass properties of the tensor (such as upper/lower or whether it is unittriangular) to the function is rather awkward and encoding this on the tensors themselves simplifies a lot of the code for the user (cc @lezcano). For the purpose of registering the function, we need to deal with those args; I chose here to raise informative error messages when the args are inconsistent with the properties of the LinearOperator object.