View Source TFLiteElixir.Coral (tflite_elixir v0.1.4)

Link to this section Summary

Link to this section Functions

Link to this function

contains_edge_tpu_custom_op?(flat_buffer_model)

View Source
Link to this function

dequantize_tensor(interpreter, tensor_index)

View Source
Link to this function

dequantize_tensor(interpreter, tensor_index, as_type)

View Source
@spec edge_tpu_devices() :: [String.t()]
@spec get_edge_tpu_context() :: {:ok, reference()} | {:error, String.t()}

Returns TPU context or nullptr if requested TPU context is not available.

Parameter device:

  • "" -- any TPU device
  • "usb" -- any TPU device on USB bus
  • "pci" -- any TPU device on PCIe bus
  • ":N" -- N-th TPU device, e.g. ":0"
  • "usb:N" -- N-th TPU device on USB bus, e.g. "usb:0"
  • "pci:N" -- N-th TPU device on PCIe bus, e.g. "pci:0"

Parameter options:

  • "Performance": ["Low", "Medium", "High", "Max"] (Default is "Max") Adjust internal clock rate to achieve different performance / power balance.
  • "Usb.AlwaysDfu": ["True", "False"] (Default is "False") Always perform device firmware update after reset. DFU is usually only necessary after power cycle.
  • "Usb.MaxBulkInQueueLength": ["0",.., "255"] (Default is "32") Larger queue length may improve USB performance on the direction from device to host.

All TPUs are always enumerated in the same order assuming hardware configuration doesn't change (no added/removed devices between enumerations). Under the assumption above, the same index N will always point to the same device.

Consider 2 USB devices and 4 PCIe devices connected to the host. The way to reference specifically USB devices:

  "usb:0", "usb:1".

The way to reference specifically PCIe devices:

  "pci:0", "pci:1", "pci:2", "pci:3".

The generic way to reference all devices (no assumption about device type):

  ":0", ":1", ":2", ":3", ":4", ":5".
Link to this function

get_edge_tpu_context(device)

View Source
@spec get_edge_tpu_context(String.t()) :: {:ok, reference()} | {:error, String.t()}
Link to this function

get_edge_tpu_context(device, options)

View Source
@spec get_edge_tpu_context(String.t(), Map.t()) ::
  {:ok, reference()} | {:error, String.t()}

Raising version of get_edge_tpu_context/0.

Link to this function

get_edge_tpu_context!(device)

View Source

Raising version of get_edge_tpu_context/1.

Link to this function

get_edge_tpu_context!(device, options)

View Source

Raising version of get_edge_tpu_context/2.

Link to this function

make_edge_tpu_interpreter(flat_buffer_model, edgetpu_context)

View Source
@spec make_edge_tpu_interpreter(
  %TFLiteElixir.FlatBufferModel{model: term()},
  reference()
) ::
  {:ok, reference()} | {:error, String.t()}
Link to this function

make_edge_tpu_interpreter!(model, edgetpu_context)

View Source

Raising version of make_edge_tpu_interpreter/2.