class_docstr: The standard BN layer computes stats across all examples in a GPU. In some
  cases it is desirable to compute stats across only a subset of examples
  (e.g., in multigrid training https://arxiv.org/abs/1912.00998).
  SubBatchNorm3d splits the batch dimension into N splits, and run BN on
  each of them separately (so that the stats are computed on each subset of
  examples (1/N of batch) independently. During evaluation, it aggregates
  the stats from all splits into one BN.
class_docstr_tok: ["The","standard","BN","layer","computes","stats","across","all","examples","in","a","GPU",".","In","some","cases","it","is","desirable","to","compute","stats","across","only","a","subset","of","examples","(","e.g.",",","in","multigrid","training","https",":","\/\/arxiv.org\/abs\/1912.00998",")",".","SubBatchNorm3d","splits","the","batch","dimension","into","N","splits",",","and","run","BN","on","each","of","them","separately","(","so","that","the","stats","are","computed","on","each","subset","of","examples","(","1\/N","of","batch",")","independently",".","During","evaluation",",","it","aggregates","the","stats","from","all","splits","into","one","BN","."]
docstr: Calculate the aggregated mean and stds.
  Args:
      means (tensor): mean values.
      stds (tensor): standard deviations.
      n (int): number of sets of means and stds.
docstr_tok: ["Calculate","the","aggregated","mean","and","stds",".","Args",":","means","(","tensor",")",":","mean","values",".","stds","(","tensor",")",":","standard","deviations",".","n","(","int",")",":","number","of","sets","of","means","and","stds","."]
code: def _get_aggregated_mean_std(self, means, stds, n):
      """
      Calculate the aggregated mean and stds.
      Args:
          means (tensor): mean values.
          stds (tensor): standard deviations.
          n (int): number of sets of means and stds.
      """
      mean = means.view(n, -1).sum(0) / n
      std = (
          stds.view(n, -1).sum(0) / n
          + ((means.view(n, -1) - mean) ** 2).view(n, -1).sum(0) / n
      )
      return mean.detach(), std.detach()
  
file_path: SlowFast/slowfast/models/batchnorm_helper.py
imports: from functools import partial
  import torch
  import torch.nn
  from pytorchvideo.layers.batch_norm import NaiveSyncBatchNorm1d, NaiveSyncBatchNorm3d
label_desc: Use image node_id 2 for calling the SubBatchNorm3d obj's underlying member method code with example usage: obj._get_aggregated_mean_std(means, stds, n) and returns: mean,  std