Open Balandat opened 5 years ago
@Balandat this seems very reasonable. Rather than numel
, I would do self.matrix_shape.numel()
as the check, which would then use Cholesky on large batches of small matrices.
Closed by #423
Reopening this so we can dig deeper and determine a better default schedule for selecting between the two mechanisms.
Currently,
root_decomposition
fails for LazyTensors with a single element with an obscure index error (except for DiagLazyTensor, where it is special-cased). More generally, the iterative low-rank approximation algorithm is quite wasteful to use for small matrix sizes - performing a Cholesky decomposition on the evaluated LazyTensor can be much faster (see this nb: root_decomposition_perf.ipynb.txt)We should dig some more into this and do a more thorough analysis. I suggest once we have done this we can just choose whether to perform a cholesky decomposition or instead use the iterative algorithm depending on the size of the tensor.
In fact, for now I will push a small fix that does this for all cases with
n * n < 250
or so.cc @bkarrer