code: def linear(x, W, b=None, n_batch_axes=1):
      """Linear function, or affine transformation.
  
      It accepts two or three arguments: an input minibatch ``x``, a weight
      matrix ``W``, and optionally a bias vector ``b``. It computes
  
      .. math:: y_i = W x_i + b.
  
      Args:
          x (:class:`~chainer.Variable` or :ref:`ndarray`): Input variable,
              which is a :math:`(s_1, s_2, ..., s_n)`-shaped float array.
              Its first ``n_batch_axes`` dimensions are handled as
              *minibatch dimensions*. The other dimensions are handled as
              concatenated one dimension whose size must be
              :math:`(s_{\\rm n\\_batch\\_axes} * ... * s_n = N)`.
          W (:class:`~chainer.Variable` or :ref:`ndarray`):
              Weight variable of shape :math:`(M, N)`,
              where :math:`(N = s_{\\rm n\\_batch\\_axes} * ... * s_n)`.
          b (:class:`~chainer.Variable` or :ref:`ndarray`):
              Bias variable (optional) of shape :math:`(M,)`.
          n_batch_axes (int): The number of batch axes. The default is 1. The
              input variable is reshaped into
              (:math:`{\\rm n\\_batch\\_axes} + 1`)-dimensional tensor.
              This should be greater than 0.
  
      Returns:
          ~chainer.Variable: Output variable. A float array with shape
          of :math:`(s_1, ..., s_{\\rm n\\_batch\\_axes}, M)`.
  
      .. seealso::
  
          :class:`~chainer.links.Linear` to manage the model parameters
          ``W`` and ``b``.
  
      .. admonition:: Example
  
          >>> x = np.random.uniform(0, 1, (3, 4)).astype(np.float32)
          >>> W = np.random.uniform(0, 1, (5, 4)).astype(np.float32)
          >>> b = np.random.uniform(0, 1, (5,)).astype(np.float32)
          >>> y = F.linear(x, W, b)
          >>> y.shape
          (3, 5)
  
      """
      if n_batch_axes <= 0:
          raise ValueError("n_batch_axes should be greater than 0.")
      if n_batch_axes > 1:
          batch_shape = x.shape[:n_batch_axes]
          batch_size = utils.size_of_shape(batch_shape)
          x = x.reshape(batch_size, -1)
      elif x.ndim > 2:
          x = x.reshape(x.shape[0], -1)
      if b is None:
          args = x, W
      else:
          args = x, W, b
  
      (y,) = LinearFunction().apply(args)
      if n_batch_axes > 1:
          y = y.reshape(batch_shape + (-1,))
      return y
  
imports: import numpy
  from chainer import backend
  from chainer.backends import intel64
  from chainer import function_node
  import chainer.functions
  from chainer.graph_optimizations import static_code
  from chainer import utils
  from chainer.utils import type_check
  import chainerx
label_desc: Use image node_id 1 for calling a global function with example usage: linear(x, W, b, n_batch_axes) and returns: y