class_docstr: Implementation of paper "Born Again Neural Networks"
  https://arxiv.org/abs/1805.04770
  
  :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
  :param optimizer (torch.optim.*): Optimizer for training
  :param num_gen (int): Number of generations to train.
  :param loss_fn (torch.nn.Module): Loss Function used for first model in gen.
                                    later, KLDivLoss is used.
  :param temp (float): Temperature parameter for distillation
  :param distil_weight (float): Weight paramter for distillation loss
  :param device (str): Device 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","paper","``","Born","Again","Neural","Networks","''","https",":","\/\/arxiv.org\/abs\/1805.04770",":","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",":","param","optimizer","(","torch.optim",".","*",")",":","Optimizer","for","training",":","param","num_gen","(","int",")",":","Number","of","generations","to","train",".",":","param","loss_fn","(","torch.nn.Module",")",":","Loss","Function","used","for","first","model","in","gen.","later",",","KLDivLoss","is","used",".",":","param","temp","(","float",")",":","Temperature","parameter","for","distillation",":","param","distil_weight","(","float",")",":","Weight","paramter","for","distillation","loss",":","param","device","(","str",")",":","Device","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,
      student_model,
      train_loader,
      val_loader,
      optimizer,
      num_gen,
      loss_fn=nn.CrossEntropyLoss(),
      epoch_interval=5,
      temp=20.0,
      distil_weight=0.5,
      device="cpu",
      log=False,
      logdir="./Experiments",
  ):
      super(BANN, self).__init__(
          student_model,
          student_model,
          train_loader,
          val_loader,
          optimizer,
          optimizer,
          loss_fn,
          temp,
          distil_weight,
          device,
          log,
          logdir,
      )
      self.init_weights = deepcopy(student_model.state_dict())
      self.init_optim = deepcopy(optimizer.state_dict())
      self.num_gen = num_gen
      self.gen = 0
  
file_path: KD_Lib/KD_Lib/KD/vision/BANN/BANN.py
imports: import glob
  import os
  from copy import deepcopy
  import torch
  import torch.nn
  import torch.nn.functional
  from KD_Lib.KD.common import BaseClass
label_desc: Use image node_id 1 to create a new BANN object from inherited base classes: BaseClass with example: obj = BANN(student_model, train_loader, val_loader, optimizer, num_gen, loss_fn, epoch_interval, temp, distil_weight, device, log, logdir)