Skip to contents

Start an asynchronous transfer of buffer data from device to host. Returns immediately with a PJRTArrayPromise object.

Use value() to get the R array (blocks if not ready). Use is_ready() to check if transfer has completed (non-blocking).

Usage

as_array_async(x, ...)

Arguments

x

A PJRTBuffer object.

...

Additional arguments (unused).

Value

A PJRTArrayPromise object. Call value() to get the R array.

Examples

buf <- pjrt_buffer(c(1.0, 2.0, 3.0, 4.0), shape = c(2, 2), dtype = "f32")
result <- as_array_async(buf)
is_ready(result)
#> [1] TRUE
value(result)
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4