class_docstr: Torch Estimator implementation for Image Classification.
  
  Parameters
  ----------
  config : dict
      Config in nested dict.
  logger : logging.Logger
      Optional logger for this estimator, can be `None` when default setting is used.
  reporter : callable
      The reporter for metric checkpointing.
  net : torch.nn.Module
      The custom network. If defined, the model name in config will be ignored so your
      custom network will be used for training rather than pulling it from model zoo.
code: def _init_network(self, **kwargs):
      load_only = kwargs.get("load_only", False)
      if not self.num_class and self._problem_type != REGRESSION:
          raise ValueError(
              "This is a classification problem and we are not able to create network when `num_class` is unknown. \
                  It should be inferred from dataset or resumed from saved states."
          )
      assert len(self.classes) == self.num_class
  
      # Disable syncBatchNorm as it's only supported on DDP
      if self._train_cfg.sync_bn:
          self._logger.info(
              "Disable Sync batch norm as it is not supported for now."
          )
          update_cfg(self._cfg, {"train": {"sync_bn": False}})
  
      # ctx
      self.found_gpu = False
      valid_gpus = []
      if self._cfg.gpus:
          valid_gpus = self._torch_validate_gpus(self._cfg.gpus)
          self.found_gpu = True
          if not valid_gpus:
              self.found_gpu = False
              self._logger.warning(
                  "No gpu detected, fallback to cpu. You can ignore this warning if this is intended."
              )
          elif len(valid_gpus) != len(self._cfg.gpus):
              self._logger.warning(
                  f"Loaded on gpu({valid_gpus}), different from gpu({self._cfg.gpus})."
              )
      self.ctx = (
          [torch.device(f"cuda:{gid}") for gid in valid_gpus]
          if self.found_gpu
          else [torch.device("cpu")]
      )
      self.valid_gpus = valid_gpus
  
      if not self.found_gpu and self.use_amp:
          self.use_amp = None
          self._logger.warning("Training on cpu. AMP disabled.")
          update_cfg(
              self._cfg,
              {
                  "misc": {
                      "amp": False,
                      "apex_amp": False,
                      "native_amp": False,
                  }
              },
          )
  
      if not self.found_gpu and self._misc_cfg.prefetcher:
          self._logger.warning("Training on cpu. Prefetcher disabled.")
          update_cfg(self._cfg, {"misc": {"prefetcher": False}})
          self._logger.warning(
              "Training on cpu. SyncBatchNorm disabled."
          )
          update_cfg(self._cfg, {"train": {"sync_bn": False}})
  
      random_seed(self._misc_cfg.seed)
  
      if not self.net:
          self.net = create_model(
              self._img_cls_cfg.model,
              pretrained=self._img_cls_cfg.pretrained and not load_only,
              num_classes=max(self.num_class, 1),
              global_pool=self._img_cls_cfg.global_pool_type,
              drop_rate=self._augmentation_cfg.drop,
              drop_path_rate=self._augmentation_cfg.drop_path,
              drop_block_rate=self._augmentation_cfg.drop_block,
              bn_momentum=self._train_cfg.bn_momentum,
              bn_eps=self._train_cfg.bn_eps,
              scriptable=self._misc_cfg.torchscript,
          )
  
          self._logger.info(
              f"Model {safe_model_name(self._img_cls_cfg.model)} created, param count: \
                                          {sum([m.numel() for m in self.net.parameters()])}"
          )
      else:
          self._logger.info(
              f"Use user provided model. Neglect model in config."
          )
          out_features = list(self.net.children())[-1].out_features
          if self._problem_type != REGRESSION:
              assert (
                  out_features == self.num_class
              ), f"Custom model out_feature {out_features} != num_class {self.num_class}."
          else:
              assert (
                  out_features == 1
              ), f"Regression problem expects num_out_feature == 1, got {out_features} instead."
  
      resolve_data_config(self._cfg, model=self.net)
  
      self.net = self.net.to(self.ctx[0])
  
      # setup synchronized BatchNorm
      if self._train_cfg.sync_bn:
          if has_apex and self.use_amp != "native":
              # Apex SyncBN preferred unless native amp is activated
              self.net = convert_syncbn_model(self.net)
          else:
              self.net = torch.nn.SyncBatchNorm.convert_sync_batchnorm(
                  self.net
              )
          self._logger.info(
              "Converted model to use Synchronized BatchNorm. WARNING: You may have issues if using "
              "zero initialized BN layers (enabled by default for ResNets) while sync-bn enabled."
          )
  
      if self._misc_cfg.torchscript:
          assert (
              not self.use_amp == "apex"
          ), "Cannot use APEX AMP with torchscripted model"
          assert (
              not self._train_cfg.sync_bn
          ), "Cannot use SyncBatchNorm with torchscripted model"
          self.net = torch.jit.script(self.net)
  
imports: import math
  import copy
  import os
  import logging
  import time
  import warnings
  import pickle
  from contextlib import suppress
  from PIL import Image
  import pandas
  import numpy
  import torch
  import torch.nn
  import torchvision.utils
  from torch.optim.optimizer import Optimizer
  from timm.data import create_loader, Mixup, FastCollateMixup, AugMixDataset
  from timm.models import create_model, safe_model_name, convert_splitbn_model, model_parameters
  from timm.utils import random_seed, dispatch_clip_grad, accuracy, unwrap_model, get_state_dict
  from timm.optim import create_optimizer_v2
  from timm.utils import ApexScaler, NativeScaler, ModelEmaV2, AverageMeter
  from timm.loss import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy
  from .default import TorchImageClassificationCfg
  from .utils import resolve_data_config, update_cfg, optimizer_kwargs, create_scheduler, rmse, create_optimizer_v2a
  from ..constants import BINARY, MULTICLASS, REGRESSION
  from ..utils import EarlyStopperOnPlateau
  from ..utils import _suggest_load_context
  from ..conf import _BEST_CHECKPOINT_FILE
  from ..base_estimator import BaseEstimator, set_default
label_desc: Use image node_id 7 for calling the TorchImageClassificationEstimator obj's underlying member method code with example usage: obj._init_network() without return types