code: def test_random_with_weights(self):
      num_samples = 10000
      with self.session():
          np.random.seed(42)
          for dtype in [
              dtypes.int32,
              dtypes.int64,
              dtypes.float32,
              dtypes.float64,
          ]:
              arr = np.random.randint(0, 1000, num_samples)
              if dtype == dtypes.int32 or dtype == dtypes.int64:
                  weights = np.random.randint(-100, 100, num_samples)
              else:
                  weights = np.random.random(num_samples)
              self.assertAllClose(
                  self.evaluate(bincount_ops.bincount(arr, weights)),
                  np.bincount(arr, weights),
              )
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import bincount_ops
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import random_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 googletest
label_desc: Use image node_id 4 for calling the BincountTest obj's underlying member method code with example usage: obj.test_random_with_weights() without return types