class_docstr: A single Hourglass model block.
code: def __init__(
      self,
      depth: int,
      input_features: int,
      features,
      increase=0,
      activation=nn.ReLU,
      repeats=1,
      pooling_block=nn.MaxPool2d,
  ):
      super(HGBlock, self).__init__()
      nf = features + increase
  
      if inspect.isclass(pooling_block) and issubclass(
          pooling_block, (nn.MaxPool2d, nn.AvgPool2d)
      ):
          self.down = pooling_block(kernel_size=2, padding=0, stride=2)
      else:
          self.down = pooling_block(input_features)
  
      if repeats == 1:
          self.up1 = HGResidualBlock(
              input_features, features, activation=activation
          )
          self.low1 = HGResidualBlock(
              input_features, nf, activation=activation
          )
      else:
          up_blocks = []
          up_input_features = input_features
          for _ in range(repeats):
              up_blocks.append(
                  HGResidualBlock(up_input_features, features)
              )
              up_input_features = features
          self.up1 = nn.Sequential(*up_blocks)
  
          down_blocks = []
          down_input_features = input_features
          for _ in range(repeats):
              up_blocks.append(HGResidualBlock(down_input_features, nf))
              down_input_features = nf
          self.low1 = nn.Sequential(*down_blocks)
  
      self.depth = depth
      # Recursive hourglass
      if self.depth > 1:
          self.low2 = HGBlock(
              depth - 1,
              nf,
              nf,
              increase=increase,
              pooling_block=pooling_block,
              activation=activation,
              repeats=repeats,
          )
      else:
          self.low2 = HGResidualBlock(nf, nf, activation=activation)
      self.low3 = HGResidualBlock(nf, features, activation=activation)
      self.up = nn.Upsample(scale_factor=2, mode="nearest")
  
imports: import inspect
  from collections import OrderedDict
  from typing import List, Callable, Tuple
  import torch
  from pytorch_toolbelt.modules import ACT_RELU, get_activation_block
  from pytorch_toolbelt.modules.encoders import EncoderModule, make_n_channel_input
  from torch import nn, Tensor
label_desc: Use image node_id 1 to create a new HGBlock object from inherited base classes: nn with example: obj = HGBlock(depth, input_features, features, increase, activation, repeats, pooling_block)