# tf.contrib.seq2seq.Helper

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L122-L165) |

Interface for implementing sampling in seq2seq decoders.

Helper instances are used by `BasicDecoder`.

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `batch_size` | Batch size of tensor returned by `sample`. <br /> Returns a scalar int32 tensor. |
| `sample_ids_dtype` | DType of tensor returned by `sample`. <br /> Returns a DType. |
| `sample_ids_shape` | Shape of tensor returned by `sample`, excluding the batch dimension. <br /> Returns a `TensorShape`. |

<br />

## Methods

### `initialize`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L152-L155)

    @abc.abstractmethod
    initialize(
        name=None
    )

Returns `(initial_finished, initial_inputs)`.

### `next_inputs`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L162-L165)

    @abc.abstractmethod
    next_inputs(
        time, outputs, state, sample_ids, name=None
    )

Returns `(finished, next_inputs, next_state)`.

### `sample`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/seq2seq/python/ops/helper.py#L157-L160)

    @abc.abstractmethod
    sample(
        time, outputs, state, name=None
    )

Returns `sample_ids`.