code: def filter_tensor(
      value: types.IntTensor,
      bit_mask: types.IntTensor,
      bit_index: types.IntTensor,
  ) -> types.IntTensor:
      r"""Filters an input `Tensor` based on bits set in a mask `Tensor`.
  
      #### Examples
  
      ```python
      import tensorflow as tf
      import tf_quant_finance as tff
  
      # Example: Filtering a given vector based on a mask.
  
      tff.math.qmc.utils.filter_tensor(
          tf.constant([5, 6, 7, 8]),
          tf.constant([1, 2, 3, 4]),
          tf.constant([1, 1, 2, 2]))
      # ==> tf.Tensor([0, 6, 0, 8], shape=(4,), dtype=int32)
      ```
  
      Args:
        value: Scalar `Tensor` of integers.
        bit_mask: Positive scalar `Tensor` of integers with the same `shape` and
          `dtype` as `value`.
        bit_index: Positive scalar `Tensor` of integers with the same `shape` and
          `dtype` as `value`.
  
      Returns:
        `Tensor` with the same `shape` as `value` equal to `value` if the
        `bit_index`-th bit in `LSB 0` order is set in `bit_mask`, or `zero`
        otherwise i.e.: `value * (1 & (bit_mask >>> bit_index))`
      """
  
      # Whether the `bit_index`th bit in LSB 0 order is set in `bit_filter`.
      is_bit_set = tf.equal(
          tf.cast(1, value.dtype),
          tf.bitwise.bitwise_and(
              tf.bitwise.right_shift(bit_mask, bit_index),
              tf.cast(1, value.dtype),
          ),
      )
  
      return tf.where(is_bit_set, value, 0)
  
file_path: tf-quant-finance/tf_quant_finance/math/qmc/utils.py
imports: from typing import Union
  import tensorflow.compat.v2
  from tf_quant_finance import types
label_desc: Use image node_id 5 for calling a global function with example usage: filter_tensor(value, bit_mask, bit_index) and returns: tf