class_docstr: Hook to convert a task model into torch script.
  
  Saves the torch scripts in torchscript_folder.
class_docstr_tok: ["Hook","to","convert","a","task","model","into","torch","script",".","Saves","the","torch","scripts","in","torchscript_folder","."]
docstr: Save model into torchscript by the end of training/testing.
docstr_tok: ["Save","model","into","torchscript","by","the","end","of","training\/testing","."]
code: def on_end(self, task) -> None:
      """Save model into torchscript by the end of training/testing."""
      if not is_primary():
          return
      self.save_torchscript(task)
  
file_path: ClassyVision/classy_vision/hooks/torchscript_hook.py
imports: import logging
  import torch
  from classy_vision.generic.distributed_util import is_primary
  from classy_vision.generic.util import eval_model, get_model_dummy_input
  from classy_vision.hooks import register_hook
  from classy_vision.hooks.classy_hook import ClassyHook
  from fvcore.common.file_io import PathManager
label_desc: Use image node_id 6 for calling the TorchscriptHook obj's underlying member method code with example usage: obj.on_end(task) without return types