nnf_embedding_bag {torch} | R Documentation |
Embedding_bag
Description
Computes sums, means or maxes of bags
of embeddings, without instantiating the
intermediate embeddings.
Usage
nnf_embedding_bag(
input,
weight,
offsets = NULL,
max_norm = NULL,
norm_type = 2,
scale_grad_by_freq = FALSE,
mode = "mean",
sparse = FALSE,
per_sample_weights = NULL,
include_last_offset = FALSE,
padding_idx = NULL
)
Arguments
input |
(LongTensor) Tensor containing bags of indices into the embedding matrix |
weight |
(Tensor) The embedding matrix with number of rows equal to the maximum possible index + 1, and number of columns equal to the embedding size |
offsets |
(LongTensor, optional) Only used when |
max_norm |
(float, optional) If given, each embedding vector with norm
larger than |
norm_type |
(float, optional) The |
scale_grad_by_freq |
(boolean, optional) if given, this will scale gradients
by the inverse of frequency of the words in the mini-batch. Default |
mode |
(string, optional) |
sparse |
(bool, optional) if |
per_sample_weights |
(Tensor, optional) a tensor of float / double weights,
or NULL to indicate all weights should be taken to be 1. If specified,
|
include_last_offset |
(bool, optional) if |
padding_idx |
(int, optional) If given, pads the output with the embedding
vector at |