Skip to main content

hurray_file_reader_read_tensor

Function hurray_file_reader_read_tensor 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn hurray_file_reader_read_tensor( handle: *mut HurrayFileReader, name: *const u8, name_len: usize, out_tensor: *mut *mut HurrayTensor, ) -> HurrayStatus
Expand description

Reads the tensor named name: its descriptor and every data buffer.

*out_tensor is owned by the caller and released with hurray_tensor_destroy, which frees both halves.

Every buffer points at memory the core allocated at the alignment its buffer handle declares, which the transport wrote into directly — so a SIMD load on it is sound, and no copy of the payload happened after that write.

Returns HURRAY_ERR_NOT_FOUND for a name that is not in the index. A composite head reads back as the buffer-less tensor it is in the file; hurray_file_reader_read_composite reads it with its members instead.

§Safety

  • handle MUST point to a live HurrayFileReader.
  • name MUST be readable for name_len bytes.
  • out_tensor MUST be a valid, non-null, writable pointer.