lenskit.torch#

PyTorch utility functions.

Functions

inference_mode(func)

Function decorator that puts PyTorch in inference mode.

sparse_row(mat, row)

Get a row of a sparse (CSR) tensor.

lenskit.torch.inference_mode(func)#

Function decorator that puts PyTorch in inference mode.

lenskit.torch.sparse_row(mat, row)#

Get a row of a sparse (CSR) tensor. This is needed because indexing a tensor does not work in inference mode.

Parameters:
Return type:

Tensor