jit_compile | R Documentation |
See the TorchScript language reference for documentation on how to write TorchScript code.
jit_compile(source)
source |
valid TorchScript source code. |
if (torch_is_installed()) {
comp <- jit_compile("
def fn (x):
return torch.abs(x)
def foo (x):
return torch.sum(x)
")
comp$fn(torch_tensor(-1))
comp$foo(torch_randn(10))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.