code: def __init__(
      self,
      growth_rate=32,
      block_config=(6, 12, 24, 16),
      num_init_features=64,
      bn_size=4,
      drop_rate=0,
      pretrained=True,
  ):
      super(DenseNet, self).__init__()
  
      # First convolution
      self.start_features = nn.Sequential(
          OrderedDict(
              [
                  (
                      "conv0",
                      nn.Conv2d(
                          3,
                          num_init_features,
                          kernel_size=7,
                          stride=2,
                          padding=3,
                          bias=False,
                      ),
                  ),
                  ("norm0", nn.BatchNorm2d(num_init_features)),
                  ("relu0", nn.ReLU(inplace=True)),
                  (
                      "pool0",
                      nn.MaxPool2d(kernel_size=3, stride=2, padding=1),
                  ),
              ]
          )
      )
  
      # Each denseblock
      num_features = num_init_features
  
      init_weights = list(
          densenet121(pretrained=True).features.children()
      )
      start = 0
      for i, c in enumerate(self.start_features.children()):
          if pretrained:
              c.load_state_dict(init_weights[i].state_dict())
          start += 1
      self.blocks = nn.ModuleList()
      for i, num_layers in enumerate(block_config):
          block = _DenseBlock(
              num_layers=num_layers,
              num_input_features=num_features,
              bn_size=bn_size,
              growth_rate=growth_rate,
              drop_rate=drop_rate,
          )
          if pretrained:
              block.load_state_dict(init_weights[start].state_dict())
          start += 1
          self.blocks.append(block)
          setattr(self, "denseblock%d" % (i + 1), block)
  
          num_features = num_features + num_layers * growth_rate
          if i != len(block_config) - 1:
              downsample = i < 1
              trans = _Transition(
                  num_input_features=num_features,
                  num_output_features=num_features // 2,
                  downsample=downsample,
              )
              if pretrained:
                  trans.load_state_dict(
                      init_weights[start].state_dict()
                  )
              start += 1
              self.blocks.append(trans)
              setattr(self, "transition%d" % (i + 1), trans)
              num_features = num_features // 2
  
imports: from collections import OrderedDict
  import math
  import re
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils import model_zoo
  from torchvision.models.densenet import DenseNet
  from torchvision.models.squeezenet import squeezenet1_1
label_desc: Use image node_id 1 to create a new DenseNet object from inherited base classes: nn with example: obj = DenseNet(growth_rate, block_config, num_init_features, bn_size, drop_rate, pretrained)