class_docstr: NeRF solver class.
  
  Args:
      device: device for class tensors: Union[str, Device]
      dtype: type for all floating point calculations: torch.dtype
class_docstr_tok: ["NeRF","solver","class",".","Args",":","device",":","device","for","class","tensors",":","Union","[","str",",","Device","]","dtype",":","type","for","all","floating","point","calculations",":","torch.dtype"]
docstr: Initializes training settings and model.
  
  Args:
      cameras: Scene cameras in the order of input images.
      min_depth: sampled rays minimal depth from cameras.
      max_depth: sampled rays maximal depth from cameras.
      ndc: convert ray parameters to normalized device coordinates.
      imgs: Scene 2D images (one for each camera).
      num_img_rays: Number of rays to randomly cast from each camera: math: `(B)`.
      batch_size: Number of rays to sample in a batch.
      num_ray_points: Number of points to sample along rays.
      irregular_ray_sampling: Whether to sample ray points irregularly.
      log_space: Whether frequency sampling should be log spaced.
      lr: Learning rate.
docstr_tok: ["Initializes","training","settings","and","model",".","Args",":","cameras",":","Scene","cameras","in","the","order","of","input","images",".","min_depth",":","sampled","rays","minimal","depth","from","cameras",".","max_depth",":","sampled","rays","maximal","depth","from","cameras",".","ndc",":","convert","ray","parameters","to","normalized","device","coordinates",".","imgs",":","Scene","2D","images","(","one","for","each","camera",")",".","num_img_rays",":","Number","of","rays","to","randomly","cast","from","each","camera",":","math",":","`","(","B",")","`",".","batch_size",":","Number","of","rays","to","sample","in","a","batch",".","num_ray_points",":","Number","of","points","to","sample","along","rays",".","irregular_ray_sampling",":","Whether","to","sample","ray","points","irregularly",".","log_space",":","Whether","frequency","sampling","should","be","log","spaced",".","lr",":","Learning","rate","."]
code: def setup_solver(
      self,
      cameras: PinholeCamera,
      min_depth: float,
      max_depth: float,
      ndc: bool,
      imgs: Images,
      num_img_rays: Tensor | int,
      batch_size: int,
      num_ray_points: int,
      irregular_ray_sampling: bool = True,
      log_space_encoding: bool = True,
      lr: float = 1.0e-3,
  ) -> None:
      """Initializes training settings and model.
  
      Args:
          cameras: Scene cameras in the order of input images.
          min_depth: sampled rays minimal depth from cameras.
          max_depth: sampled rays maximal depth from cameras.
          ndc: convert ray parameters to normalized device coordinates.
          imgs: Scene 2D images (one for each camera).
          num_img_rays: Number of rays to randomly cast from each camera: math: `(B)`.
          batch_size: Number of rays to sample in a batch.
          num_ray_points: Number of points to sample along rays.
          irregular_ray_sampling: Whether to sample ray points irregularly.
          log_space: Whether frequency sampling should be log spaced.
          lr: Learning rate.
      """
      self._cameras = cameras
      self._min_depth = min_depth
      self._max_depth = max_depth
      self._ndc = ndc
  
      self._imgs = imgs
  
      KORNIA_CHECK(
          isinstance(batch_size, int) and batch_size > 0,
          "batch_size must be a positive integer",
      )
  
      KORNIA_CHECK(
          isinstance(num_ray_points, int) and num_ray_points > 0,
          "num_ray_points must be a positive integer",
      )
  
      KORNIA_CHECK(
          num_img_rays is not None, "num_img_rays must be specified"
      )
  
      if isinstance(num_img_rays, int):
          self._num_img_rays = tensor(
              [num_img_rays] * cameras.batch_size
          )
      elif torch.is_tensor(num_img_rays):
          self._num_img_rays = num_img_rays
      else:
          raise TypeError(
              "num_img_rays can be either an int or a Tensor"
          )
  
      self._batch_size = batch_size
  
      self._nerf_model = NerfModel(
          num_ray_points,
          irregular_ray_sampling=irregular_ray_sampling,
          log_space_encoding=log_space_encoding,
      )
      self._nerf_model.to(device=self._device, dtype=self._dtype)
  
      self._nerf_optimizer = optim.Adam(
          self._nerf_model.parameters(), lr=lr
      )
  
imports: from __future__ import annotations
  import logging
  from datetime import datetime
  from typing import cast
  import torch
  import torch.nn.functional
  from torch import optim
  from kornia.core import Module, Tensor, tensor
  from kornia.core.check import KORNIA_CHECK
  from kornia.geometry.camera import PinholeCamera
  from kornia.metrics import psnr
  from kornia.nerf.core import Images
  from kornia.nerf.data_utils import RayDataset, instantiate_ray_dataloader
  from kornia.nerf.nerf_model import NerfModel
  from kornia.utils import deprecated
label_desc: Use image node_id 2 for calling the NerfSolver obj's underlying member method code with example usage: obj.setup_solver(cameras, min_depth, max_depth, ndc, imgs, num_img_rays, batch_size, num_ray_points, irregular_ray_sampling, log_space_encoding, lr) without return types