code: def build_attention_bias(
      resolution: tuple[int, int]
  ) -> tuple[Tensor, int]:
      points = list(
          itertools.product(range(resolution[0]), range(resolution[1]))
      )
      attention_offsets: dict[tuple[int, int], int] = {}
      idxs: list[int] = []
      for p1 in points:
          for p2 in points:
              offset = (abs(p1[0] - p2[0]), abs(p1[1] - p2[1]))
              if offset not in attention_offsets:
                  attention_offsets[offset] = len(attention_offsets)
              idxs.append(attention_offsets[offset])
  
      N = len(points)
      indices = torch.LongTensor(idxs).view(N, N)
      attn_offset_size = len(attention_offsets)
      return indices, attn_offset_size
  
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Any, Optional
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.utils import checkpoint
  from kornia.contrib.models.common import DropPath, LayerNorm2d, window_partition, window_unpartition
  from kornia.core import Module, Tensor
  from kornia.core.check import KORNIA_CHECK
label_desc: Use image node_id 2 for calling the Attention obj's underlying member method code with example usage: obj.build_attention_bias(resolution) and returns: indices,  attn_offset_size