code: def __init__(
      self,
      in_channels: int = 3,
      out_channels: Optional[int] = None,
      *,
      scale: int = 4,
      latent_channels: int = 64,
      grow_channels: int = 32,
      num_layers: int = 23,
  ):
      super().__init__()
      self.scale = scale
      out_channels = out_channels or in_channels
      if scale == 2:
          in_channels = in_channels * 4
      elif scale == 1:
          in_channels = in_channels * 16
      self.conv_first = nn.Conv2d(in_channels, latent_channels, 3, 1, 1)
      make_layer = lambda: RRDB(latent_channels, grow_channels)
      self.body = nn.Sequential(
          *[make_layer() for _ in range(num_layers)]
      )
      self.conv_body = nn.Conv2d(
          latent_channels, latent_channels, 3, 1, 1
      )
      # upsample
      self.conv_up1 = nn.Conv2d(
          latent_channels, latent_channels, 3, 1, 1
      )
      self.conv_up2 = nn.Conv2d(
          latent_channels, latent_channels, 3, 1, 1
      )
      self.conv_hr = nn.Conv2d(
          latent_channels, latent_channels, 3, 1, 1
      )
      self.conv_last = nn.Conv2d(latent_channels, out_channels, 3, 1, 1)
      # misc
      self.lrelu = nn.LeakyReLU(negative_slope=0.2, inplace=True)
      self.upsample = lambda net: F.interpolate(
          net, scale_factor=2, mode="nearest"
      )
  
file_path: carefree-learn/cflearn/models/cv/translator/rrdb.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from typing import Optional
  from ....schema import IDLModel
label_desc: Use image node_id 1 to create a new RRDBNet object from inherited base classes: IDLModel with example: obj = RRDBNet(in_channels, out_channels)