code: def test_gather_ranges_to_dense_op(self):
      data = np.array([1, 2, 3, 4, 5, 6, 7, 8])
      ranges = np.array([[[2, 4]], [[0, 0]]])
      key = np.array([0, 1, 3, 2, 1, 0, 1, 0])
      lengths = np.array([4])
      min_observation = 2
      max_mismatched_ratio = 0.5
      max_empty_ratio = 1.0
  
      outputs_name = ["X_{}".format(i) for i in range(len(lengths))]
      ref_op = core.CreateOperator(
          "GatherRangesToDense",
          ["data", "ranges", "key"],
          outputs_name,
          lengths=lengths,
          min_observation=min_observation,
          max_mismatched_ratio=max_mismatched_ratio,
          max_empty_ratio=max_empty_ratio,
      )
      workspace.FeedBlob("data", data)
      workspace.FeedBlob("ranges", ranges)
      workspace.FeedBlob("key", key)
      workspace.RunOperatorOnce(ref_op)
      ref_outputs = []
      for output_name in outputs_name:
          ref_outputs.append(workspace.FetchBlob(output_name))
  
      outputs = torch.ops._caffe2.GatherRangesToDense(
          torch.from_numpy(data),
          torch.from_numpy(ranges),
          torch.from_numpy(key),
          lengths=lengths,
          min_observation=min_observation,
          max_mismatched_ratio=max_mismatched_ratio,
          max_empty_ratio=max_empty_ratio,
      )
  
      self.assertEqual(len(ref_outputs), len(outputs))
      for i in range(0, len(ref_outputs)):
          np.testing.assert_array_almost_equal(
              ref_outputs[i], outputs[i].numpy()
          )
  
imports: import struct
  import unittest
  import caffe2.python.hypothesis_test_util
  import hypothesis.strategies
  import numpy
  import torch
  from caffe2.python import core, workspace
  from hypothesis import given, settings
  from scipy.stats import norm
  from ._utils import assert_allclose
label_desc: Use image node_id 39 for calling the TorchIntegration obj's underlying member method code with example usage: obj.test_gather_ranges_to_dense_op() without return types