class_docstr: This module generates the default boxes of SSD for a set of feature maps and image sizes.
  
  Args:
      aspect_ratios (List[List[int]]): A list with all the aspect ratios used in each feature map.
      min_ratio (float): The minimum scale :math:`    ext{s}_{        ext{min}}` of the default boxes used in the estimation
          of the scales of each feature map. It is used only if the ``scales`` parameter is not provided.
      max_ratio (float): The maximum scale :math:`    ext{s}_{        ext{max}}`  of the default boxes used in the estimation
          of the scales of each feature map. It is used only if the ``scales`` parameter is not provided.
      scales (List[float]], optional): The scales of the default boxes. If not provided it will be estimated using
          the ``min_ratio`` and ``max_ratio`` parameters.
      steps (List[int]], optional): It's a hyper-parameter that affects the tiling of default boxes. If not provided
          it will be estimated from the data.
      clip (bool): Whether the standardized values of default boxes should be clipped between 0 and 1. The clipping
          is applied while the boxes are encoded in format ``(cx, cy, w, h)``.
class_docstr_tok: ["This","module","generates","the","default","boxes","of","SSD","for","a","set","of","feature","maps","and","image","sizes",".","Args",":","aspect_ratios","(","List","[","List","[","int","]","]",")",":","A","list","with","all","the","aspect","ratios","used","in","each","feature","map",".","min_ratio","(","float",")",":","The","minimum","scale",":","math",":","`","ext","{","s","}","_","{","ext","{","min","}","}","`","of","the","default","boxes","used","in","the","estimation","of","the","scales","of","each","feature","map",".","It","is","used","only","if","the","``","scales","``","parameter","is","not","provided",".","max_ratio","(","float",")",":","The","maximum","scale",":","math",":","`","ext","{","s","}","_","{","ext","{","max","}","}","`","of","the","default","boxes","used","in","the","estimation","of","the","scales","of","each","feature","map",".","It","is","used","only","if","the","``","scales","``","parameter","is","not","provided",".","scales","(","List","[","float","]","]",",","optional",")",":","The","scales","of","the","default","boxes",".","If","not","provided","it","will","be","estimated","using","the","``","min_ratio","``","and","``","max_ratio","``","parameters",".","steps","(","List","[","int","]","]",",","optional",")",":","It","'s","a","hyper-parameter","that","affects","the","tiling","of","default","boxes",".","If","not","provided","it","will","be","estimated","from","the","data",".","clip","(","bool",")",":","Whether","the","standardized","values","of","default","boxes","should","be","clipped","between","0","and","1",".","The","clipping","is","applied","while","the","boxes","are","encoded","in","format","``","(","cx",",","cy",",","w",",","h",")","``","."]
code: def _grid_default_boxes(
      self,
      grid_sizes: List[List[int]],
      image_size: List[int],
      dtype: torch.dtype = torch.float32,
  ) -> Tensor:
      default_boxes = []
      for k, f_k in enumerate(grid_sizes):
          # Now add the default boxes for each width-height pair
          if self.steps is not None:
              x_f_k = image_size[1] / self.steps[k]
              y_f_k = image_size[0] / self.steps[k]
          else:
              y_f_k, x_f_k = f_k
  
          shifts_x = ((torch.arange(0, f_k[1]) + 0.5) / x_f_k).to(
              dtype=dtype
          )
          shifts_y = ((torch.arange(0, f_k[0]) + 0.5) / y_f_k).to(
              dtype=dtype
          )
          shift_y, shift_x = torch.meshgrid(
              shifts_y, shifts_x, indexing="ij"
          )
          shift_x = shift_x.reshape(-1)
          shift_y = shift_y.reshape(-1)
  
          shifts = torch.stack(
              (shift_x, shift_y) * len(self._wh_pairs[k]), dim=-1
          ).reshape(-1, 2)
          # Clipping the default boxes while the boxes are encoded in format (cx, cy, w, h)
          _wh_pair = (
              self._wh_pairs[k].clamp(min=0, max=1)
              if self.clip
              else self._wh_pairs[k]
          )
          wh_pairs = _wh_pair.repeat((f_k[0] * f_k[1]), 1)
  
          default_box = torch.cat((shifts, wh_pairs), dim=1)
  
          default_boxes.append(default_box)
  
      return torch.cat(default_boxes, dim=0)
  
imports: import math
  from typing import List, Optional
  import torch
  from torch import nn, Tensor
  from .image_list import ImageList
label_desc: Use image node_id 4 for calling the DefaultBoxGenerator obj's underlying member method code with example usage: obj._grid_default_boxes(grid_sizes, image_size, dtype) and returns: torch