class_docstr: Recompute and update the batch norm stats to make them more precise. During
  training both BN stats and the weight are changing after every iteration, so
  the running average can not precisely reflect the actual stats of the
  current model.
  In this callaback, the BN stats are recomputed with fixed weights, to make
  the running average more precise during Training Phase. Specifically, it
  computes the true average of per-batch mean/variance instead of the
  running average. See Sec. 3 of the paper "Rethinking Batch in BatchNorm"
  for details.
class_docstr_tok: ["Recompute","and","update","the","batch","norm","stats","to","make","them","more","precise",".","During","training","both","BN","stats","and","the","weight","are","changing","after","every","iteration",",","so","the","running","average","can","not","precisely","reflect","the","actual","stats","of","the","current","model",".","In","this","callaback",",","the","BN","stats","are","recomputed","with","fixed","weights",",","to","make","the","running","average","more","precise","during","Training","Phase",".","Specifically",",","it","computes","the","true","average","of","per-batch","mean\/variance","instead","of","the","running","average",".","See","Sec",".","3","of","the","paper","``","Rethinking","Batch","in","BatchNorm","''","for","details","."]
docstr: Args:
      num_batches (int): Number of steps / mini-batches to
      perform to sample for updating the precise batchnorm
      stats.
docstr_tok: ["Args",":","num_batches","(","int",")",":","Number","of","steps","\/","mini-batches","to","perform","to","sample","for","updating","the","precise","batchnorm","stats","."]
code: def __init__(self, num_batches: int) -> None:
      """
      Args:
          num_batches (int): Number of steps / mini-batches to
          perform to sample for updating the precise batchnorm
          stats.
      """
      self.num_batches = num_batches
  
file_path: pytorchvideo/pytorchvideo_trainer/pytorchvideo_trainer/callbacks/precise_batchnorm.py
imports: from typing import Generator
  import torch
  from fvcore.nn.precise_bn import update_bn_stats
  from pytorch_lightning.callbacks import Callback
  from pytorch_lightning.core.lightning import LightningModule
  from pytorch_lightning.trainer.trainer import Trainer
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 to create a new PreciseBn object from inherited base classes: Callback with example: obj = PreciseBn(num_batches)