class_docstr: Implementation of the soft randomization framework from the paper
  "Improving Generalization Robustness with Noisy Collaboration in Knowledge Distillation"
  https://arxiv.org/abs/1910.05057
  
  :param teacher_model (torch.nn.Module): Teacher model
  :param student_model (torch.nn.Module): Student model
  :param train_loader (torch.utils.data.DataLoader): Dataloader for training
  :param val_loader (torch.utils.data.DataLoader): Dataloader for validation/testing
  :param optimizer_teacher (torch.optim.*): Optimizer used for training teacher
  :param optimizer_student (torch.optim.*): Optimizer used for training student
  :param noise_variance (float): Variance parameter for adding noise
  :param loss_fn (torch.nn.Module):  Calculates loss during distillation
  :param temp (float): Temperature parameter for distillation
  :param distil_weight (float): Weight paramter for distillation loss
  :param device (str): Device used for training; 'cpu' for cpu and 'cuda' for gpu
  :param log (bool): True if logging required
  :param logdir (str): Directory for storing logs
class_docstr_tok: ["Implementation","of","the","soft","randomization","framework","from","the","paper","''","Improving","Generalization","Robustness","with","Noisy","Collaboration","in","Knowledge","Distillation","''","https",":","\/\/arxiv.org\/abs\/1910.05057",":","param","teacher_model","(","torch.nn.Module",")",":","Teacher","model",":","param","student_model","(","torch.nn.Module",")",":","Student","model",":","param","train_loader","(","torch.utils.data.DataLoader",")",":","Dataloader","for","training",":","param","val_loader","(","torch.utils.data.DataLoader",")",":","Dataloader","for","validation\/testing",":","param","optimizer_teacher","(","torch.optim",".","*",")",":","Optimizer","used","for","training","teacher",":","param","optimizer_student","(","torch.optim",".","*",")",":","Optimizer","used","for","training","student",":","param","noise_variance","(","float",")",":","Variance","parameter","for","adding","noise",":","param","loss_fn","(","torch.nn.Module",")",":","Calculates","loss","during","distillation",":","param","temp","(","float",")",":","Temperature","parameter","for","distillation",":","param","distil_weight","(","float",")",":","Weight","paramter","for","distillation","loss",":","param","device","(","str",")",":","Device","used","for","training",";","'cpu","'","for","cpu","and","'cuda","'","for","gpu",":","param","log","(","bool",")",":","True","if","logging","required",":","param","logdir","(","str",")",":","Directory","for","storing","logs"]
code: def __init__(
      self,
      teacher_model,
      student_model,
      train_loader,
      val_loader,
      optimizer_teacher,
      optimizer_student,
      noise_variance=0.1,
      loss_fn=nn.KLDivLoss(),
      temp=20.0,
      distil_weight=0.5,
      device="cpu",
      log=False,
      logdir="./Experiments",
  ):
      super(SoftRandom, self).__init__(
          teacher_model,
          student_model,
          train_loader,
          val_loader,
          optimizer_teacher,
          optimizer_student,
          loss_fn,
          temp,
          distil_weight,
          device,
          log,
          logdir,
      )
  
      self.noise_variance = noise_variance
  
file_path: KD_Lib/KD_Lib/KD/vision/noisy/soft_random.py
imports: from copy import deepcopy
  import matplotlib.pyplot
  import torch
  import torch.nn
  import torch.nn.functional
  from KD_Lib.KD.common import BaseClass
  from .utils import add_noise
label_desc: Use image node_id 1 to create a new SoftRandom object from inherited base classes: BaseClass with example: obj = SoftRandom(teacher_model, student_model, train_loader, val_loader, optimizer_teacher, optimizer_student, noise_variance, loss_fn, temp, distil_weight, device, log, logdir)