IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Python function

float32_array_to_buffer

float32_array_to_buffer()​

max.driver.float32_array_to_buffer(array, *, dtype, device)

source

Creates a Buffer of dtype on device from float32 data.

Converts on the host, so no cast graph is compiled. For DType.bfloat16, rounds with float32_to_bfloat16_as_uint16(); for other dtypes, casts with NumPy.

Parameters:

  • array (ndarray[tuple[Any, ...], dtype[float32]]) – The float32 host data.
  • dtype (DType) – The element type of the returned buffer.
  • device (Device) – The device to place the returned buffer on.

Returns:

A buffer with the same shape as array.

Return type:

Buffer