code: def compute_non_dominated_hypercell_bounds_2d(
      pareto_Y_sorted: Tensor, ref_point: Tensor
  ) -> Tensor:
      r"""Compute an axis-aligned partitioning of the non-dominated space for 2
      objectives.
  
      Args:
          pareto_Y_sorted: A `(batch_shape) x n_pareto x 2`-dim tensor of pareto outcomes
              that are sorted by the 0th dimension in increasing order. All points must be
              better than the reference point.
          ref_point: A `(batch_shape) x 2`-dim reference point.
  
      Returns:
          A `2 x (batch_shape) x n_pareto + 1 x m`-dim tensor of cell bounds.
      """
      # add boundary point to each front
      # the boundary point is the extreme value in each outcome
      # (a single coordinate of reference point)
      batch_shape = pareto_Y_sorted.shape[:-2]
      if ref_point.ndim == pareto_Y_sorted.ndim - 1:
          expanded_boundary_point = ref_point.unsqueeze(-2)
      else:
          view_shape = torch.Size([1] * len(batch_shape)) + torch.Size(
              [1, 2]
          )
          expanded_shape = batch_shape + torch.Size([1, 2])
          expanded_boundary_point = ref_point.view(view_shape).expand(
              expanded_shape
          )
  
      # add the points (ref, y) and (x, ref) to the corresponding ends
      pareto_Y_sorted0, pareto_Y_sorted1 = torch.split(
          pareto_Y_sorted, 1, dim=-1
      )
      expanded_boundary_point0, expanded_boundary_point1 = torch.split(
          expanded_boundary_point, 1, dim=-1
      )
      left_end = torch.cat(
          [
              expanded_boundary_point0[..., :1, :],
              pareto_Y_sorted1[..., :1, :],
          ],
          dim=-1,
      )
      right_end = torch.cat(
          [
              pareto_Y_sorted0[..., -1:, :],
              expanded_boundary_point1[..., :1, :],
          ],
          dim=-1,
      )
      front = torch.cat([left_end, pareto_Y_sorted, right_end], dim=-2)
      # The top left corners of axis-aligned rectangles in dominated partitioning.
      # These are the bottom left corners of the non-dominated partitioning
      front0, front1 = torch.split(front, 1, dim=-1)
      bottom_lefts = torch.cat(
          [front0[..., :-1, :], front1[..., 1:, :]], dim=-1
      )
      top_right_xs = torch.cat(
          [
              front0[..., 1:-1, :],
              torch.full(
                  bottom_lefts.shape[:-2] + torch.Size([1, 1]),
                  float("inf"),
                  dtype=front.dtype,
                  device=front.device,
              ),
          ],
          dim=-2,
      )
      top_rights = torch.cat(
          [
              top_right_xs,
              torch.full(
                  bottom_lefts.shape[:-1] + torch.Size([1]),
                  float("inf"),
                  dtype=front.dtype,
                  device=front.device,
              ),
          ],
          dim=-1,
      )
      return torch.stack([bottom_lefts, top_rights], dim=0)
  
file_path: botorch/botorch/utils/multi_objective/box_decompositions/utils.py
imports: from typing import Optional, Tuple
  import torch
  from botorch.exceptions.errors import BotorchTensorDimensionError, UnsupportedError
  from botorch.utils.multi_objective.pareto import is_non_dominated
  from torch import Size, Tensor
label_desc: Use image node_id 6 for calling a global function with example usage: compute_non_dominated_hypercell_bounds_2d(pareto_Y_sorted, ref_point) and returns: torch