class_docstr: Linear unit regularized by simplified dropconnect.
class_docstr_tok: ["Linear","unit","regularized","by","simplified","dropconnect","."]
code: def forward(self, inputs):
      self.retain_inputs((0, 1))
      scale = inputs[1].dtype.type(1.0 / (1 - self.ratio))
      xp = backend.get_array_module(*inputs)
  
      if self.mask is None:
          if self.use_batchwise_mask:
              mask_shape = (
                  inputs[0].shape[0],
                  inputs[1].shape[0],
                  inputs[1].shape[1],
              )
          else:
              mask_shape = (inputs[1].shape[0], inputs[1].shape[1])
          if xp == numpy:
              self.mask = xp.random.rand(*mask_shape) >= self.ratio
          else:
              self.mask = (
                  xp.random.rand(*mask_shape, dtype=numpy.float32)
                  >= self.ratio
              )
      elif isinstance(self.mask, variable.Variable):
          self.mask = self.mask.data
  
      x = _as_mat(inputs[0])
      W = inputs[1] * scale * self.mask
  
      # (i)jk,ik->ij
      y = _matmul(W, x[:, :, None], xp)
      y = y.reshape(y.shape[0], y.shape[1]).astype(x.dtype, copy=False)
  
      if len(inputs) == 3:
          b = inputs[2]
          y += b
      return (y,)
  
file_path: chainer/chainer/functions/noise/simplified_dropconnect.py
imports: import numpy
  from chainer import backend
  from chainer import function_node
  import chainer.functions
  from chainer.utils import type_check
  from chainer import variable
label_desc: Use image node_id 3 for calling the SimplifiedDropconnect obj's underlying member method code with example usage: obj.forward(inputs) and returns: y