code: def maybe_scale_by_batch_size(grad_sample, expanded_weight):
      if expanded_weight.loss_reduction == "mean":
          return grad_sample * expanded_weight.batch_size
      else:
          return grad_sample
  
file_path: pytorch/torch/nn/utils/_expanded_weights/expanded_weights_utils.py
imports: from typing import Optional
  import torch
  from .expanded_weights_impl import ExpandedWeight
label_desc: Use image node_id 5 for calling a global function with example usage: maybe_scale_by_batch_size(grad_sample, expanded_weight) and returns: unknown, grad_sample