# tf.contrib.seq2seq.CustomHelper

<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#L168-L224) |

Base abstract class that allows the user to customize sampling.

Inherits From: [`Helper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/seq2seq/Helper)

    tf.contrib.seq2seq.CustomHelper(
        initialize_fn, sample_fn, next_inputs_fn, sample_ids_shape=None,
        sample_ids_dtype=None
    )

<br />

<br />

<br />

| ## 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. |

<br />

<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#L208-L213)

    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#L220-L224)

    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#L215-L218)

    sample(
        time, outputs, state, name=None
    )

Returns `sample_ids`.