code: def test_weights(
      self,
      tid,
      x_factory,
      weights_factory,
      minlength,
      maxlength,
      expected,
      axis,
  ):
      device_set = set(
          [d.device_type for d in tf_config.list_physical_devices()]
      )
      if "GPU" in device_set and not test_util.is_xla_enabled():
          self.skipTest(
              "b/263004039 The DenseBincount GPU kernel does not support weights."
              " unsorted_segment_sum should be used instead on GPU."
          )
      x = x_factory()
      weights = weights_factory()
      if axis == -1:
          expected = _adjust_expected_rank2(
              expected, minlength, maxlength
          )
      else:
          expected = _adjust_expected_rank1(
              expected, minlength, maxlength
          )
      self.assertAllEqual(
          expected,
          self.evaluate(
              bincount_ops.bincount(
                  x,
                  weights=weights,
                  minlength=minlength,
                  maxlength=maxlength,
                  axis=axis,
              )
          ),
      )
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.framework import config
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import bincount_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
label_desc: Use image node_id 8 for calling the TestDenseBincount obj's underlying member method code with example usage: obj.test_weights(tid, x_factory, weights_factory, minlength, maxlength, expected, axis) without return types