code: def add_noise(device, h, sigma=0.2):
      if chainer.config.train:
          xp = device.xp
          # TODO(niboshi): Support random.randn in ChainerX
          if device.xp is chainerx:
              fallback_device = device.fallback_device
              with chainer.using_device(fallback_device):
                  randn = device.send(
                      fallback_device.xp.random.randn(*h.shape)
                  )
          else:
              randn = xp.random.randn(*h.shape)
          return h + sigma * randn
      else:
          return h
  
file_path: chainer/examples/dcgan/net.py
imports: import numpy
  import chainer
  import chainer.functions
  import chainer.links
  import chainerx
label_desc: Use image node_id 1 for calling a global function with example usage: add_noise(device, h, sigma) and returns: unknown, h