code: def _permute_feature(x: Tensor, feature_mask: Tensor) -> Tensor:
      n = x.size(0)
      assert n > 1, "cannot permute features with batch_size = 1"
  
      perm = torch.randperm(n)
      no_perm = torch.arange(n)
      while (perm == no_perm).all():
          perm = torch.randperm(n)
  
      return (x[perm] * feature_mask.to(dtype=x.dtype)) + (
          x * feature_mask.bitwise_not().to(dtype=x.dtype)
      )
  
file_path: captum/captum/attr/_core/feature_permutation.py
imports: from typing import Any, Callable, Tuple, Union
  import torch
  from captum._utils.typing import TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.feature_ablation import FeatureAblation
  from captum.log import log_usage
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _permute_feature(x, feature_mask) and returns: unknown