class_docstr: Event space bijector for Masked distributions.
class_docstr_tok: ["Event","space","bijector","for","Masked","distributions","."]
code: def _make_safe_y(self, y, validity_mask):
      safe_val = tf.stop_gradient(
          self._masked.safe_sample_fn(self._masked.distribution)
      )
      event_mask = _add_event_dims_to_mask(
          validity_mask, dist=self._masked
      )
      return tf.where(event_mask, y, safe_val)
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import batch_broadcast
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import auto_composite_tensor
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
label_desc: Use image node_id 9 for calling the _NonCompositeTensorMaskedBijector obj's underlying member method code with example usage: obj._make_safe_y(y, validity_mask) and returns: tf