code: def apply_constraints_nonnegative_soft(
      obj: Tensor,
      constraints: List[Callable[[Tensor], Tensor]],
      samples: Tensor,
      eta: Union[Tensor, float],
  ) -> Tensor:
      r"""Applies constraints to a non-negative objective.
  
      This function uses a sigmoid approximation to an indicator function for
      each constraint.
  
      Args:
          obj: A `n_samples x b x q (x m')`-dim Tensor of objective values.
          constraints: A list of callables, each mapping a Tensor of size `b x q x m`
              to a Tensor of size `b x q`, where negative values imply feasibility.
              This callable must support broadcasting. Only relevant for multi-
              output models (`m` > 1).
          samples: A `n_samples x b x q x m` Tensor of samples drawn from the posterior.
          eta: The temperature parameter for the sigmoid function. Can be either a float
              or a 1-dim tensor. In case of a float the same eta is used for every
              constraint in constraints. In case of a tensor the length of the tensor
              must match the number of provided constraints. The i-th constraint is
              then estimated with the i-th eta value.
  
      Returns:
          A `n_samples x b x q (x m')`-dim tensor of feasibility-weighted objectives.
      """
      w = compute_smoothed_feasibility_indicator(
          constraints=constraints, samples=samples, eta=eta
      )
      if obj.dim() == samples.dim():
          w = w.unsqueeze(
              -1
          )  # Need to unsqueeze to accommodate the outcome dimension.
      return obj.clamp_min(0).mul(w)
  
file_path: botorch/botorch/utils/objective.py
imports: from __future__ import annotations
  import warnings
  from typing import Callable, List, Optional, Union
  import torch
  from botorch.utils.safe_math import log_fatmoid, logexpit
  from botorch.utils.transforms import normalize_indices
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: apply_constraints_nonnegative_soft(obj, constraints, samples, eta) and returns: obj