class_docstr: Implement Adaptive 2D positional encoder for SATRN, see `SATRN.
  
  <https://arxiv.org/abs/1910.04396>`_ Modified from
  https://github.com/Media-Smart/vedastr Licensed under the Apache License,
  Version 2.0 (the "License");
  
  Args:
      d_hid (int): Dimensions of hidden layer. Defaults to 512.
      n_height (int): Max height of the 2D feature output. Defaults to 100.
      n_width (int): Max width of the 2D feature output. Defaults to 100.
      dropout (float): Dropout rate. Defaults to 0.1.
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to [dict(type='Xavier', layer='Conv2d')]
docstr: Generate sinusoid position encoding table.
docstr_tok: ["Generate","sinusoid","position","encoding","table","."]
code: def _get_sinusoid_encoding_table(
      n_position: int, d_hid: int
  ) -> Tensor:
      """Generate sinusoid position encoding table."""
      denominator = torch.Tensor(
          [
              1.0 / np.power(10000, 2 * (hid_j // 2) / d_hid)
              for hid_j in range(d_hid)
          ]
      )
      denominator = denominator.view(1, -1)
      pos_tensor = torch.arange(n_position).unsqueeze(-1).float()
      sinusoid_table = pos_tensor * denominator
      sinusoid_table[:, 0::2] = torch.sin(sinusoid_table[:, 0::2])
      sinusoid_table[:, 1::2] = torch.cos(sinusoid_table[:, 1::2])
  
      return sinusoid_table
  
imports: from typing import Dict, List, Optional, Union
  import numpy
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule
  from torch import Tensor
  from mmocr.models.common import MultiHeadAttention
label_desc: Use image node_id 2 for calling the Adaptive2DPositionalEncoding obj's underlying member method code with example usage: obj._get_sinusoid_encoding_table(n_position, d_hid) and returns: sinusoid_table