code: def test_train_parametric_loss(self):
      heads_num_classes = 100
      pre_train_config = self._get_pre_train_config(
          head_num_classes=heads_num_classes
      )
      pre_train_config["loss"] = {
          "name": "batchnorm_cross_entropy_loss",
          "num_classes": heads_num_classes,
      }
      pre_train_task = build_task(pre_train_config)
      trainer = LocalTrainer()
      trainer.train(pre_train_task)
      checkpoint = get_checkpoint_dict(pre_train_task, {})
  
      fine_tuning_config = self._get_fine_tuning_config(
          head_num_classes=heads_num_classes
      )
      fine_tuning_config["loss"] = {
          "name": "batchnorm_cross_entropy_loss",
          "num_classes": heads_num_classes,
      }
  
      fine_tuning_task = build_task(fine_tuning_config)
      fine_tuning_task._set_pretrained_checkpoint_dict(
          copy.deepcopy(checkpoint)
      )
      # run in test mode to compare the loss state. Since we have a BatchNorm module in
      # the loss, its moving mean/std should be unchanged when we run in test-only mode
      fine_tuning_task.set_test_only(True)
      loss_state = copy.deepcopy(
          fine_tuning_task.loss.get_classy_state()
      )
      trainer.train(fine_tuning_task)
      self._compare_state_dict(
          loss_state, fine_tuning_task.loss.get_classy_state()
      )
  
imports: import copy
  import unittest
  from typing import Any, Dict
  from unittest import mock
  import torch
  import torch.nn
  from classy_vision.generic.util import get_checkpoint_dict
  from classy_vision.losses import ClassyLoss, register_loss
  from classy_vision.tasks import build_task, FineTuningTask
  from classy_vision.trainer import LocalTrainer
  from test.generic.config_utils import get_fast_test_task_config
  from test.generic.utils import compare_model_state
  from torch.nn.modules.loss import CrossEntropyLoss
label_desc: Use image node_id 8 for calling the TestFineTuningTask obj's underlying member method code with example usage: obj.test_train_parametric_loss() without return types