jit_ops: Enable idiomatic access to JIT operators from R.

jit_opsR Documentation

Enable idiomatic access to JIT operators from R.

Description

Call JIT operators directly from R, keeping the familiar argument types and argument order. Note, however, that:

  • all arguments are required (no defaults)

  • axis numbering (as well as position numbers overall) starts from 0

  • scalars have to be wrapped in jit_scalar()

Usage

jit_ops

Format

An object of class torch_ops of length 0.

Examples

if (torch_is_installed()) {
t1 <- torch::torch_rand(4, 5)
t2 <- torch::torch_ones(5, 4)
# same as torch::torch_matmul(t1, t2)
jit_ops$aten$matmul(t1, t2)

# same as torch_split(torch::torch_arange(0, 3), 2, 1)
jit_ops$aten$split(torch::torch_arange(0, 3), torch::jit_scalar(2L), torch::jit_scalar(0L))

}

torch documentation built on May 29, 2024, 9:54 a.m.