class_docstr: Hourglass model from Newell et al ECCV 2016.
class_docstr_tok: ["Hourglass","model","from","Newell","et","al","ECCV","2016","."]
code: def __init__(
      self,
      block: Type[Bottleneck2D],
      head: Type[Module],
      depth: int,
      num_stacks: int,
      num_blocks: int,
      num_classes: int,
      input_channels: int,
      expansion: int = 2,
  ) -> None:
      super().__init__()
  
      self.inplanes = 64
      self.num_feats = 128
      self.num_stacks = num_stacks
      self.expansion = expansion
      self.conv1 = nn.Conv2d(
          input_channels,
          self.inplanes,
          kernel_size=7,
          stride=2,
          padding=3,
      )
      self.bn1 = nn.BatchNorm2d(self.inplanes)
      self.relu = nn.ReLU(inplace=True)
      self.layer1 = self._make_residual(block, self.inplanes, 1)
      self.layer2 = self._make_residual(block, self.inplanes, 1)
      self.layer3 = self._make_residual(block, self.num_feats, 1)
      self.maxpool = nn.MaxPool2d(2, stride=2)
  
      # Build hourglass modules
      ch = self.num_feats * self.expansion
      hgl, res, fc, score, fc_, score_ = [], [], [], [], [], []
      for i in range(num_stacks):
          hgl.append(
              Hourglass(block, num_blocks, self.num_feats, depth)
          )
          res.append(
              self._make_residual(block, self.num_feats, num_blocks)
          )
          fc.append(self._make_fc(ch, ch))
          score.append(head(ch))
          if i < num_stacks - 1:
              fc_.append(nn.Conv2d(ch, ch, kernel_size=1))
              score_.append(nn.Conv2d(num_classes, ch, kernel_size=1))
      self.hg = nn.ModuleList(hgl)
      self.res = nn.ModuleList(res)
      self.fc = nn.ModuleList(fc)
      self.score = nn.ModuleList(score)
      self.fc_ = nn.ModuleList(fc_)
      self.score_ = nn.ModuleList(score_)
  
imports: from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Type, Union
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.nn.functional import pixel_shuffle, softmax
  from kornia.core import Module, Tensor
label_desc: Use image node_id 1 to create a new HourglassNet object from inherited base classes: Module with example: obj = HourglassNet(block, head, depth, num_stacks, num_blocks, num_classes, input_channels, expansion)