chainerx.frombuffer

chainerx.frombuffer(buffer, dtype=float, count=- 1, offset=0, device=None)

Returns a 1-D array interpretation of a buffer.

The given buffer memory must be usable on the given device, otherwise, an error is raised.

Note

The native backend requires a buffer of main memory, and the cuda backend requires a buffer of CUDA memory. No copy is performed.

Parameters
  • buffer – An object that exposes the buffer interface.

  • dtype – Data type of the returned array.

  • count (int) – Number of items to read. -1 means all data in the buffer.

  • offset (int) – Start reading the buffer from this offset (in bytes).

  • device (Device) – Device of the returned array. If omitted, the default device is chosen.

Returns

1-D array interpretation of buffer.

Return type

ndarray