get_sampling_probability
- opennmt.decoders.get_sampling_probability(step, read_probability=None, schedule_type=None, k=None)[source]
Returns the sampling probability as described in https://arxiv.org/abs/1506.03099.
- Parameters
step – The training step.
read_probability – The probability to read from the inputs.
schedule_type – The type of schedule: “constant”, “linear”, “exponential”, or “inverse_sigmoid”.
k – The convergence constant.
- Returns
The probability to sample from the output ids as a 0D
tf.Tensor
orNone
if scheduled sampling is not configured.- Raises
ValueError – if
schedule_type
is set but notk
or ifschedule_type
islinear
but an initialread_probability
is not set.TypeError – if
schedule_type
is invalid.