code: def test_randomly_weighted(self):
      # Random weights
      wu = np.random.uniform(
          low=0, high=2, size=self.y.shape[0]
      ).astype("f")
  
      loss_wu = (
          compute_weighted_value_loss(
              torch.as_tensor(self.eltwise_losses),
              self.y.shape[0],
              torch.as_tensor(wu),
              batch_accumulator=self.batch_accumulator,
          )
          .detach()
          .cpu()
          .numpy()
      )
      if self.batch_accumulator == "mean":
          eltwise_loss = (self.eltwise_losses.sum(axis=1) * wu).mean()
      else:
          eltwise_loss = (self.eltwise_losses * wu[:, None]).sum()
      assertions.assertAlmostEqual(loss_wu, eltwise_loss, places=5)
  
imports: import unittest
  import basetest_dqn_like
  import numpy
  import pytest
  import torch
  from basetest_training import _TestBatchTrainingMixin
  import pfrl
  from pfrl.agents import CategoricalDQN, categorical_dqn
  from pfrl.agents.categorical_dqn import compute_value_loss, compute_weighted_value_loss
label_desc: Use image node_id 4 for calling the TestComputeValueLoss obj's underlying member method code with example usage: obj.test_randomly_weighted() without return types