diff --git a/README.md b/README.md index 468e6df3d..8d9e5f8de 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Perform the following steps once: * ``pip3 install xmos-ai-tools --upgrade``; use a virtual-environment of your choice. - Use ``pip install xmos-ai-tools --pre --upgrade`` instead if you want to install the latest development version. + Use ``pip3 install xmos-ai-tools --pre --upgrade`` instead if you want to install the latest development version. ```python from xmos_ai_tools import xformer as xf @@ -66,8 +66,8 @@ xf.convert("example_int8_model.tflite", "xcore_optimised_int8_flash_model.tflite from xmos_ai_tools.xinterpreters import xcore_tflm_host_interpreter ie = xcore_tflm_host_interpreter() -ie.set_model(model_path=xcore_model, params_path=xcore_params) -ie.set_tensor(ie.get_input_details()[0]['index'], value=input) +ie.set_model(model_path='path_to_xcore_model', params_path='path_to_xcore_params') +ie.set_tensor(ie.get_input_details()[0]['index'], value='input_data') ie.invoke() xformer_outputs = [] diff --git a/docs/rst/flow.rst b/docs/rst/flow.rst index f6f3e209b..b25f881b8 100644 --- a/docs/rst/flow.rst +++ b/docs/rst/flow.rst @@ -14,9 +14,9 @@ Perform the following steps once: * ``pip3 install xmos-ai-tools --upgrade``; use a virtual-environment of your choice. - Use ``pip install xmos-ai-tools --pre --upgrade`` instead if you want to install the latest development version. + Use ``pip3 install xmos-ai-tools --pre --upgrade`` instead if you want to install the latest development version. - Installing ``xmos-ai-tools`` will make the xcore-opt binary available in your shell to use directly, or you can use the Python interface as detailed `here `_. + Installing ``xmos-ai-tools`` will make the xcore-opt binary available in your shell to use directly, or you can use the Python interface as detailed `here `_. * Obtain the tool-chain from http://www.xmos.ai/tools and install it according to the platform instructions. diff --git a/docs/rst/python.rst b/docs/rst/python.rst index b8841ab55..a18907e60 100644 --- a/docs/rst/python.rst +++ b/docs/rst/python.rst @@ -15,9 +15,9 @@ of options and their value. .. code-block:: Python - xf.convert("example_int8_model.tflite", "xcore_optimized_int8_model.tflite", - {"mlir-disable-threading": None, "xcore-reduce-memory": None,} - ) + xf.convert("example_int8_model.tflite", "xcore_optimised_int8_model.tflite", { + "xcore-thread-count": "5", + }) The possible options are described below in the command line interface section. If the default operation is intended this third argument can be "None". @@ -40,7 +40,7 @@ To create a parameters file and a tflite model suitable for loading to flash, us .. code-block:: Python xf.convert("example_int8_model.tflite", "xcore_optimised_int8_flash_model.tflite", { - "xcore-flash-image-file ": "./xcore_params.params", + "xcore-flash-image-file": "./xcore_params.params", }) The python interface also contains a host-side interpreter for tflite @@ -57,10 +57,10 @@ run inference on a model the interpreters can be used as such: .. code-block:: Python ie = xcore_tflm_host_interpreter() - ie.set_model(model_path = xcore_model) - ie.set_input_tensor(data = input) + ie.set_model(model_path='path_to_xcore_model', params_path='path_to_xcore_params') + ie.set_tensor(ie.get_input_details()[0]['index'], value='input_data') ie.invoke() xformer_outputs = [] for i in range(num_of_outputs): - xformer_outputs.append(ie.get_output_tensor(output_index = i)) + xformer_outputs.append(ie.get_tensor(ie.get_output_details()[i]['index']))