pub fn valid_ret_activity(mode: DiffMode, activity: DiffActivity) -> bool
Expand description
Active(Only) is valid in reverse-mode AD for scalar float returns (f16/f32/…). Dual(Only) is valid in forward-mode AD for scalar float returns (f16/f32/…). Const is valid for all cases and means that we don’t compute derivatives wrt. this output. That usually means we have a &mut or *mut T output and compute derivatives wrt. that arg, but this is too complex to verify here. Also it’s just a logic error if users get this wrong.