Virtual Devices#

Canaan#

class neurio.devices.virtual.canaan.kendryte.K210Virtual(port: any = 'virtual', name: str = 'K210', log_dir: str | None = None, **kwargs)[source]#
is_alive(timeout: int = 20) bool[source]#

Check if the device is alive

Parameters:

timeout – timeout in seconds

Returns:

Return true if the device is alive (connected), false otherwise

Tensorflow#

class neurio.devices.virtual.tensorflow.tflite.TFLiteVirtual(port: any, name: str = '', log_dir: str | None = None, options: dict = {'is_quantized': True})[source]#
is_alive()[source]#

Check if the device is alive

Parameters:

timeout – timeout in seconds

Returns:

Return true if the device is alive (connected), false otherwise

create_log_dirs()[source]#
prepare_for_inference(model: Model, options: dict = {})[source]#

Prepare the device for inference. This function should be called before any inference.

Parameters:
  • model – model to deploy on the device

  • kwargs – other parameters relevant for the preparation of the device

save_data(data: any, location=None)[source]#
detach()[source]#
predict(data: any, batch_size: int = 32, verbose: bool = True) Prediction[source]#

Predicts the data :param data: input data to predict :param batch_size: batch size for the prediction :param return_stats: return statistics of the prediction :param verbose: whether to print the progress bar :return: