HashEmbeddingBagCollection

Function

Creates a single-server table object with pooling and hash mapping.

Prototype

1
2
class HashEmbeddingBagCollection:
 def __init__(**kwargs):

Parameters

Parameter

Data Type

Mandatory/Optional

Description

tables

List[HashEmbeddingBagConfig | EmbeddingBagConfig]

Mandatory

List of sparse table configuration files. The value range of the list length is [1, 10000].

For details about the value range, see that of HashEmbeddingBagConfig.

is_weighted

bool

Optional

Only the default value False is supported.

device

str or torch.device

Optional

Device of a sparse table. The default value is torch.device("cpu").

  • If the value is a string, the options are as follows:
    • "npu": NPU device.
    • "meta": Meta device.
    • "cpu": CPU device.

      The CPU device does not support distributed tables and supports only standalone tables.

  • If the value is a torch.device, the options are as follows:
    • torch.device("npu"): NPU device.
    • torch.device ("meta"): Meta device.
    • torch.device ("cpu"): CPU device.

      The CPU device does not support distributed tables and supports only standalone tables.

Example

1
ebc = HashEmbeddingBagCollection(device="npu", tables=table_configs)

See Also

For details about the API call sequence and example, see Porting and Training.