code: def test_filter_tensor(self):
      test_cases = [
          tf.uint8,
          tf.int8,
          tf.uint16,
          tf.int16,
          tf.uint32,
          tf.int32,
          tf.uint64,
          tf.int64,
      ]
  
      for dtype in test_cases:
          # Should only retain values for which given bits in the bit mask are set.
          expected = tf.constant([[6, 5, 0], [3, 0, 1]], dtype=dtype)
          actual = utils.filter_tensor(
              # Tensor to filter
              tf.constant([[6, 5, 4], [3, 2, 1]], dtype=dtype),
              # Bit mask
              tf.constant([[1, 2, 11], [3, 5, 4]], dtype=dtype),
              # Indices (in LSB 0 order) of bits in the mask used for filtering
              tf.constant([[0, 1, 2], [0, 1, 2]], dtype=dtype),
          )
  
          with self.subTest("Values"):
              self.assertAllEqual(
                  self.evaluate(actual), self.evaluate(expected)
              )
          with self.subTest("DType"):
              self.assertEqual(actual.dtype, expected.dtype)
  
file_path: tf-quant-finance/tf_quant_finance/math/qmc/utils_test.py
imports: import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 5 for calling the UtilsTest obj's underlying member method code with example usage: obj.test_filter_tensor() without return types