-
Notifications
You must be signed in to change notification settings - Fork 5
Description
As jvp_outputs, vjp_inputs, jac_inputs and jac_outputs are validated as sets by pydantic their order depends on the random hash assigned to them at validation. As the validated set is often used to explicitly create the (nested) dicts output by the AD endpoints and the order is not modifed by validation,
On the other hand, if using json outputs, the order will not necessarily correspond to either the user-provided argument or the validated set but will be alphabetically sorted by pydantic on serialization.
While this is surprising behaviour, potential fixes will likely introduce other confusing/surprising behaviour (as we would have to pick one specific ordering to guarantee in all cases) and may be sensitive to future changes in Pydantic/FastAPI, as such there are no immediate plans to address this. Please report here if you run into any usage issues due to this and believe a fix should be further explored.