poprox_recommender.pytorch.datachecks#

Data-checking routines.

Functions

assert_tensor_size(tensor, *size[, label, ...])

Check that a tensor is of the expected size, and fail with an assertion error if it is the incorrect size.

poprox_recommender.pytorch.datachecks.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.

Parameters:
  • tensor (Tensor) – The tensor to check.

  • *size (int) – The expected size of the tensor.

  • label (str | None) – A label for the tensor.

  • prefix (bool) – If True and the tensor has more dimensions than the expected size, only match the common prefix of dimensions.