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",")"]
docstr: Use convolution layer to extract features
  from reduction levels i in [1, 2, 3, 4, 5].
  
  Args:
      inputs (tensor): Input tensor.
  
  Returns:
      Dictionary of last intermediate features
      with reduction levels i in [1, 2, 3, 4, 5].
      Example:
          >>> import torch
          >>> from efficientnet.model import EfficientNet
          >>> inputs = torch.rand(1, 3, 224, 224)
          >>> model = EfficientNet.from_pretrained('efficientnet-b0')
          >>> endpoints = model.extract_endpoints(inputs)
          >>> print(endpoints['reduction_1'].shape)  # torch.Size([1, 16, 112, 112])
          >>> print(endpoints['reduction_2'].shape)  # torch.Size([1, 24, 56, 56])
          >>> print(endpoints['reduction_3'].shape)  # torch.Size([1, 40, 28, 28])
          >>> print(endpoints['reduction_4'].shape)  # torch.Size([1, 112, 14, 14])
          >>> print(endpoints['reduction_5'].shape)  # torch.Size([1, 320, 7, 7])
          >>> print(endpoints['reduction_6'].shape)  # torch.Size([1, 1280, 7, 7])
docstr_tok: ["Use","convolution","layer","to","extract","features","from","reduction","levels","i","in","[","1",",","2",",","3",",","4",",","5","]",".","Args",":","inputs","(","tensor",")",":","Input","tensor",".","Returns",":","Dictionary","of","last","intermediate","features","with","reduction","levels","i","in","[","1",",","2",",","3",",","4",",","5","]",".","Example",":",">",">",">","import","torch",">",">",">","from","efficientnet.model","import","EfficientNet",">",">",">","inputs","=","torch.rand","(","1",",","3",",","224",",","224",")",">",">",">","model","=","EfficientNet.from_pretrained","(","'efficientnet-b0","'",")",">",">",">","endpoints","=","model.extract_endpoints","(","inputs",")",">",">",">","print","(","endpoints","[","'reduction_1","'","]",".shape",")","#","torch.Size","(","[","1",",","16",",","112",",","112","]",")",">",">",">","print","(","endpoints","[","'reduction_2","'","]",".shape",")","#","torch.Size","(","[","1",",","24",",","56",",","56","]",")",">",">",">","print","(","endpoints","[","'reduction_3","'","]",".shape",")","#","torch.Size","(","[","1",",","40",",","28",",","28","]",")",">",">",">","print","(","endpoints","[","'reduction_4","'","]",".shape",")","#","torch.Size","(","[","1",",","112",",","14",",","14","]",")",">",">",">","print","(","endpoints","[","'reduction_5","'","]",".shape",")","#","torch.Size","(","[","1",",","320",",","7",",","7","]",")",">",">",">","print","(","endpoints","[","'reduction_6","'","]",".shape",")","#","torch.Size","(","[","1",",","1280",",","7",",","7","]",")"]
code: def extract_endpoints(self, inputs):
      """Use convolution layer to extract features
      from reduction levels i in [1, 2, 3, 4, 5].
  
      Args:
          inputs (tensor): Input tensor.
  
      Returns:
          Dictionary of last intermediate features
          with reduction levels i in [1, 2, 3, 4, 5].
          Example:
              >>> import torch
              >>> from efficientnet.model import EfficientNet
              >>> inputs = torch.rand(1, 3, 224, 224)
              >>> model = EfficientNet.from_pretrained('efficientnet-b0')
              >>> endpoints = model.extract_endpoints(inputs)
              >>> print(endpoints['reduction_1'].shape)  # torch.Size([1, 16, 112, 112])
              >>> print(endpoints['reduction_2'].shape)  # torch.Size([1, 24, 56, 56])
              >>> print(endpoints['reduction_3'].shape)  # torch.Size([1, 40, 28, 28])
              >>> print(endpoints['reduction_4'].shape)  # torch.Size([1, 112, 14, 14])
              >>> print(endpoints['reduction_5'].shape)  # torch.Size([1, 320, 7, 7])
              >>> print(endpoints['reduction_6'].shape)  # torch.Size([1, 1280, 7, 7])
      """
      endpoints = dict()
  
      # Stem
      x = self._swish(self._bn0(self._conv_stem(inputs)))
      prev_x = x
  
      # Blocks
      for idx, block in enumerate(self._blocks):
          drop_connect_rate = self._global_params.drop_connect_rate
          if drop_connect_rate:
              drop_connect_rate *= float(idx) / len(
                  self._blocks
              )  # scale drop connect_rate
          x = block(x, drop_connect_rate=drop_connect_rate)
          if prev_x.size(2) > x.size(2):
              endpoints[
                  "reduction_{}".format(len(endpoints) + 1)
              ] = prev_x
          elif idx == len(self._blocks) - 1:
              endpoints["reduction_{}".format(len(endpoints) + 1)] = x
          prev_x = x
  
      # Head
      x = self._swish(self._bn1(self._conv_head(x)))
      endpoints["reduction_{}".format(len(endpoints) + 1)] = x
  
      return endpoints
  
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 3 for calling the EfficientNet obj's underlying member method code with example usage: obj.extract_endpoints(inputs) and returns: endpoints