code: def test_sparse_lengths_fp16(
      self, input, data_strategy, is_mean, gc, dc
  ):
      m = input.shape[0]
  
      lengths = data_strategy.draw(
          hu.tensor(
              max_dim=1,
              max_value=input.shape[0],
              dtype=np.int32,
              elements=st.integers(min_value=0, max_value=27),
          )
      )
      lengths_sum = int(np.sum(lengths).item())
  
      indices = data_strategy.draw(
          hu.arrays(
              [lengths_sum],
              dtype=np.int64,
              elements=st.sampled_from(np.arange(m)),
          )
      )
      if is_mean:
          op = core.CreateOperator(
              "SparseLengthsMean",
              ["input", "indices", "lengths"],
              "out",
          )
          self.assertReferenceChecks(
              gc, op, [input, indices, lengths], sparse_lengths_mean_ref
          )
  
      else:
          op = core.CreateOperator(
              "SparseLengthsSum", ["input", "indices", "lengths"], "out"
          )
          self.assertReferenceChecks(
              gc, op, [input, indices, lengths], sparse_lengths_sum_ref
          )
  
imports: from functools import partial
  from hypothesis import given, settings
  import numpy
  import unittest
  import hypothesis.strategies
  from caffe2.python import core, workspace
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
label_desc: Use image node_id 22 for calling the TestSegmentOps obj's underlying member method code with example usage: obj.test_sparse_lengths_fp16(input, data_strategy, is_mean, gc, dc) without return types