code: def test_methods_handle_masked_inputs(self):
      num_param_samples = 5
      num_timesteps = 4
      num_steps_forecast = 2
  
      # Build a time series with `NaN`s that will propagate if not properly
      # masked.
      observed_time_series_ = np.random.randn(num_timesteps)
      is_missing_ = np.random.randn(num_timesteps) > 0
      observed_time_series_[is_missing_] = np.nan
      observed_time_series = missing_values_util.MaskedTimeSeries(
          self._build_tensor(observed_time_series_),
          is_missing=self._build_tensor(is_missing_, dtype=np.bool_),
      )
  
      model = self._build_model(observed_time_series)
      prior_samples = [
          param.prior.sample(
              num_param_samples, seed=test_util.test_seed()
          )
          for param in model.parameters
      ]
  
      forecast_dist = forecast.forecast(
          model,
          observed_time_series,
          parameter_samples=prior_samples,
          num_steps_forecast=num_steps_forecast,
      )
  
      forecast_mean_, forecast_stddev_ = self.evaluate(
          (forecast_dist.mean(), forecast_dist.stddev())
      )
      self.assertTrue(np.all(np.isfinite(forecast_mean_)))
      self.assertTrue(np.all(np.isfinite(forecast_stddev_)))
  
      onestep_dist = forecast.one_step_predictive(
          model, observed_time_series, parameter_samples=prior_samples
      )
      onestep_mean_, onestep_stddev_ = self.evaluate(
          (onestep_dist.mean(), onestep_dist.stddev())
      )
      self.assertTrue(np.all(np.isfinite(onestep_mean_)))
      self.assertTrue(np.all(np.isfinite(onestep_stddev_)))
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.sts import fitting
  from tensorflow_probability.python.sts import forecast
  from tensorflow_probability.python.sts.components import seasonal
  from tensorflow_probability.python.sts.components import sum
  from tensorflow_probability.python.sts.internal import missing_values_util
label_desc: Use image node_id 7 for calling the _ForecastTest obj's underlying member method code with example usage: obj.test_methods_handle_masked_inputs() without return types