code: def get_encoder(
      encoder_type,
      input_dim=3,
      multires=6,
      degree=4,
      num_levels=16,
      level_dim=2,
      base_resolution=16,
      log2_hashmap_size=19,
      desired_resolution=2048,
      align_corners=False,
      interpolation="linear",
      **kwargs,
  ):
      if encoder_type is None:
          return lambda x, **kwargs: x, input_dim
  
      elif encoder_type == "frequency_torch":
          encoder = FreqEncoder_torch(
              input_dim=input_dim,
              max_freq_log2=multires - 1,
              N_freqs=multires,
              log_sampling=True,
          )
  
      elif (
          encoder_type == "frequency"
      ):  # CUDA implementation, faster than torch.
          from nemo.collections.multimodal.modules.nerf.utils.torch_ngp.freqencoder import (
              FreqEncoder,
          )
  
          encoder = FreqEncoder(input_dim=input_dim, degree=multires)
  
      elif encoder_type == "sphere_harmonics":
          from nemo.collections.multimodal.modules.nerf.utils.torch_ngp.shencoder import (
              SHEncoder,
          )
  
          encoder = SHEncoder(input_dim=input_dim, degree=degree)
  
      elif encoder_type == "hashgrid":
          from nemo.collections.multimodal.modules.nerf.utils.torch_ngp.gridencoder import (
              GridEncoder,
          )
  
          encoder = GridEncoder(
              input_dim=input_dim,
              num_levels=num_levels,
              level_dim=level_dim,
              base_resolution=base_resolution,
              log2_hashmap_size=log2_hashmap_size,
              desired_resolution=desired_resolution,
              gridtype="hash",
              align_corners=align_corners,
              interpolation=interpolation,
          )
  
      elif encoder_type == "tiledgrid":
          from nemo.collections.multimodal.modules.nerf.utils.torch_ngp.gridencoder import (
              GridEncoder,
          )
  
          encoder = GridEncoder(
              input_dim=input_dim,
              num_levels=num_levels,
              level_dim=level_dim,
              base_resolution=base_resolution,
              log2_hashmap_size=log2_hashmap_size,
              desired_resolution=desired_resolution,
              gridtype="tiled",
              align_corners=align_corners,
              interpolation=interpolation,
          )
  
      else:
          raise NotImplementedError(
              "Unknown encoder type, choose from [None, frequency, sphere_harmonics, hashgrid, tiledgrid]"
          )
  
      return encoder, encoder.output_dim
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 for calling a global function with example usage: get_encoder(encoder_type, input_dim, multires, degree, num_levels, level_dim, base_resolution, log2_hashmap_size, desired_resolution, align_corners, interpolation) and returns: encoder,  encoder, function,  input_dim