poprox_recommender.pytorch#
Utility functions for implementing POPROX recommender components with PyTorch.
- poprox_recommender.pytorch.assert_tensor_size(tensor, *size, label=None, prefix=True)#
Check that a tensor is of the expected size, and fail with an assertion error if it is the incorrect size.
- poprox_recommender.pytorch.torch_inference(func)#
Decorator for functions or methods that use PyTorch for inference (an thus
torch.inference_mode()
should be set for performance). It wraps the function in the following logic:with torch.inference_mode(): func()
Modules
Data-checking routines. |
|
Decorators to help with Torch usage. |