code: def filter_constraints_and_fixed_features(
      X: Tensoray,
      bounds: List[Tuple[float, float]],
      linear_constraints: Optional[Tuple[Tensoray, Tensoray]] = None,
      fixed_features: Optional[Dict[int, float]] = None,
  ) -> Tensoray:
      """Filter points to those that satisfy bounds, linear_constraints, and
      fixed_features.
  
      Args:
          X: An tensor or array of points.
          bounds: A list of (lower, upper) tuples for each feature.
          linear_constraints: A tuple of (A, b). For k linear constraints on
              d-dimensional x, A is (k x d) and b is (k x 1) such that
              A x <= b.
          fixed_features: A map {feature_index: value} for features that
              should be fixed to a particular value in the best point.
  
      Returns:
          Feasible points.
      """
      if len(X) == 0:  # if there are no points, nothing to filter
          return X
      X_np = X
      if isinstance(X, torch.Tensor):
          X_np = X.cpu().numpy()
      feas = np.ones(X_np.shape[0], dtype=bool)  # (n)
      for i, b in enumerate(bounds):
          feas &= (X_np[:, i] >= b[0]) & (X_np[:, i] <= b[1])
      if linear_constraints is not None:
          A, b = as_array(linear_constraints)  # (m x d) and (m x 1)
          feas &= (A @ X_np.transpose() <= b).all(axis=0)
      if fixed_features is not None:
          for idx, val in fixed_features.items():
              feas &= X_np[:, idx] == val
      X_feas = X_np[feas, :]
      if isinstance(X, torch.Tensor):
          return torch.from_numpy(X_feas).to(
              device=X.device, dtype=X.dtype
          )
      else:
          return X_feas
  
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Callable, Dict, List, Optional, Protocol, Set, Tuple, Union
  import numpy
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.exceptions.core import SearchSpaceExhausted, UnsupportedError
  from ax.models.types import TConfig
  from ax.utils.common.typeutils import checked_cast
  from botorch.acquisition.risk_measures import RiskMeasureMCObjective
  from torch import Tensor
label_desc: Use image node_id 11 for calling a global function with example usage: filter_constraints_and_fixed_features(X, bounds, linear_constraints, fixed_features) and returns: X, torch, X_feas