View Source EXLA.Backend (EXLA v0.9.2)

A Nx tensor backend for the data kept on the device.

You can directly transfer to this backend by calling Nx.backend_transfer/2 or Nx.backend_copy/2. It allows the following options:

  • :client - the client to store the data on. Defaults to EXLA's default client.

  • :device_id - which device to store it on.

To get the data out of the device backend into a regular tensor, call Nx.backend_transfer/1 (with the device tensor as the single argument).

Note that the EXLA.Backend is asynchronous: operations on its tensors may return immediately, before the tensor data is available. The backend will then block only when trying to read the data or when passing it to another operation.