class_docstr: EfficientNet model.
     Most easily loaded with the .from_name or .from_pretrained methods.
  
  Args:
      blocks_args (list[namedtuple]): A list of BlockArgs to construct blocks.
      global_params (namedtuple): A set of GlobalParams shared between blocks.
  
  References:
      [1] https://arxiv.org/abs/1905.11946 (EfficientNet)
  
  Example:
      >>> import torch
      >>> from efficientnet.model import EfficientNet
      >>> inputs = torch.rand(1, 3, 224, 224)
      >>> model = EfficientNet.from_pretrained('efficientnet-b0')
      >>> model.eval()
      >>> outputs = model(inputs)
class_docstr_tok: ["EfficientNet","model",".","Most","easily","loaded","with","the",".from_name","or",".from_pretrained","methods",".","Args",":","blocks_args","(","list","[","namedtuple","]",")",":","A","list","of","BlockArgs","to","construct","blocks",".","global_params","(","namedtuple",")",":","A","set","of","GlobalParams","shared","between","blocks",".","References",":","[","1","]","https",":","\/\/arxiv.org\/abs\/1905.11946","(","EfficientNet",")","Example",":",">",">",">","import","torch",">",">",">","from","efficientnet.model","import","EfficientNet",">",">",">","inputs","=","torch.rand","(","1",",","3",",","224",",","224",")",">",">",">","model","=","EfficientNet.from_pretrained","(","'efficientnet-b0","'",")",">",">",">","model.eval","(",")",">",">",">","outputs","=","model","(","inputs",")"]
code: def __init__(self, blocks_args=None, global_params=None):
      super().__init__()
      assert isinstance(
          blocks_args, list
      ), "blocks_args should be a list"
      assert len(blocks_args) > 0, "block args must be greater than 0"
      self._global_params = global_params
      self._blocks_args = blocks_args
  
      # Batch norm parameters
      bn_mom = 1 - self._global_params.batch_norm_momentum
      bn_eps = self._global_params.batch_norm_epsilon
  
      # Get stem static or dynamic convolution depending on image size
      image_size = global_params.image_size
      Conv2d = get_same_padding_conv2d(image_size=image_size)
  
      # Stem
      in_channels = 3  # rgb
      out_channels = round_filters(
          32, self._global_params
      )  # number of output channels
      self._conv_stem = Conv2d(
          in_channels, out_channels, kernel_size=3, stride=2, bias=False
      )
      self._bn0 = nn.BatchNorm2d(
          num_features=out_channels, momentum=bn_mom, eps=bn_eps
      )
      image_size = calculate_output_image_size(image_size, 2)
  
      # Build blocks
      self._blocks = nn.ModuleList([])
      for block_args in self._blocks_args:
          # Update block input and output filters based on depth multiplier.
          block_args = block_args._replace(
              input_filters=round_filters(
                  block_args.input_filters, self._global_params
              ),
              output_filters=round_filters(
                  block_args.output_filters, self._global_params
              ),
              num_repeat=round_repeats(
                  block_args.num_repeat, self._global_params
              ),
          )
  
          # The first block needs to take care of stride and filter size increase.
          self._blocks.append(
              MBConvBlock(
                  block_args, self._global_params, image_size=image_size
              )
          )
          image_size = calculate_output_image_size(
              image_size, block_args.stride
          )
          if (
              block_args.num_repeat > 1
          ):  # modify block_args to keep same output size
              block_args = block_args._replace(
                  input_filters=block_args.output_filters, stride=1
              )
          for _ in range(block_args.num_repeat - 1):
              self._blocks.append(
                  MBConvBlock(
                      block_args,
                      self._global_params,
                      image_size=image_size,
                  )
              )
              # image_size = calculate_output_image_size(image_size, block_args.stride)  # stride = 1
  
      # Head
      in_channels = block_args.output_filters  # output of final block
      out_channels = round_filters(1280, self._global_params)
      Conv2d = get_same_padding_conv2d(image_size=image_size)
      self._conv_head = Conv2d(
          in_channels, out_channels, kernel_size=1, bias=False
      )
      self._bn1 = nn.BatchNorm2d(
          num_features=out_channels, momentum=bn_mom, eps=bn_eps
      )
  
      # Final linear layer
      self._avg_pooling = nn.AdaptiveAvgPool2d(1)
      if self._global_params.include_top:
          self._dropout = nn.Dropout(self._global_params.dropout_rate)
          self._fc = nn.Linear(
              out_channels, self._global_params.num_classes
          )
  
      # set activation to memory efficient swish by default
      self._swish = MemoryEfficientSwish()
  
imports: import torch
  from torch import nn
  from torch.nn import functional
  from .utils import round_filters, round_repeats, drop_connect, get_same_padding_conv2d, get_model_params, efficientnet_params, load_pretrained_weights, Swish, MemoryEfficientSwish, calculate_output_image_size
label_desc: Use image node_id 1 to create a new EfficientNet object from inherited base classes: nn with example: obj = EfficientNet(blocks_args, global_params)