class_docstr: Class to represent NeRF model.
  
  Args:
      num_ray_points: Number of points to sample along rays.
      irregular_ray_sampling: Whether to sample ray points irregularly.
      num_pos_freqs: Number of frequencies for positional encoding.
      num_dir_freqs: Number of frequencies for directional encoding.
      num_units: Number of sub-units.
      num_unit_layers: Number of fully connected layers in each sub-unit.
      num_hidden: Layer hidden dimensions.
      log_space_encoding: Whether to apply log spacing for encoding.
code: def __init__(
      self,
      num_ray_points: int,
      irregular_ray_sampling: bool = True,
      num_pos_freqs: int = 10,
      num_dir_freqs: int = 4,
      num_units: int = 2,
      num_unit_layers: int = 4,
      num_hidden: int = 128,  # FIXME: add as call argument
      log_space_encoding: bool = True,
  ) -> None:
      super().__init__()
      self._num_ray_points = num_ray_points
      self._irregular_ray_sampling = irregular_ray_sampling
      self._renderer = (
          IrregularRenderer()
          if self._irregular_ray_sampling
          else RegularRenderer()
      )
  
      self._pos_encoder = PositionalEncoder(
          3, num_pos_freqs, log_space=log_space_encoding
      )
      self._dir_encoder = PositionalEncoder(
          3, num_dir_freqs, log_space=log_space_encoding
      )
      self._mlp = MLP(
          self._pos_encoder.num_encoded_dims,
          num_units,
          num_unit_layers,
          num_hidden,
      )
      self._fc1 = nn.Linear(num_hidden, num_hidden)
      self._fc2 = nn.Sequential(
          nn.Linear(
              num_hidden + self._dir_encoder.num_encoded_dims,
              num_hidden // 2,
          ),
          nn.ReLU(),
      )
  
      self._sigma = nn.Linear(num_hidden, 1, bias=True)
      torch.nn.init.xavier_uniform_(self._sigma.weight.data)
      self._sigma.bias.data = torch.tensor([0.1]).float()
  
      self._rgb = nn.Sequential(
          nn.Linear(num_hidden // 2, 3), nn.Sigmoid()
      )
      self._rgb[0].bias.data = torch.tensor([0.02, 0.02, 0.02]).float()
  
imports: from __future__ import annotations
  import torch
  from torch import nn
  from torch.nn import functional
  from kornia.core import Module, Tensor
  from kornia.geometry.camera import PinholeCamera
  from kornia.geometry.ray import Ray
  from kornia.nerf.positional_encoder import PositionalEncoder
  from kornia.nerf.samplers import sample_lengths, sample_ray_points
  from kornia.nerf.volume_renderer import IrregularRenderer, RegularRenderer
  from kornia.utils._compat import torch_inference_mode
  from kornia.utils.grid import create_meshgrid
label_desc: Use image node_id 1 to create a new NerfModel object from inherited base classes: Module with example: obj = NerfModel(num_ray_points, irregular_ray_sampling, num_pos_freqs, num_dir_freqs, num_units, num_unit_layers, num_hidden, log_space_encoding)