Python API ########## This document lists the application programming interface (API) that the generated to Python. With these APIs, applications can: - upload a model to the ONNC bench SaaS, - compile the neural network, and - download the compiled model from ONNC bench SaaS ---- Workspace ========= **Workspace** class represents a workspace in the remote service. .. code-block:: python from onnc.bench import Workspace; Upload A Model -------------- **upload_model** creates a remote workspace in ONNC bench SaaS and upload the model into the workspace. .. code-block:: python onnc.bench.Workspace.upload_model(model, samples, input_name = None, output_name = None, input_as_nchw: str = "auto") model: Union[str, object] A file or a directory path to a serialized model file, or a neurl network model object. samples: Union[str, object] A file or a directory path to a serialized *Numpy* dataset, or a Numpy dataset object. input_name: str The input tensor name of the given model. output_name: str The output tensor name of the given model. input_as_nchw: str This parameter is used to define the input format. It should be one of the *noset*, *auto*, or *as_input_name*. return A python dict object contains `success`, `model_id`, and `sample_id`. example .. code-block:: python { 'success': True, 'model_id': '', 'sample_id': '' } Compile The Neural Network -------------------------- **compile** asks ONNC bench SaaS to transform the given model into C function calls. .. code-block:: python onnc.bench.Workspace.compile(board, ram_size=0) board: str The name of the supported SoC board, for example, ``NUMAKER_IOT_M487``. ram_size: int Limit of free RAM size in the board. The value depends on the environmental conditions, such as OS, application. return A python dict object contains `success`, `loadable_id`, `board`, `ram_size`, and `report`. example .. code-block:: python { 'success': success, 'loadable_id': loadable_id, 'board': board, 'ram_size': ram_size, 'report': {'ram': ram, 'rom': rom} } Download The Compiled Model --------------------------- **download** downloads the produced C function calls from ONNC bench SaaS. .. code-block:: python onnc.bench.Workspace.download(download_path, unzip=True) download_path: str The path to save the file. unzip: bool Unzip the results when true.