class_docstr: 128-dimensional SOSNet model definition for 32x32 patches.
  
  This is based on the original code from paper
  "SOSNet:Second Order Similarity Regularization for Local Descriptor Learning".
  
  Args:
      pretrained: Download and set pretrained weights to the model.
  
  Shape:
      - Input: :math:`(B, 1, 32, 32)`
      - Output: :math:`(B, 128)`
  
  Examples:
      >>> input = torch.rand(8, 1, 32, 32)
      >>> sosnet = SOSNet()
      >>> descs = sosnet(input) # 8x128
code: def __init__(self, pretrained: bool = False) -> None:
      super().__init__()
      self.layers = nn.Sequential(
          nn.InstanceNorm2d(1, affine=False),
          nn.Conv2d(1, 32, kernel_size=3, padding=1, bias=False),
          nn.BatchNorm2d(32, affine=False),
          nn.ReLU(),
          nn.Conv2d(32, 32, kernel_size=3, padding=1, bias=False),
          nn.BatchNorm2d(32, affine=False),
          nn.ReLU(),
          nn.Conv2d(
              32, 64, kernel_size=3, stride=2, padding=1, bias=False
          ),
          nn.BatchNorm2d(64, affine=False),
          nn.ReLU(),
          nn.Conv2d(64, 64, kernel_size=3, padding=1, bias=False),
          nn.BatchNorm2d(64, affine=False),
          nn.ReLU(),
          nn.Conv2d(
              64, 128, kernel_size=3, stride=2, padding=1, bias=False
          ),
          nn.BatchNorm2d(128, affine=False),
          nn.ReLU(),
          nn.Conv2d(128, 128, kernel_size=3, padding=1, bias=False),
          nn.BatchNorm2d(128, affine=False),
          nn.ReLU(),
          nn.Dropout(0.1),
          nn.Conv2d(128, 128, kernel_size=8, bias=False),
          nn.BatchNorm2d(128, affine=False),
      )
      self.desc_norm = nn.Sequential(
          nn.LocalResponseNorm(256, alpha=256.0, beta=0.5, k=0.0)
      )
      # load pretrained model
      if pretrained:
          pretrained_dict = torch.hub.load_state_dict_from_url(
              urls["lib"], map_location=map_location_to_cpu
          )
          self.load_state_dict(pretrained_dict, strict=True)
      self.eval()
  
file_path: kornia/kornia/feature/sosnet.py
imports: from typing import Dict
  import torch
  from torch import nn
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.utils.helpers import map_location_to_cpu
label_desc: Use image node_id 1 to create a new SOSNet object from inherited base classes: nn with example: obj = SOSNet(pretrained)