code: def render_test(args):
      dataset = dataset_dict[args.dataset_name]
      test_dataset = dataset(
          args.datadir,
          split="test",
          downsample=args.downsample_train,
          is_stack=True,
      )
      white_bg = test_dataset.white_bg
      ndc_ray = args.ndc_ray
      if not os.path.exists(args.ckpt):
          print("the ckpt path does not exist")
          return
      ckpt = torch.load(args.ckpt, map_location=device)
      kwargs = ckpt["kwargs"]
      kwargs.update({"device": device})
      kwargs["init_rank"] = args.init_rank
      kwargs["rank_inc"] = args.rank_inc
      tensorf = eval(args.model_name)(**kwargs)
      tensorf.load(ckpt)
      logfolder = os.path.dirname(args.ckpt)
      if args.render_train:
          os.makedirs(f"{logfolder}/imgs_train_all", exist_ok=True)
          train_dataset = dataset(
              args.datadir,
              split="train",
              downsample=args.downsample_train,
              is_stack=True,
          )
          PSNRs_test = evaluation(
              train_dataset,
              tensorf,
              args,
              renderer,
              f"{logfolder}/imgs_train_all/",
              N_vis=-1,
              N_samples=-1,
              white_bg=white_bg,
              ndc_ray=ndc_ray,
              device=device,
          )
          print(
              f"======> {args.expname} train all psnr: {np.mean(PSNRs_test)} <========================"
          )
      if args.render_test:
          os.makedirs(
              f"{logfolder}/{args.expname}/imgs_test_all", exist_ok=True
          )
          evaluation(
              test_dataset,
              tensorf,
              args,
              renderer,
              f"{logfolder}/{args.expname}/imgs_test_all/",
              N_vis=-1,
              N_samples=-1,
              white_bg=white_bg,
              ndc_ray=ndc_ray,
              device=device,
          )
      if args.render_path:
          c2ws = test_dataset.render_path
          os.makedirs(
              f"{logfolder}/{args.expname}/imgs_path_all", exist_ok=True
          )
          evaluation_path(
              test_dataset,
              tensorf,
              c2ws,
              renderer,
              f"{logfolder}/{args.expname}/imgs_path_all/",
              N_vis=-1,
              N_samples=-1,
              white_bg=white_bg,
              ndc_ray=ndc_ray,
              device=device,
          )
  
file_path: slimmerf/train.py
imports: import os
  from tqdm.auto import tqdm
  from opt import config_parser
  import json, random
  from renderer import *
  from utils import *
  from torch.utils.tensorboard import SummaryWriter
  import datetime
  from dataLoader import dataset_dict
  import sys
  from time import time
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: render_test(args) without return types