class_docstr: Alexnet implementation.
class_docstr_tok: ["Alexnet","implementation","."]
code: def __init__(
      self, requires_grad: bool = False, pretrained: bool = True
  ) -> None:
      super().__init__()
      alexnet_pretrained_features = _get_net("alexnet", pretrained)
  
      self.slice1 = torch.nn.Sequential()
      self.slice2 = torch.nn.Sequential()
      self.slice3 = torch.nn.Sequential()
      self.slice4 = torch.nn.Sequential()
      self.slice5 = torch.nn.Sequential()
      self.N_slices = 5
      for x in range(2):
          self.slice1.add_module(str(x), alexnet_pretrained_features[x])
      for x in range(2, 5):
          self.slice2.add_module(str(x), alexnet_pretrained_features[x])
      for x in range(5, 8):
          self.slice3.add_module(str(x), alexnet_pretrained_features[x])
      for x in range(8, 10):
          self.slice4.add_module(str(x), alexnet_pretrained_features[x])
      for x in range(10, 12):
          self.slice5.add_module(str(x), alexnet_pretrained_features[x])
      if not requires_grad:
          for param in self.parameters():
              param.requires_grad = False
  
imports: import inspect
  import os
  from typing import List, NamedTuple, Optional, Tuple, Union
  import torch
  from torch import Tensor, nn
  from typing_extensions import Literal
  from torchmetrics.utilities.imports import _TORCHVISION_AVAILABLE, _TORCHVISION_GREATER_EQUAL_0_13
label_desc: Use image node_id 1 to create a new Alexnet object from inherited base classes: torch.nn with example: obj = Alexnet(requires_grad, pretrained)