code: def _test_randomness(self, device):
      x = torch.normal(0, 1, size=(10, 6), device=device).float()
      y1 = self.linear(x).detach().cpu().numpy()
      y2 = self.linear(x).detach().cpu().numpy()
      d = float(numpy.mean(numpy.square(y1 - y2)))
  
      # The parameter name suggests that
      # torch.sqrt(d / 2) is approx to sigma_scale = 0.4
      # In fact, (for each element _[i, j],) it holds:
      # \E[(y2 - y1) ** 2] = 2 * \Var(y) = (4 / pi) * sigma_scale ** 2
  
      target = (0.4**2) * 2
      if self.bias:
          target *= (
              2 / numpy.pi + numpy.sqrt(2 / numpy.pi) / y1.shape[1]
          )
      else:
          target *= 2 / numpy.pi
  
      assert d > target / 3.0
      assert d < target * 3.0
  
file_path: pfrl/tests/nn_tests/test_noisy_linear.py
imports: import numpy
  import pytest
  import torch
  from pfrl.nn import noisy_linear
label_desc: Use image node_id 6 for calling the TestFactorizedNoisyLinear obj's underlying member method code with example usage: obj._test_randomness(device) without return types