class_docstr: Inception-v1 I3D architecture.
  The model is introduced in:
      Quo Vadis, Action Recognition? A New Model and the Kinetics Dataset
      Joao Carreira, Andrew Zisserman
      https://arxiv.org/pdf/1705.07750v1.pdf.
  See also the Inception architecture, introduced in:
      Going deeper with convolutions
      Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed,
      Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, Andrew Rabinovich.
      http://arxiv.org/pdf/1409.4842v1.pdf.
class_docstr_tok: ["Inception-v1","I3D","architecture",".","The","model","is","introduced","in",":","Quo","Vadis",",","Action","Recognition","?","A","New","Model","and","the","Kinetics","Dataset","Joao","Carreira",",","Andrew","Zisserman","https",":","\/\/arxiv.org\/pdf\/1705.07750v1.pdf",".","See","also","the","Inception","architecture",",","introduced","in",":","Going","deeper","with","convolutions","Christian","Szegedy",",","Wei","Liu",",","Yangqing","Jia",",","Pierre","Sermanet",",","Scott","Reed",",","Dragomir","Anguelov",",","Dumitru","Erhan",",","Vincent","Vanhoucke",",","Andrew","Rabinovich",".","http",":","\/\/arxiv.org\/pdf\/1409.4842v1.pdf","."]
docstr: Initializes I3D model instance.
  
  Args:
    num_classes: The number of outputs in the logit layer (default 400, which
        matches the Kinetics dataset). Use `replace_logits` to update num_classes.
    spatial_squeeze: Whether to squeeze the spatial dimensions for the logits
        before returning (default True).
    final_endpoint: The model contains many possible endpoints.
        `final_endpoint` specifies the last endpoint for the model to be built
        up to. In addition to the output at `final_endpoint`, all the outputs
        at endpoints up to `final_endpoint` will also be returned, in a
        dictionary. `final_endpoint` must be one of
        InceptionI3d.VALID_ENDPOINTS (default 'Logits').
    name: A string (optional). The name of this module.
  
  Raises:
    ValueError: if `final_endpoint` is not recognized.
