code: def basic_generator(
      out_size: int,  # Output size for the generator (same as the input size for the critic)
      n_channels: int,  # Number of channels of the output of the generator
      in_sz: int = 100,  # Size of the input noise vector for the generator
      n_features: int = 64,  # Number of features used in the generator
      n_extra_layers: int = 0,  # Number of extra hidden layers in the generator
      **kwargs,
  ) -> nn.Sequential:
      "A basic generator from `in_sz` to images `n_channels` x `out_size` x `out_size`."
      cur_size, cur_ftrs = 4, n_features // 2
      while cur_size < out_size:
          cur_size *= 2
          cur_ftrs *= 2
      layers = [
          AddChannels(2),
          ConvLayer(in_sz, cur_ftrs, 4, 1, transpose=True, **kwargs),
      ]
      cur_size = 4
      while cur_size < out_size // 2:
          layers.append(
              ConvLayer(
                  cur_ftrs,
                  cur_ftrs // 2,
                  4,
                  2,
                  1,
                  transpose=True,
                  **kwargs,
              )
          )
          cur_ftrs //= 2
          cur_size *= 2
      layers += [
          ConvLayer(
              cur_ftrs, cur_ftrs, 3, 1, 1, transpose=True, **kwargs
          )
          for _ in range(n_extra_layers)
      ]
      layers += [
          nn.ConvTranspose2d(cur_ftrs, n_channels, 4, 2, 1, bias=False),
          nn.Tanh(),
      ]
      return nn.Sequential(*layers)
  
imports: from __future__ import annotations
  from ..basics import *
  from .all import *
label_desc: Use image node_id 2 for calling a global function with example usage: basic_generator(out_size, n_channels, in_sz, n_features, n_extra_layers) and returns: nn