torch.nn.EmbeddingBagOptions
export interface EmbeddingBagOptions {
/** How to aggregate embeddings ('sum' | 'mean' | 'max', default: 'mean') */
mode?: 'sum' | 'mean' | 'max';
/** Fixed-to-zero embedding index for padding tokens */
padding_idx?: number;
/** Max norm constraint for embeddings (not yet fully implemented) */
max_norm?: number;
/** Type of norm (default: 2.0 for L2) */
norm_type?: number;
/** Scale gradients by token frequency */
scale_grad_by_freq?: boolean;
/** Sparse gradients flag (reserved) */
sparse?: boolean;
/** If true, offsets array includes final offset */
include_last_offset?: boolean;
}mode('sum' | 'mean' | 'max')optional- – How to aggregate embeddings ('sum' | 'mean' | 'max', default: 'mean')
padding_idx(number)optional- – Fixed-to-zero embedding index for padding tokens
max_norm(number)optional- – Max norm constraint for embeddings (not yet fully implemented)
norm_type(number)optional- – Type of norm (default: 2.0 for L2)
scale_grad_by_freq(boolean)optional- – Scale gradients by token frequency
sparse(boolean)optional- – Sparse gradients flag (reserved)
include_last_offset(boolean)optional- – If true, offsets array includes final offset
Options for EmbeddingBag layer