torch.nn.functional.EmbeddingBagFunctionalOptions
export interface EmbeddingBagFunctionalOptions {
/** Only used when input is 1D. 1D tensor containing the starting index points for each bag in input. */
offsets?: Tensor;
/** If given, each embedding vector with norm larger than max_norm is renormalized to have norm max_norm. */
max_norm?: number;
/** The p of the p-norm to compute for the max_norm option. (default: 2.0) */
norm_type?: number;
/** If true, this will scale gradients by the inverse of frequency of the words in the mini-batch. (default: false) */
scale_grad_by_freq?: boolean;
/** "sum", "mean" or "max". Specifies the way to reduce the bag. (default: "mean") */
mode?: 'sum' | 'mean' | 'max';
/** If true, gradient w.r.t. weight matrix will be a sparse tensor. (default: false) */
sparse?: boolean;
/** a tensor of float weights to be multiplied with each element of the embedding bag. (default: undefined) */
per_sample_weights?: Tensor;
/** If true, offsets has one more element than the number of bags, with the last element being the number of elements in input. (default: false) */
include_last_offset?: boolean;
/** If specified, the entries at padding_idx do not contribute to the gradient; therefore, the embedding vector at padding_idx is not updated during training, i.e. it remains as a fixed "pad". */
padding_idx?: number;
}offsets(Tensor)optional- – Only used when input is 1D. 1D tensor containing the starting index points for each bag in input.
max_norm(number)optional- – If given, each embedding vector with norm larger than max_norm is renormalized to have norm max_norm.
norm_type(number)optional- – The p of the p-norm to compute for the max_norm option. (default: 2.0)
scale_grad_by_freq(boolean)optional- – If true, this will scale gradients by the inverse of frequency of the words in the mini-batch. (default: false)
mode('sum' | 'mean' | 'max')optional- – "sum", "mean" or "max". Specifies the way to reduce the bag. (default: "mean")
sparse(boolean)optional- – If true, gradient w.r.t. weight matrix will be a sparse tensor. (default: false)
per_sample_weights(Tensor)optional- – a tensor of float weights to be multiplied with each element of the embedding bag. (default: undefined)
include_last_offset(boolean)optional- – If true, offsets has one more element than the number of bags, with the last element being the number of elements in input. (default: false)
padding_idx(number)optional- – If specified, the entries at padding_idx do not contribute to the gradient; therefore, the embedding vector at padding_idx is not updated during training, i.e. it remains as a fixed "pad".
Options for embedding_bag functional operation.