docstr: Record l2 norm of this chunks on CUDA.
docstr_tok: ["Record","l2","norm","of","this","chunks","on","CUDA","."]
code: def set_l2_norm(self) -> None:
      """Record l2 norm of this chunks on CUDA."""
      assert (
          self.l2_norm is None
      ), "you are calculating the l2 norm twice"
      if self.is_gathered:
          valid_tensor = self.cuda_global_chunk[: self.utilized_size]
      else:
          assert self.cuda_shard is not None  # calculate on CUDA
          valid_tensor = self.cuda_shard[: self.valid_end]
      chunk_l2_norm = valid_tensor.data.float().norm(2)
      self.l2_norm = chunk_l2_norm.item() ** 2
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Dict, List, Optional
  import torch
  import torch.distributed
  from torch.distributed import ProcessGroup
  from colossalai.utils import get_current_device
  from colossalai.utils.device import IS_NPU_AVAILABLE
label_desc: Use image node_id 10 for calling the Chunk obj's underlying member method code with example usage: obj.set_l2_norm() without return types