code: def forward(ctx, inputs, degree, calc_grad_inputs=False):
      # inputs: [B, input_dim], float in [-1, 1]
      # RETURN: [B, F], float
  
      inputs = inputs.contiguous()
      B, input_dim = inputs.shape  # batch size, coord dim
      output_dim = degree**2
  
      outputs = torch.empty(
          B, output_dim, dtype=inputs.dtype, device=inputs.device
      )
  
      if calc_grad_inputs:
          dy_dx = torch.empty(
              B,
              input_dim * output_dim,
              dtype=inputs.dtype,
              device=inputs.device,
          )
      else:
          dy_dx = None
  
      _backend.sh_encode_forward(
          inputs, outputs, B, input_dim, degree, dy_dx
      )
  
      ctx.save_for_backward(inputs, dy_dx)
      ctx.dims = [B, input_dim, degree]
  
      return outputs
  
file_path: NeMo/nemo/collections/multimodal/modules/nerf/utils/torch_ngp/shencoder.py
imports: import _shencoder
  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 1 for calling the _sh_encoder obj's underlying member method code with example usage: obj.forward(ctx, inputs, degree, calc_grad_inputs) and returns: outputs