Skip to contents

Copy a PJRTBuffer to an R object. For 0-dimensional PJRT buffers, the R object will be a vector of length 1 and otherwise an array.

Usage

as_array(buffer, client = pjrt_client())

Arguments

buffer

(PJRTBuffer)
A PJRT buffer object.

client

(PJRTClient | character(1))
A PJRT client object or the name of the platform to use ("cpu", "cuda", ...), from which the client will be created.

Details

Moving the buffer to the host requires to:

  1. Copy the data from the PJRT device to the CPU.

  2. Transpose the data, because PJRT returns it in row-major order but R uses column-major order.