tf.contrib.seq2seq.CustomHelper
Stay organized with collections
Save and categorize content based on your preferences.
Base abstract class that allows the user to customize sampling.
Inherits From: Helper
tf.contrib.seq2seq.CustomHelper(
initialize_fn, sample_fn, next_inputs_fn, sample_ids_shape=None,
sample_ids_dtype=None
)
Args |
initialize_fn
|
callable that returns (finished, next_inputs)
for the first iteration.
|
sample_fn
|
callable that takes (time, outputs, state)
and emits tensor sample_ids .
|
next_inputs_fn
|
callable that takes (time, outputs, state, sample_ids)
and emits (finished, next_inputs, next_state) .
|
sample_ids_shape
|
Either a list of integers, or a 1-D Tensor of type
int32 , the shape of each value in the sample_ids batch. Defaults to
a scalar.
|
sample_ids_dtype
|
The dtype of the sample_ids tensor. Defaults to int32.
|
Attributes |
batch_size
|
Batch size of tensor returned by sample .
Returns a scalar int32 tensor.
|
sample_ids_dtype
|
DType of tensor returned by sample .
Returns a DType.
|
sample_ids_shape
|
Shape of tensor returned by sample , excluding the batch dimension.
Returns a TensorShape .
|
Methods
initialize
View source
initialize(
name=None
)
Returns (initial_finished, initial_inputs)
.
View source
next_inputs(
time, outputs, state, sample_ids, name=None
)
Returns (finished, next_inputs, next_state)
.
sample
View source
sample(
time, outputs, state, name=None
)
Returns sample_ids
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.seq2seq.CustomHelper\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L168-L224) |\n\nBase abstract class that allows the user to customize sampling.\n\nInherits From: [`Helper`](../../../tf/contrib/seq2seq/Helper) \n\n tf.contrib.seq2seq.CustomHelper(\n initialize_fn, sample_fn, next_inputs_fn, sample_ids_shape=None,\n sample_ids_dtype=None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `initialize_fn` | callable that returns `(finished, next_inputs)` for the first iteration. |\n| `sample_fn` | callable that takes `(time, outputs, state)` and emits tensor `sample_ids`. |\n| `next_inputs_fn` | callable that takes `(time, outputs, state, sample_ids)` and emits `(finished, next_inputs, next_state)`. |\n| `sample_ids_shape` | Either a list of integers, or a 1-D Tensor of type `int32`, the shape of each value in the `sample_ids` batch. Defaults to a scalar. |\n| `sample_ids_dtype` | The dtype of the `sample_ids` tensor. Defaults to int32. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------------|------------------------------------------------------------------------------------------------------|\n| `batch_size` | Batch size of tensor returned by `sample`. \u003cbr /\u003e Returns a scalar int32 tensor. |\n| `sample_ids_dtype` | DType of tensor returned by `sample`. \u003cbr /\u003e Returns a DType. |\n| `sample_ids_shape` | Shape of tensor returned by `sample`, excluding the batch dimension. \u003cbr /\u003e Returns a `TensorShape`. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `initialize`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L208-L213) \n\n initialize(\n name=None\n )\n\nReturns `(initial_finished, initial_inputs)`.\n\n### `next_inputs`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L220-L224) \n\n next_inputs(\n time, outputs, state, sample_ids, name=None\n )\n\nReturns `(finished, next_inputs, next_state)`.\n\n### `sample`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L215-L218) \n\n sample(\n time, outputs, state, name=None\n )\n\nReturns `sample_ids`."]]