code: def grad_weight_decay(self, weight=0.1):
      # level-wise meaned weight decay (ref: zip-nerf)
  
      B = self.embeddings.shape[0]  # size of embedding
      C = self.embeddings.shape[1]  # embedding dim for each level
      L = self.offsets.shape[0] - 1  # level
  
      if self.embeddings.grad is None:
          raise ValueError(
              "grad is None, should be called after loss.backward() and before optimizer.step()!"
          )
  
      _backend.grad_weight_decay(
          self.embeddings,
          self.embeddings.grad,
          self.offsets,
          weight,
          B,
          C,
          L,
      )
  
file_path: NeMo/nemo/collections/multimodal/modules/nerf/utils/torch_ngp/gridencoder.py
imports: import math
  import _gridencoder
  import numpy
  import torch
  import torch.nn
  from torch.autograd import Function
  from torch.cuda.amp import custom_bwd, custom_fwd
label_desc: Use image node_id 6 for calling the GridEncoder obj's underlying member method code with example usage: obj.grad_weight_decay(weight) without return types