code: def _log_improvement(
      Y: Tensor,
      best_f: Tensor,
      tau: Union[float, Tensor],
      fat: bool,
  ) -> Tensor:
      """Computes the logarithm of the softplus-smoothed improvement, i.e.
      `log_softplus(Y - best_f, beta=(1 / tau))`.
      Note that softplus is an approximation to the regular ReLU objective whose maximum
      pointwise approximation error is linear with respect to tau as tau goes to zero.
  
      Args:
          obj: `mc_samples x batch_shape x q`-dim Tensor of output samples.
          best_f: Best previously observed objective value(s), broadcastable with `obj`.
          tau: Temperature parameter for smooth approximation of ReLU.
              as `tau -> 0`, maximum pointwise approximation error is linear w.r.t. `tau`.
          fat: Toggles the logarithmic / linear asymptotic behavior of the
              smooth approximation to ReLU.
  
      Returns:
          A `mc_samples x batch_shape x q`-dim Tensor of improvement values.
      """
      log_soft_clamp = log_fatplus if fat else log_softplus
      Z = Y - best_f.to(Y)
      return log_soft_clamp(Z, tau=tau)
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import partial
  from typing import Any, Callable, List, Optional, Tuple, TypeVar, Union
  import torch
  from botorch.acquisition.cached_cholesky import CachedCholeskyMCSamplerMixin
  from botorch.acquisition.monte_carlo import SampleReducingMCAcquisitionFunction
  from botorch.acquisition.objective import ConstrainedMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.acquisition.utils import compute_best_feasible_objective, prune_inferior_points
  from botorch.exceptions.errors import BotorchError
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.utils.safe_math import fatmax, log_fatplus, log_softplus, logmeanexp, smooth_amax
  from botorch.utils.transforms import match_batch_shape
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _log_improvement(Y, best_f, tau, fat) and returns: log_soft_clamp