expectation_compute_with_gradients_backward#
-
cuquantum.
bindings. cutensornet. expectation_compute_with_gradients_backward( - intptr_t handle,
- intptr_t tensor_network_expectation,
- int32_t accumulate_gradients,
- intptr_t expectation_value_adjoint,
- intptr_t state_norm_adjoint,
- intptr_t work_desc,
- intptr_t expectation_value,
- intptr_t state_norm,
- intptr_t cuda_stream,
Computes the tensor network state expectation value and its gradients together.
- Parameters:
handle (intptr_t) – cuTensorNet library handle.
tensor_network_expectation (intptr_t) – Tensor network state expectation value representation.
accumulate_gradients (int32_t) – If non-zero, add to existing gradient values; otherwise overwrite.
expectation_value_adjoint (intptr_t) – Upstream gradient scalar for chain rule computation (host-accessible pointer, same type as state). Set to 1 for direct gradient .
state_norm_adjoint (intptr_t) – Upstream gradient for state norm in chain rule (host-accessible pointer, same type as state).
work_desc (intptr_t) – The workspace descriptor with SCRATCH workspace set.
expectation_value (intptr_t) – Computed expectation value (host-accessible pointer, same type as state).
state_norm (intptr_t) – Host-accessible pointer to store the squared 2-norm of the state.
cuda_stream (intptr_t) – The CUDA stream on which the computation is performed.