modeci_mdf.interfaces.pytorch.exporter.generate_main_forward

modeci_mdf.interfaces.pytorch.exporter.generate_main_forward(nodes: List[node], execution_order: List[str], d_e: Dict[str, Any])[source]

Helper function to generate the main forward method that will specify the execution of the pytorch model. This requires proper ordering of module calls as well as preservation of variables.

Parameters:
  • nodes – list of nodes in the graph

  • execution_order – List of nodes in the order of execution

  • d_e – Weights on edges stored in dict format

Returns: Function returns the main forward call that will be used to define pytorch model