code: def __init__(self, config):
      self.config = config
  
      if not torch.cuda.is_available():
          self.torch_model = torch.load(
              config["PytorchModel"],
              map_location=lambda storage, loc: storage,
          )
      else:
          self.torch_model = torch.load(config["PytorchModel"])
  
      # Get input tensor's shape
      self.input_shape = config.get("InputShape")
  
      if self.input_shape is None:
          raise Exception(
              'Must specify input shape ("InputShape") in config!'
          )
  
      # Convert it to a list
      self.input_shape = self.input_shape.strip("(,)").split(",")
      self.input_shape = [
          None if n == "None" else int(n) for n in self.input_shape
      ]
  
      self.state_dict = self.torch_model.state_dict()
  
file_path: hls4ml/hls4ml/converters/pytorch_to_hls.py
imports: import torch
  from hls4ml.model import ModelGraph
label_desc: Use image node_id 1 to create a new PyTorchFileReader object from inherited base classes: PyTorchModelReader with example: obj = PyTorchFileReader(config)