| ag_load_model | R Documentation |
Reconstructs an ag_* module saved with ag_save_model.
The architecture is rebuilt by calling model_fn (either the one passed
here, or the one stored inside the container at save time), and the saved
parameter and buffer values are copied back by name.
ag_load_model(path, model_fn = NULL, device = NULL)
path |
File path written by |
model_fn |
Optional zero-argument rebuild function. Required if no
|
device |
Optional device for the rebuilt module ( |
The reconstructed module with restored weights, in eval mode.
ag_save_model
build <- function() ag_sequential(ag_linear(4L, 8L), ag_linear(8L, 3L))
f <- tempfile(fileext = ".rds")
ag_save_model(build(), f, model_fn = build)
model <- ag_load_model(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.