code: def spatial_average(net: Tensor, keepdim: bool = True) -> Tensor:
      return net.mean([2, 3], keepdim=keepdim)
  
imports: import torch
  from torch import nn
  from torch import Tensor
  from ..misc.toolkit import download_model
  from ..misc.toolkit import set_requires_grad
  from ..modules.blocks import HijackConv2d
label_desc: Use image node_id 2 for calling a global function with example usage: spatial_average(net, keepdim) and returns: net