opennmt/data/noise.py
def random_mask(shape, probability):
    """Generates a random boolean mask.

    Args:
      shape: The mask shape.
      probability: The probability to select an element.

    Returns:
      A boolean mask with shape :obj:`shape`.
    """
    probs = tf.random.uniform(shape, maxval=1)
    mask = tf.math.less(probs, probability)
    return mask
Generates a random boolean mask.

    Args:
      shape: The mask shape.
      probability: The probability to select an element.

    Returns:
      A boolean mask with shape :obj:`shape`.
    
Generates a random boolean mask.
Generates a random boolean mask .
def random_mask(shape, probability):
    probs = tf.random.uniform(shape, maxval=1)
    mask = tf.math.less(probs, probability)
    return mask
def random_mask ( shape , probability ) : probs = tf . random . uniform ( shape , maxval = 1 ) mask = tf . math . less ( probs , probability ) return mask
Generates a random boolean mask.
Generates a random boolean mask .
"""Generates a random boolean mask.

    Args:
      shape: The mask shape.
      probability: The probability to select an element.

    Returns:
      A boolean mask with shape :obj:`shape`.
    """
A boolean mask with shape :obj:`shape`.
A boolean mask with shape : obj : ` shape ` .
shape
The mask shape.
The mask shape .
probability
The probability to select an element.
The probability to select an element .