embedding_lookup: Look up words embeddings for id tensor

View source: R/modeling.R

embedding_lookupR Documentation

Look up words embeddings for id tensor

Description

Look up words embeddings for id tensor

Usage

embedding_lookup(
  input_ids,
  vocab_size,
  embedding_size = 128L,
  initializer_range = 0.02,
  word_embedding_name = "word_embeddings"
)

Arguments

input_ids

Integer Tensor of shape [batch_size, seq_length] containing word ids.

vocab_size

Size of the embedding vocabulary (integer).

embedding_size

Width of the word embeddings (integer).

initializer_range

Embedding initialization range (float).

word_embedding_name

Name of the embedding table (character).

Value

Float Tensor of shape [batch_size, seq_length, embedding_size], along with the embedding table in a list.

Examples

## Not run: 
with(
  tensorflow::tf$variable_scope("examples",
    reuse = tensorflow::tf$AUTO_REUSE
  ),
  ids <- tensorflow::tf$get_variable("x",
    dtype = "int32",
    shape = tensorflow::shape(10, 20)
  )
)
embedding_lookup(ids, vocab_size = 100, word_embedding_name = "some_name")

## End(Not run)

jonathanbratt/RBERT documentation built on Jan. 26, 2023, 4:15 p.m.