Saves a script_function
to a path
Examples
if (torch_is_installed()) {
fn <- function(x) {
torch_relu(x)
}
input <- torch_tensor(c(-1, 0, 1))
tr_fn <- jit_trace(fn, input)
tmp <- tempfile("tst", fileext = "pt")
jit_save(tr_fn, tmp)
}
Saves a script_function
to a path
if (torch_is_installed()) {
fn <- function(x) {
torch_relu(x)
}
input <- torch_tensor(c(-1, 0, 1))
tr_fn <- jit_trace(fn, input)
tmp <- tempfile("tst", fileext = "pt")
jit_save(tr_fn, tmp)
}