docstr_tok: ["Initializes","I3D","model","instance",".","Args",":","num_classes",":","The","number","of","outputs","in","the","logit","layer","(","default","400",",","which","matches","the","Kinetics","dataset",")",".","Use","`","replace_logits","`","to","update","num_classes",".","spatial_squeeze",":","Whether","to","squeeze","the","spatial","dimensions","for","the","logits","before","returning","(","default","True",")",".","final_endpoint",":","The","model","contains","many","possible","endpoints",".","`","final_endpoint","`","specifies","the","last","endpoint","for","the","model","to","be","built","up","to",".","In","addition","to","the","output","at","`","final_endpoint","`",",","all","the","outputs","at","endpoints","up","to","`","final_endpoint","`","will","also","be","returned",",","in","a","dictionary",".","`","final_endpoint","`","must","be","one","of","InceptionI3d.VALID_ENDPOINTS","(","default","'Logits","'",")",".","name",":","A","string","(","optional",")",".","The","name","of","this","module",".","Raises",":","ValueError",":","if","`","final_endpoint","`","is","not","recognized","."]
code: def __init__(
      self,
      num_classes=400,
      spatial_squeeze=True,
      final_endpoint="Logits",
      name="inception_i3d",
      in_channels=3,
      dropout_keep_prob=0.5,
  ):
      """
      Initializes I3D model instance.
  
      Args:
        num_classes: The number of outputs in the logit layer (default 400, which
            matches the Kinetics dataset). Use `replace_logits` to update num_classes.
        spatial_squeeze: Whether to squeeze the spatial dimensions for the logits
            before returning (default True).
        final_endpoint: The model contains many possible endpoints.
            `final_endpoint` specifies the last endpoint for the model to be built
            up to. In addition to the output at `final_endpoint`, all the outputs
            at endpoints up to `final_endpoint` will also be returned, in a
            dictionary. `final_endpoint` must be one of
            InceptionI3d.VALID_ENDPOINTS (default 'Logits').
        name: A string (optional). The name of this module.
  
      Raises:
        ValueError: if `final_endpoint` is not recognized.
      """
  
      if final_endpoint not in self.VALID_ENDPOINTS:
          raise ValueError("Unknown final endpoint %s" % final_endpoint)
  
      super(InceptionI3d, self).__init__()
      self._num_classes = num_classes
      self._spatial_squeeze = spatial_squeeze
      self._final_endpoint = final_endpoint
      self.logits = None
  
      if self._final_endpoint not in self.VALID_ENDPOINTS:
          raise ValueError(
              "Unknown final endpoint %s" % self._final_endpoint
          )
  
      """Construct I3D architecture."""
      self.end_points = {}
      end_point = "Conv3d_1a_7x7"
      self.end_points[end_point] = Unit3D(
          in_channels=in_channels,
          output_channels=64,
          kernel_shape=[7, 7, 7],
          stride=(2, 2, 2),
          padding=(3, 3, 3),
          name=name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "MaxPool3d_2a_3x3"
      self.end_points[end_point] = MaxPool3dSamePadding(
          kernel_size=[1, 3, 3], stride=(1, 2, 2), padding=0
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Conv3d_2b_1x1"
      self.end_points[end_point] = Unit3D(
          in_channels=64,
          output_channels=64,
          kernel_shape=[1, 1, 1],
          padding=0,
          name=name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Conv3d_2c_3x3"
      self.end_points[end_point] = Unit3D(
          in_channels=64,
          output_channels=192,
          kernel_shape=[3, 3, 3],
          padding=1,
          name=name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "MaxPool3d_3a_3x3"
      self.end_points[end_point] = MaxPool3dSamePadding(
          kernel_size=[1, 3, 3], stride=(1, 2, 2), padding=0
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_3b"
      self.end_points[end_point] = InceptionModule(
          192, [64, 96, 128, 16, 32, 32], name + end_point
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_3c"
      self.end_points[end_point] = InceptionModule(
          256, [128, 128, 192, 32, 96, 64], name + end_point
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "MaxPool3d_4a_3x3"
      self.end_points[end_point] = MaxPool3dSamePadding(
          kernel_size=[3, 3, 3], stride=(2, 2, 2), padding=0
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_4b"
      self.end_points[end_point] = InceptionModule(
          128 + 192 + 96 + 64,
          [192, 96, 208, 16, 48, 64],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_4c"
      self.end_points[end_point] = InceptionModule(
          192 + 208 + 48 + 64,
          [160, 112, 224, 24, 64, 64],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_4d"
      self.end_points[end_point] = InceptionModule(
          160 + 224 + 64 + 64,
          [128, 128, 256, 24, 64, 64],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_4e"
      self.end_points[end_point] = InceptionModule(
          128 + 256 + 64 + 64,
          [112, 144, 288, 32, 64, 64],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_4f"
      self.end_points[end_point] = InceptionModule(
          112 + 288 + 64 + 64,
          [256, 160, 320, 32, 128, 128],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "MaxPool3d_5a_2x2"
      self.end_points[end_point] = MaxPool3dSamePadding(
          kernel_size=[2, 2, 2], stride=(2, 2, 2), padding=0
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_5b"
      self.end_points[end_point] = InceptionModule(
          256 + 320 + 128 + 128,
          [256, 160, 320, 32, 128, 128],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Mixed_5c"
      self.end_points[end_point] = InceptionModule(
          256 + 320 + 128 + 128,
          [384, 192, 384, 48, 128, 128],
          name + end_point,
      )
      if self._final_endpoint == end_point:
          return
  
      end_point = "Logits"
      # self.avg_pool = nn.AvgPool3d(kernel_size=[2, 7, 7], stride=(1, 1, 1))
      # self.avg_pool_flow = nn.AvgPool3d(kernel_size=[1, 7, 7], stride=(1, 1, 1))
      self.avg_pool = nn.AdaptiveAvgPool3d(1)
      self.dropout = nn.Dropout(dropout_keep_prob)
      self.logits = Unit3D(
          in_channels=384 + 384 + 128 + 128,
          output_channels=400,
          kernel_shape=[1, 1, 1],
          padding=0,
          activation_fn=None,
          use_batch_norm=False,
          use_bias=True,
          name="logits",
      )
  
      self.build()
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.hub import load_state_dict_from_url
label_desc: Use image node_id 1 to create a new InceptionI3d object from inherited base classes: nn with example: obj = InceptionI3d(num_classes, spatial_squeeze, final_endpoint, name, in_channels, dropout_keep_prob)