class_docstr: TorchPoints3d Trainer handles the logic between
      - BaseModel,
      - Dataset and its Tracker
      - A custom ModelCheckpoint
      - A custom Visualizer
  It supports MC dropout - multiple voting_runs for val / test datasets
class_docstr_tok: ["TorchPoints3d","Trainer","handles","the","logic","between","-","BaseModel",",","-","Dataset","and","its","Tracker","-","A","custom","ModelCheckpoint","-","A","custom","Visualizer","It","supports","MC","dropout","-","multiple","voting_runs","for","val","\/","test","datasets"]
code: def _train_epoch(self, epoch: int):
      self._model.train()
      self._tracker.reset("train")
      self._visualizer.reset(epoch, "train")
      train_loader = self._dataset.train_dataloader
  
      with self.profiler_profile(epoch) as prof:
          iter_data_time = time.time()
          with Ctq(train_loader) as tq_train_loader:
              for i, data in enumerate(tq_train_loader):
                  t_data = time.time() - iter_data_time
                  iter_start_time = time.time()
  
                  with self.profiler_record_function("train_step"):
                      self._model.set_input(data, self._device)
                      self._model.optimize_parameters(
                          epoch, self._dataset.batch_size
                      )
  
                  with self.profiler_record_function(
                      "track/log/visualize"
                  ):
                      if i % 10 == 0:
                          with torch.no_grad():
                              self._tracker.track(
                                  self._model,
                                  data=data,
                                  **self.tracker_options,
                              )
  
                      tq_train_loader.set_postfix(
                          **self._tracker.get_metrics(),
                          data_loading=float(t_data),
                          iteration=float(
                              time.time() - iter_start_time
                          ),
                          color=COLORS.TRAIN_COLOR,
                      )
  
                      if self._visualizer.is_active:
                          self._visualizer.save_visuals(
                              self._model.get_current_visuals()
                          )
  
                  iter_data_time = time.time()
  
                  if self.pytorch_profiler_log:
                      prof.step()
  
                  if self.early_break:
                      break
  
                  if self.profiling:
                      if i > self.num_batches:
                          return 0
  
      self._finalize_epoch(epoch)
  
imports: import os
  import copy
  import torch
  import hydra
  import time
  import logging
  from tqdm.auto import tqdm
  import wandb
  from torch_points3d.datasets.dataset_factory import instantiate_dataset
  from torch_points3d.models.model_factory import instantiate_model
  from torch_points3d.models.base_model import BaseModel
  from torch_points3d.datasets.base_dataset import BaseDataset
  from torch_points3d.metrics.base_tracker import BaseTracker
  from torch_points3d.metrics.colored_tqdm import Coloredtqdm
  from torch_points3d.metrics.model_checkpoint import ModelCheckpoint
  from torch_points3d.utils.colors import COLORS
  from torch_points3d.utils.wandb_utils import Wandb
  from torch_points3d.visualization import Visualizer
  import torch.profiler
  import torch.autograd.profiler
  from contextlib import nullcontext
label_desc: Use image node_id 6 for calling the Trainer obj's underlying member method code with example usage: obj._train_epoch(epoch) and returns: int