code: def test_flexible_top_k(self, X, gc, dc):
      X = X.astype(dtype=np.float32)
      k_shape = (int(X.size / X.shape[-1]),)
      k = np.random.randint(1, high=X.shape[-1] + 1, size=k_shape)
  
      output_list = ["Values", "Indices"]
      op = core.CreateOperator(
          "FlexibleTopK", ["X", "k"], output_list, device_option=gc
      )
  
      def bind_ref(X_loc, k):
          ret = self.flexible_top_k_ref(X_loc, k)
          return ret
  
      self.assertReferenceChecks(gc, op, [X, k], bind_ref)
  
file_path: pytorch/caffe2/python/operator_test/flexible_top_k_test.py
imports: from caffe2.python import core
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
  from collections import OrderedDict
  from hypothesis import given, settings
  import numpy
label_desc: Use image node_id 2 for calling the TestFlexibleTopK obj's underlying member method code with example usage: obj.test_flexible_top_k(X, gc, dc) and returns: ret