code: def convert(
      model: str,
      output: str,
      input_shape: List[int],
      net_path,
      net_name,
  ):
      """Convert PyTorch model to tfLite model
  
      Args:
          model (str): PyTorch model file path
          output (str): output file name for Keras
          input_shape (List[int]): Tensor shape for input
          net_path ([type]): Python script defines the model
          net_name ([type]): PyTorch model class in the `net_path` file.
      """
  
      x = torch.randn(
          *input_shape, requires_grad=True
      )  # pylint: disable=no-member
      load_package(net_path, net_name)
      model = torch.load(model)
  
      # convert to keras model first
      # change_ordering experimental, change BCHW to BHWC to enable conversion to tflite
      k_model = pytorch_to_keras(
          model,
          x,
          [input_shape[1:]],
          verbose=False,
          change_ordering=True,
      )
      k_model.save("tmp.h5")
  
      # convert to tflite model
      converter = create_converter("tmp.h5", model_loader)
      tflite_model = converter.convert()
      with open(output, "wb") as f:
          f.write(tflite_model)
      remove("tmp.h5")
  
file_path: auptimizer/src/aup/dlconvert/pytorch_to_tflite.py
imports: import tf2onnx
  from pytorch2keras import pytorch_to_keras
  from tensorflow import lite, keras, __version__
  from typing import List
  from os import path, remove
  import torch
  from absl import flags, app
  from .utils import reset_flag
  from .utils import load_package
  from .to_tflite import create_converter
label_desc: Use image node_id 2 for calling a global function with example usage: convert(model, output, input_shape, net_path, net_name) without return types