class_docstr: Implement :paper:`ResNet`.
class_docstr_tok: ["Implement",":","paper",":","`","ResNet","`","."]
docstr: Freeze the first several stages of the ResNet. Commonly used in
  fine-tuning.
  
  Layers that produce the same feature map spatial size are defined as one
  "stage" by :paper:`FPN`.
  
  Args:
      freeze_at (int): number of stages to freeze.
          `1` means freezing the stem. `2` means freezing the stem and
          one residual stage, etc.
  
  Returns:
      nn.Module: this ResNet itself
docstr_tok: ["Freeze","the","first","several","stages","of","the","ResNet",".","Commonly","used","in","fine-tuning",".","Layers","that","produce","the","same","feature","map","spatial","size","are","defined","as","one","''","stage","''","by",":","paper",":","`","FPN","`",".","Args",":","freeze_at","(","int",")",":","number","of","stages","to","freeze",".","`","1","`","means","freezing","the","stem",".","`","2","`","means","freezing","the","stem","and","one","residual","stage",",","etc",".","Returns",":","nn.Module",":","this","ResNet","itself"]
code: def freeze(self, freeze_at=0):
      """
      Freeze the first several stages of the ResNet. Commonly used in
      fine-tuning.
  
      Layers that produce the same feature map spatial size are defined as one
      "stage" by :paper:`FPN`.
  
      Args:
          freeze_at (int): number of stages to freeze.
              `1` means freezing the stem. `2` means freezing the stem and
              one residual stage, etc.
  
      Returns:
          nn.Module: this ResNet itself
      """
      if freeze_at >= 1:
          self.stem.freeze()
      for idx, stage in enumerate(self.stages, start=2):
          if freeze_at >= idx:
              for block in stage.children():
                  block.freeze()
      return self
  
imports: import numpy
  import fvcore.nn.weight_init
  import torch
  import torch.nn.functional
  from torch import nn
  from detectron2.layers import CNNBlockBase, Conv2d, DeformConv, ModulatedDeformConv, ShapeSpec, get_norm
  from .backbone import Backbone
  from .build import BACKBONE_REGISTRY
label_desc: Use image node_id 4 for calling the ResNet obj's underlying member method code with example usage: obj.freeze(freeze_at) and returns: self