Skip to main content

ket_process_read_gradient

Function ket_process_read_gradient 

Source
#[unsafe(no_mangle)]
pub extern "C" fn ket_process_read_gradient( process: &Process, result_json: &mut *const c_char, ) -> i32
Expand description

Returns a serialized JSON array of parameter-shift gradients from the most recent execution.

If no execution has been performed yet, the returned JSON string contains null. The string is heap-allocated; the caller must free it with super::ket_string_delete.

§Parameters

  • process: The process from which gradients are read.
  • result_json: Output: set to a pointer to a heap-allocated null-terminated JSON string.

§Returns

0 on success, non-zero error code on failure.