modeci_mdf.interfaces.pytorch.exporter.build_script

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

Helper function to create and assemble text components necessary to specify module.py importable model script. These include:

  • Module declarations
    • Initialization of functions

    • Definition of forward function

  • Model main call declaration:
    • Initialization of subcomponents

    • Forward function logic

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

  • model_id1 – id of the model to be converted

  • conditions

Returns: complete module.py script as a formatted string