code: def training_report(
      tb_writer,
      iteration,
      Ll1,
      loss,
      l1_loss,
      elapsed,
      testing_iterations,
      scene: Scene,
      renderFunc,
      renderArgs,
  ):
      if tb_writer:
          tb_writer.add_scalar(
              "train_loss_patches/l1_loss", Ll1.item(), iteration
          )
          tb_writer.add_scalar(
              "train_loss_patches/total_loss", loss.item(), iteration
          )
          tb_writer.add_scalar("iter_time", elapsed, iteration)
  
      # Report test and samples of training set
      if iteration in testing_iterations:
          torch.cuda.empty_cache()
          validation_configs = (
              {"name": "test", "cameras": scene.getTestCameras()},
              {
                  "name": "train",
                  "cameras": [
                      scene.getTrainCameras()[
                          idx % len(scene.getTrainCameras())
                      ]
                      for idx in range(5, 30, 5)
                  ],
              },
          )
  
          for config in validation_configs:
              if config["cameras"] and len(config["cameras"]) > 0:
                  l1_test = 0.0
                  psnr_test = 0.0
                  for idx, viewpoint in enumerate(config["cameras"]):
                      image = torch.clamp(
                          renderFunc(
                              viewpoint, scene.gaussians, *renderArgs
                          )["render"],
                          0.0,
                          1.0,
                      )
                      gt_image = torch.clamp(
                          viewpoint.original_image.to("cuda"), 0.0, 1.0
                      )
                      if tb_writer and (idx < 5):
                          tb_writer.add_images(
                              config["name"]
                              + "_view_{}/render".format(
                                  viewpoint.image_name
                              ),
                              image[None],
                              global_step=iteration,
                          )
                          if iteration == testing_iterations[0]:
                              tb_writer.add_images(
                                  config["name"]
                                  + "_view_{}/ground_truth".format(
                                      viewpoint.image_name
                                  ),
                                  gt_image[None],
                                  global_step=iteration,
                              )
                      l1_test += (
                          l1_loss(image, gt_image).mean().double()
                      )
                      psnr_test += psnr(image, gt_image).mean().double()
                  psnr_test /= len(config["cameras"])
                  l1_test /= len(config["cameras"])
                  print(
                      "\n[ITER {}] Evaluating {}: L1 {} PSNR {}".format(
                          iteration, config["name"], l1_test, psnr_test
                      )
                  )
                  if tb_writer:
                      tb_writer.add_scalar(
                          config["name"] + "/loss_viewpoint - l1_loss",
                          l1_test,
                          iteration,
                      )
                      tb_writer.add_scalar(
                          config["name"] + "/loss_viewpoint - psnr",
                          psnr_test,
                          iteration,
                      )
  
          if tb_writer:
              tb_writer.add_histogram(
                  "scene/opacity_histogram",
                  scene.gaussians.get_opacity,
                  iteration,
              )
              tb_writer.add_scalar(
                  "total_points",
                  scene.gaussians.get_xyz.shape[0],
                  iteration,
              )
          torch.cuda.empty_cache()
  
file_path: gaussian-splatting/train.py
imports: import os
  import torch
  from random import randint
  from utils.loss_utils import l1_loss, ssim
  from gaussian_renderer import render, network_gui
  import sys
  from scene import Scene, GaussianModel
  from utils.general_utils import safe_state
  import uuid
  from tqdm import tqdm
  from utils.image_utils import psnr
  from argparse import ArgumentParser, Namespace
  from arguments import ModelParams, PipelineParams, OptimizationParams
label_desc: Use image node_id 3 for calling a global function with example usage: training_report(tb_writer, iteration, Ll1, loss, l1_loss, elapsed, testing_iterations, scene, renderFunc, renderArgs) without return types