code: def calc_mean_std(feat, eps=1e-5):
      """Calculate mean and std for adaptive_instance_normalization.
  
      Args:
          feat (Tensor): 4D tensor.
          eps (float): A small value added to the variance to avoid
              divide-by-zero. Default: 1e-5.
      """
      size = feat.size()
      assert len(size) == 4, "The input feature should be 4D tensor."
      b, c = size[:2]
      feat_var = feat.view(b, c, -1).var(dim=2) + eps
      feat_std = feat_var.sqrt().view(b, c, 1, 1)
      feat_mean = feat.view(b, c, -1).mean(dim=2).view(b, c, 1, 1)
      return feat_mean, feat_std
  
imports: import math
  import torch
  from torch import nn, Tensor
  import torch.nn.functional
  from typing import Optional
  from modules.codeformer.vqgan_arch import VQAutoEncoder, ResBlock
  from basicsr.utils.registry import ARCH_REGISTRY
label_desc: Use image node_id 1 for calling a global function with example usage: calc_mean_std(feat, eps) and returns: feat_mean,  feat_std