code: def initialize_class_weights(self, sub_train):
      if self.class_weight == "balanced":
          if self.multi_label:
              warnings.warn(
                  "Setting class_weight to 'balanced' is intended for the "
                  "single-label use case and might not have a beneficial "
                  "effect for multi-label classification"
              )
          class_weights_ = get_class_weights(
              sub_train.y, self.num_classes
          )
          class_weights_ = class_weights_.to(self.device)
      elif self.class_weight is None:
          class_weights_ = None
      else:
          raise ValueError(
              f"Invalid value for class_weight kwarg: {self.class_weight}"
          )
  
      return class_weights_
  
imports: import logging
  import warnings
  from abc import abstractmethod
  from functools import partial
  from pathlib import Path
  from small_text.classifiers.classification import Classifier
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.training.early_stopping import EarlyStopping, NoopEarlyStopping, EarlyStoppingOrCondition
  from small_text.training.metrics import Metric
  from small_text.training.model_selection import ModelSelection, NoopModelSelection
  from small_text.utils.classification import empty_result, prediction_result
label_desc: Use image node_id 12 for calling the PytorchClassifier obj's underlying member method code with example usage: obj.initialize_class_weights(sub_train) and returns: class_weights_