Shortcuts

torcharrow.functional.sigrid_hash

torcharrow.functional.sigrid_hash(value_col: NumericalColumn, salt: int, max_value: int)

Apply hashing to an index, or a list of indicies. This is a common operation in the recommendation domain in order to have valid inputs for shrunken embedding tables.

Parameters:
  • value_col (Numeric column that defines indicies) –

  • salt (Value used to intialize the random hashing process) –

  • max_value (values will be hashed in the range of [0, max_value)) –

Examples

>>> import torcharrow as ta
>>> from torcharrow import functional
>>> a = ta.column([1, 2, 3, 5, 8, 10, 11])
>>> functional.sigrid_hash(a, 0, 100)
0  60
1  54
2  54
3   4
4  67
5   2
6  25
dtype: Int64(nullable=True), length: 7, null_count: 0

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources