A sampler for use during inference.

sampler_sample_embedding(
  embedding_fn = NULL,
  softmax_temperature = NULL,
  seed = NULL
)

Arguments

embedding_fn

(Optional) A callable that takes a vector tensor of ids (argmax ids), or the params argument for embedding_lookup. The returned tensor will be passed to the decoder input.

softmax_temperature

(Optional) float32 scalar, value to divide the logits by before computing the softmax. Larger values (above 1.0) result in more random samples, while smaller values push the sampling distribution towards the argmax. Must be strictly greater than 0. Defaults to 1.0.

seed

(Optional) The sampling seed.

Value

None

Details

Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input.