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","."]
code: def torchscript_using_trace(self, model):
      input_shape = (
          model.input_shape if hasattr(model, "input_shape") else None
      )
      if not input_shape:
          logging.warning(
              "This model doesn't implement input_shape."
              "Cannot save torchscripted model."
          )
          return
      input_data = get_model_dummy_input(
          model,
          input_shape,
          input_key=model.input_key
          if hasattr(model, "input_key")
          else None,
      )
      with eval_model(model) and torch.no_grad():
          torchscript = torch.jit.trace(
              model, input_data, strict=self.trace_strict
          )
      return torchscript
  
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 2 for calling the TorchscriptHook obj's underlying member method code with example usage: obj.torchscript_using_trace(model) and returns: torchscript