
where we denote by \(f^{\mathrm {a}^*}(t,x)\)  \(=\)  \(f(x,\mathrm {a}^*(t,x))\) , and assuming that \(g\)  and \(f\)  are continuously differentiable. Notice that \(D_x f^{\mathrm {a}^*}\)  \(=\)  \(D_x f\)  \(+\)  \((D_x\mathrm {a}^*)^\top D_a f\) , where
the derivatives \(D_x \mathrm {a}^*\)  of the approximate optimal feedback control in the class of neural networks can be efficiently computed by automatic differentiation.
Here, to alleviate notations, we have dropped the superscript \(*\)  for the state \(X\)  \(=\)  \(X^*\) . Actually, when \(g\)  and \(f\)  are only piecewise-differentiable, the above relation still holds when the
marginal law of \(X_s\)  is absolutely continuous with respect to Lebesgue measure on \({\mathbb {R}}^d\) , which is satisfied under nondegeneracy conditions on the diffusion coefficients (see Theorem 2.3.2 in [1]}).
We recall that the flow derivative of the
optimal state process,
valued in \({\mathbb {R}}^{d\times d}\) , is solution to the SDE (see e.g. [2]})
\( D_{X_t} X_s &= I_d + \int _t^s D_x \mathrm {b}^{\mathrm {a}^*}(r,X_r) D_{X_t} X_r {\rm d}r + D_x \sigma _j^{\mathrm {a}^*}(r,X_r) D_{X_t} X_r {\rm d}W^j_r, \; t \le s \le T,\) 
