R/zmakeinterface.R
autodifffunc.Rd
These functions give (optimized) gradient, jacobian or hessian functions for the target function.
makeJacobianFunc(func, ..., mode = c("reverse", "forward"), x = NULL, chunk_size = NULL, use_tape = FALSE, compiled = FALSE, debug = TRUE) makeHessianFunc(func, ..., mode = c("reverse", "forward"), x = NULL, chunk_size = NULL, use_tape = FALSE, compiled = FALSE, debug = TRUE) makeGradFunc(func, ..., mode = c("reverse", "forward"), x = NULL, chunk_size = NULL, use_tape = FALSE, compiled = FALSE, debug = TRUE) makeDerivFunc(func, ..., mode = c("reverse", "forward"), x = NULL, chunk_size = NULL, use_tape = FALSE, compiled = FALSE, debug = TRUE)
func | the target function to calculate gradient, jacobian or hessian. |
---|---|
... | other arguments passed to the target function |
mode | whether to use forward or reverse mode automatic differentiation. |
x | If |
chunk_size | the chunk size to use in forward mode automatic differentiation.
Note that this parameter is only effective when |
use_tape | whether or not to use tape for reverse mode automatic differentiation.
Note that although |
compiled | whether or not to use compiled tape for reverse mode automatic differentiation.
Note that tape compiling can take a lot of time and
this parameter is only effective when |
debug | Whether to activate debug mode. With the debug mode, users can have more informative error messages. Without the debug mode, functions will be more performant. |
if x
is not given, the returned function will be a general function to calculate derivatives,
which accepts other arguments to func
besides x
;
if x
is given, the returned function will be an optimized function speciallised for inputs of the same
shape with the given x
.