cornellius-gp / linear_operator

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

Introduce reshape #32

Closed Balandat closed 2 years ago

Balandat commented 2 years ago

This function is used ubiquitously with tensors, so in order to make LinearOperator a drop-in replacement for tensors we need to use it.

reshape (other than view) will reallocate new memory if necessary - this concept doesn't really make a to of sense for LinearOperators, so a straightforward thing to do is just to make this an alias for expand and not allow reshaping the last two (non-batch) dimensions for now. The current implementation of course only makes sense for square LinearOperators (or rather operators where the non-batch dimensions don't change).