powered by
Initialize a new function that can be used by operators in a graph.
cg_function(def, grads = list())
function, the definition of the function.
list of functions, the gradient functions with respect to each input (optional).
cg_function object.
# NOT RUN { #' # Create a custom negation function f <- cg_function( def = function(x) -x, grads = list(function(x, value, grad) -grad) ) # }
Run the code above in your browser using DataLab