Converting Between LinearOperators and torch.Tensor

linear_operator.to_linear_operator(obj)[source]

A function which ensures that obj is a LinearOperator. - If obj is a LinearOperator, this function does nothing. - If obj is a (normal) Tensor, this function wraps it with a DenseLinearOperator.

Return type:

~linear_operator.operators._linear_operator.LinearOperator

linear_operator.to_dense(obj)[source]

A function which ensures that obj is a (normal) Tensor. - If obj is a Tensor, this function does nothing. - If obj is a LinearOperator, this function evaluates it.

Return type:

torch.Tensor