code: def forward(self, shape: Tuple[int, int, int]):
      device = self.token_projection.weight.device
      dtype = self.token_projection.weight.dtype
      inv_mask = ~torch.zeros(shape).to(device=device, dtype=torch.bool)
      y_embed = inv_mask.cumsum(1, dtype=dtype)
      x_embed = inv_mask.cumsum(2, dtype=dtype)
      eps = 1e-6
      y_embed = y_embed / (y_embed[:, -1:, :] + eps) * self.scale
      x_embed = x_embed / (x_embed[:, :, -1:] + eps) * self.scale
  
      dim_t = torch.arange(self.hidden_dim, dtype=dtype, device=device)
      dim_t = self.temperature ** (
          2
          * torch.div(dim_t, 2, rounding_mode="floor")
          / self.hidden_dim
      )
  
      pos_x = x_embed[:, :, :, None] / dim_t
      pos_y = y_embed[:, :, :, None] / dim_t
      pos_x = torch.stack(
          (pos_x[:, :, :, 0::2].sin(), pos_x[:, :, :, 1::2].cos()),
          dim=4,
      ).flatten(3)
      pos_y = torch.stack(
          (pos_y[:, :, :, 0::2].sin(), pos_y[:, :, :, 1::2].cos()),
          dim=4,
      ).flatten(3)
      pos = torch.cat((pos_y, pos_x), dim=3).permute(0, 3, 1, 2)
      pos = self.token_projection(pos)
  
      return pos
  
imports: import math
  from collections import OrderedDict
  from functools import partial
  from typing import Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import trunc_normal_tf_, DropPath, LayerNorm2d, Mlp, SelectAdaptivePool2d, create_conv2d, use_fused_attn, NormMlpClassifierHead, ClassifierHead
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_module
  from ._manipulate import named_apply, checkpoint_seq
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 2 for calling the PositionalEncodingFourier obj's underlying member method code with example usage: obj.forward(shape) and returns: pos