class_docstr: Base default handler to load torchscript or eager mode [state_dict] models
  Also, provides handle method per torch serve custom model specification
class_docstr_tok: ["Base","default","handler","to","load","torchscript","or","eager","mode","[","state_dict","]","models","Also",",","provides","handle","method","per","torch","serve","custom","model","specification"]
docstr: Custom method to generate pytorch profiler traces for preprocess/inference/postprocess
  
  Args:
      data (list): The input data that needs to be made a prediction request on.
  
  Returns:
      output : Returns a list of dictionary with the predicted response.
      prof: pytorch profiler object
docstr_tok: ["Custom","method","to","generate","pytorch","profiler","traces","for","preprocess\/inference\/postprocess","Args",":","data","(","list",")",":","The","input","data","that","needs","to","be","made","a","prediction","request","on",".","Returns",":","output",":","Returns","a","list","of","dictionary","with","the","predicted","response",".","prof",":","pytorch","profiler","object"]
code: def _infer_with_profiler(self, data):
      """Custom method to generate pytorch profiler traces for preprocess/inference/postprocess
  
      Args:
          data (list): The input data that needs to be made a prediction request on.
  
      Returns:
          output : Returns a list of dictionary with the predicted response.
          prof: pytorch profiler object
      """
      # Setting the default profiler arguments to profile cpu, gpu usage and record shapes
      # User can override this argument based on the requirement
      if not self.profiler_args:
          self.profiler_args["activities"] = [
              ProfilerActivity.CPU,
              ProfilerActivity.CUDA,
          ]
          self.profiler_args["record_shapes"] = True
  
      if "on_trace_ready" not in self.profiler_args:
          result_path = "/tmp/pytorch_profiler"
          dir_name = ""
          try:
              model_name = self.manifest["model"]["modelName"]
              dir_name = model_name
          except KeyError:
              logging.debug("Model name not found in config")
  
          result_path = os.path.join(result_path, dir_name)
          self.profiler_args[
              "on_trace_ready"
          ] = torch.profiler.tensorboard_trace_handler(result_path)
          logger.info("Saving chrome trace to : %s", result_path)
  
      with profile(**self.profiler_args) as prof:
          with record_function("preprocess"):
              data_preprocess = self.preprocess(data)
          if not self._is_explain():
              with record_function("inference"):
                  output = self.inference(data_preprocess)
              with record_function("postprocess"):
                  output = self.postprocess(output)
          else:
              with record_function("explain"):
                  output = self.explain_handle(data_preprocess, data)
  
      logger.info(
          prof.key_averages().table(
              sort_by="cpu_time_total", row_limit=10
          )
      )
      return output, prof
  
imports: import abc
  import importlib.util
  import logging
  import os
  import time
  import torch
  from pkg_resources import packaging
  from ts.handler_utils.timer import timed
  from ..utils.util import check_valid_pt2_backend, list_classes_from_module, load_label_mapping
label_desc: Use image node_id 11 for calling the BaseHandler obj's underlying member method code with example usage: obj._infer_with_profiler(data) and returns: output,  prof