XMOS AI Tools
Project description
XMOS AI Tools
Usage
xformer
from xmos_ai_tools import xformer as xf
xf.convert("source model path", "converted model path", params=None)
where params
is a dictionary of compiler flags and paramters and their values.
For example:
from xmos_ai_tools import xformer as xf
xf.convert("example_int8_model.tflite", "xcore_optimised_int8_model.tflite", {
"mlir-disable-threading": None,
"xcore-reduce-memory": None,
})
To see all available parameters, call
from xmos_ai_tools import xformer as xf
xf.print_help()
This will print all options available to pass to xformer. To see hidden options, run print_help(show_hidden=True)
To create a parameters file and a tflite model suitable for loading to flash, use the "xcore-flash-image-file" option.
xf.convert("example_int8_model.tflite", "xcore_optimised_int8_flash_model.tflite", {
"xcore-flash-image-file ": "./xcore_params.params",
})
To use combine these files created by the code above into a .out file use the generate_flash() function
xf.generate_flash("xcore_optimised_int8_flash_model.tflite", "xcore_params.params", "xcore_flash_binary.out")
xinterpreters
Host Interpreter
from xmos_ai_tools.xinterpreters import xcore_tflm_host_interpreter
ie = xcore_tflm_host_interpreter()
ie.set_model(model_path = xcore_model)
ie.set_input_tensor(data = input)
ie.invoke()
xformer_outputs = []
for i in range(num_of_outputs):
xformer_outputs.append(ie.get_output_tensor(output_index = i))
Device Interpreter (USB)
from xmos_ai_tools.xinterpreters import xcore_tflm_usb_interpreter
from xmos_ai_tools.xinterpreters import xcore_tflm_spi_interpreter
ie = xcore_tflm_usb_interpreter()
ie.set_model(model_path = xcore_model, secondary_memory = False, flash = False)
ie.set_input_tensor(data = input)
ie.invoke()
xformer_outputs = []
for i in range(num_of_outputs):
xformer_outputs.append(ie.get_output_tensor(output_index = i))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for xmos_ai_tools-0.1.9-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a93f082b93cc75efd3b50357587f1ed3ea24db7de8ea0be2161413febb098ce7 |
|
MD5 | 1fc4dfc595719ab6aaa0aab9b0e5f9d7 |
|
BLAKE2b-256 | 8145249f7790bac6184d97c4998c7537810bc7deded342dace385b26183fb545 |
Close
Hashes for xmos_ai_tools-0.1.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa836a1773b9a7a8902f11ff0c92924c2d9d610db49859b189704367faf8036 |
|
MD5 | b7b550bf3a7fa9adf0b71c17e4bcb67e |
|
BLAKE2b-256 | 474bc97671d1d8c5dd8bd15da43c65cb130634871746cbeaee400ee7b9394d21 |
Close
Hashes for xmos_ai_tools-0.1.9-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee8dd8bddebe3701b2638887d10d20185204d6570314ed15666c19b679969192 |
|
MD5 | e9edc674d40a0fbbf51765d5bd9ce392 |
|
BLAKE2b-256 | a0fb41dfb82b3a0510a11d9988c0662b881ef9ffbd94351d975f34a2c0064150 |
Close
Hashes for xmos_ai_tools-0.1.9-py3-none-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd5dccc11eacc325d0dd9b4a6404f5ba57ce0eff24e1b2707fbba3d05c607a90 |
|
MD5 | 5d740d848c7efb45bbc8426686bc1089 |
|
BLAKE2b-256 | a280a292727103d08e95e82707d267b802d47ff684795c2dfa193aacc5e7c71d |