View source: R/ag_backward_graph.R
| ag_backward_resident | R Documentation |
Component 3 of the resident contract. When on, the graph backward leaves each
leaf gradient in its backend buffer and puts a device handle in $grad
instead of an R matrix; the numbers come back when something actually reads
them. That removes the two largest stages of a backward pass – the gradient
download and the leaf install, together 43-64
(inst/scripts/measure_ag_residency_on_backward.R).
ag_backward_resident(on = TRUE)
on |
'TRUE' to keep gradients resident, 'FALSE' to download them as before, 'NA' to only query the current state. |
On by default; GGMLR_AG_RESIDENT_GRADS=0 or FALSE here restores
host-side gradients. It changes what $grad contains: code reading it
through .ag_data/.ag_as_matrix is unaffected, while code doing
arithmetic on $grad directly gets an ag_handle, which has no
arithmetic methods and so fails loudly rather than computing something wrong.
The previous state, invisibly.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.