Skip to main content

hurray_file_reader_read_descriptor

Function hurray_file_reader_read_descriptor 

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

Reads the descriptor of the tensor named name, without reading a byte of its data.

What a loader inspects before deciding whether it wants the tensor at all: element type, shape, layout, quantization.

*out_descriptor is owned by the caller and released with hurray_descriptor_destroy.

Returns HURRAY_ERR_NOT_FOUND if the name is not in the index. A failed read leaves the reader usable: the request was for an absolute range, so nothing about the reader’s position is lost.

§Safety

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