class_docstr: Base class for defining distillation loss functions. Sub-classes must implement `_forward_distill` function.
  
  Args:
      opts: command line arguments
docstr: Compute logits from teacher given input image tensor.
  
  Args:
      input_sample: Input image tensor
  
  Shape:
      input_sample: Shape is [Batch size, 3, height, width]
      teacher_output or teacher_output["logits"]: Shape is [Batch size, number of classes]
  
  Returns:
      Teacher output tensor (without softmax)
  
  ...note:
      The output of teacher can be Tensor or Dict[str, Tensor]. In case
      of dictionary, logits is a mandatory key.
docstr_tok: ["Compute","logits","from","teacher","given","input","image","tensor",".","Args",":","input_sample",":","Input","image","tensor","Shape",":","input_sample",":","Shape","is","[","Batch","size",",","3",",","height",",","width","]","teacher_output","or","teacher_output","[","``","logits","''","]",":","Shape","is","[","Batch","size",",","number","of","classes","]","Returns",":","Teacher","output","tensor","(","without","softmax",")","...","note",":","The","output","of","teacher","can","be","Tensor","or","Dict","[","str",",","Tensor","]",".","In","case","of","dictionary",",","logits","is","a","mandatory","key","."]
code: def _logits_from_teacher(self, input_sample: Tensor) -> Tensor:
      """Compute logits from teacher given input image tensor.
  
      Args:
          input_sample: Input image tensor
  
      Shape:
          input_sample: Shape is [Batch size, 3, height, width]
          teacher_output or teacher_output["logits"]: Shape is [Batch size, number of classes]
  
      Returns:
          Teacher output tensor (without softmax)
  
      ...note:
          The output of teacher can be Tensor or Dict[str, Tensor]. In case
          of dictionary, logits is a mandatory key.
      """
      self.teacher.eval()
      teacher_output: Union[
          Tensor, Mapping[str, Tensor]
      ] = self.teacher(input_sample)
      if isinstance(teacher_output, Mapping):
          if "logits" not in teacher_output:
              logger.error(
                  "The output type of teacher is dictionary and must contain logits as a key."
                  f"Got: {teacher_output.keys()}"
              )
          return teacher_output["logits"]
      return teacher_output
  
file_path: ml-cvnets/loss_fn/distillation/base_distillation.py
imports: import argparse
  from typing import Mapping, Union
  import torch
  from torch import Tensor
  from loss_fn import LOSS_REGISTRY, BaseCriteria
  from loss_fn.utils.build_helper import build_cls_teacher_from_opts
  from utils import logger
label_desc: Use image node_id 3 for calling the BaseDistillationCriteria obj's underlying member method code with example usage: obj._logits_from_teacher(input_sample) and returns: teacher_output, teacher_output