code: def _get_contour_predictions(
      model: ModelBridge,
      x_param_name: str,
      y_param_name: str,
      metric: str,
      generator_runs_dict: TNullableGeneratorRunsDict,
      density: int,
      slice_values: Optional[Dict[str, Any]] = None,
      fixed_features: Optional[ObservationFeatures] = None,
  ) -> ContourPredictions:
      """
      slice_values is a dictionary {param_name: value} for the parameters that
      are being sliced on.
      """
      x_param = get_range_parameter(model, x_param_name)
      y_param = get_range_parameter(model, y_param_name)
  
      plot_data, _, _ = get_plot_data(
          model,
          generator_runs_dict or {},
          {metric},
          fixed_features=fixed_features,
      )
  
      grid_x = get_grid_for_parameter(x_param, density)
      grid_y = get_grid_for_parameter(y_param, density)
      scales = {"x": x_param.log_scale, "y": y_param.log_scale}
  
      grid2_x, grid2_y = np.meshgrid(grid_x, grid_y)
  
      grid2_x = grid2_x.flatten()
      grid2_y = grid2_y.flatten()
  
      if fixed_features is not None:
          slice_values = fixed_features.parameters
      else:
          fixed_features = ObservationFeatures(parameters={})
  
      fixed_values = get_fixed_values(model, slice_values)
  
      param_grid_obsf = []
      for i in range(density**2):
          predf = deepcopy(fixed_features)
          predf.parameters = fixed_values.copy()
          predf.parameters[x_param_name] = grid2_x[i]
          predf.parameters[y_param_name] = grid2_y[i]
          param_grid_obsf.append(predf)
  
      mu, cov = model.predict(param_grid_obsf)
  
      f_plt = mu[metric]
      sd_plt = np.sqrt(cov[metric][metric])
      # pyre-fixme[7]: Expected `Tuple[PlotData, np.ndarray, np.ndarray, np.ndarray,
      #  np.ndarray, Dict[str, bool]]` but got `Tuple[PlotData, typing.List[float],
      #  typing.Any, np.ndarray, np.ndarray, Dict[str, bool]]`.
      return plot_data, f_plt, sd_plt, grid_x, grid_y, scales
  
file_path: Ax/ax/plot/contour.py
imports: import re
  from copy import deepcopy
  from typing import Any, Dict, Optional, Tuple
  import numpy
  import plotly.graph_objs
  from ax.core.observation import ObservationFeatures
  from ax.modelbridge.base import ModelBridge
  from ax.plot.base import AxPlotConfig, AxPlotTypes, PlotData
  from ax.plot.color import BLUE_SCALE, GREEN_PINK_SCALE, GREEN_SCALE
  from ax.plot.helper import axis_range, contour_config_to_trace, get_fixed_values, get_grid_for_parameter, get_plot_data, get_range_parameter, get_range_parameters, relativize_data, rgb, TNullableGeneratorRunsDict
label_desc: Use image node_id 2 for calling a global function with example usage: _get_contour_predictions(model, x_param_name, y_param_name, metric, generator_runs_dict, density, slice_values, fixed_features) and returns: plot_data,  f_plt,  sd_plt,  grid_x,  grid_y,  scales