parameters: (activations, targets, sequence_lengths)
docstring: Remove entries outside `sequence_lengths` and returned flattened results.
  
    Args:
      activations: output of the RNN, shape `[batch_size, padded_length, k]`.
      targets: target values, shape `[batch_size, padded_length]`.
      sequence_lengths: a `Tensor` of shape `[batch_size]` with the unpadded
        length of each sequence. If `None`, then each sequence is unpadded.
  
    Returns:
      activations_masked: `logit` values with those beyond `sequence_lengths`
      removed for each batch. Batches are then concatenated. Shape
        `[tf.sum(sequence_lengths), k]` if `sequence_lengths` is not `None` and
        shape `[batch_size * padded_length, k]` otherwise.
      targets_masked: target values after removing unneeded entries. Shape
        `[tf.sum(sequence_lengths)]` if `sequence_lengths` is not `None` and shape
        `[batch_size * padded_length]` otherwise.
docstring_summary: Remove entries outside `sequence_lengths` and returned flattened results.
docstring_tokens: Remove entries outside sequence_lengths and returned flattened results .
function: def _mask_activations_and_targets(activations, targets, sequence_lengths):
    """Remove entries outside `sequence_lengths` and returned flattened results.
  
    Args:
      activations: output of the RNN, shape `[batch_size, padded_length, k]`.
      targets: target values, shape `[batch_size, padded_length]`.
      sequence_lengths: a `Tensor` of shape `[batch_size]` with the unpadded
        length of each sequence. If `None`, then each sequence is unpadded.
  
    Returns:
      activations_masked: `logit` values with those beyond `sequence_lengths`
      removed for each batch. Batches are then concatenated. Shape
        `[tf.sum(sequence_lengths), k]` if `sequence_lengths` is not `None` and
        shape `[batch_size * padded_length, k]` otherwise.
      targets_masked: target values after removing unneeded entries. Shape
        `[tf.sum(sequence_lengths)]` if `sequence_lengths` is not `None` and shape
        `[batch_size * padded_length]` otherwise.
    """
    with ops.name_scope('mask_activations_and_targets',
                        values=[activations, targets, sequence_lengths]):
      targets_shape = array_ops.shape(targets)
      batch_size = targets_shape[0]
      padded_length = targets_shape[1]
      if sequence_lengths is None:
        flattened_dimension = padded_length * batch_size
        activations_masked = array_ops.reshape(activations,
                                               [flattened_dimension, -1])
        targets_masked = array_ops.reshape(targets, [flattened_dimension])
      else:
        mask = _padding_mask(sequence_lengths, padded_length)
        activations_masked = array_ops.boolean_mask(activations, mask)
        targets_masked = array_ops.boolean_mask(targets, mask)
      return activations_masked, targets_masked
function_tokens: def _mask_activations_and_targets ( activations , targets , sequence_lengths ) : with ops . name_scope ( 'mask_activations_and_targets' , values = [ activations , targets , sequence_lengths ] ) : targets_shape = array_ops . shape ( targets ) batch_size = targets_shape [ 0 ] padded_length = targets_shape [ 1 ] if sequence_lengths is None : flattened_dimension = padded_length * batch_size activations_masked = array_ops . reshape ( activations , [ flattened_dimension , - 1 ] ) targets_masked = array_ops . reshape ( targets , [ flattened_dimension ] ) else : mask = _padding_mask ( sequence_lengths , padded_length ) activations_masked = array_ops . boolean_mask ( activations , mask ) targets_masked = array_ops . boolean_mask ( targets , mask ) return activations_masked , targets_masked