AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻译准备中
Accelerated array computing and code transformations for R. Numerical programs operating on arrays can be just-in-time compiled to optimized executables via XLA -- the same compiler that powers JAX an
翻译准备中
开发工具R · PythonGitHub @r-xla在线运营者未确认
试用过了吗? 点一下就好,无需登录。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Accelerated array computing and code transformations for R
翻译准备中
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
Package website: release \|
dev
Accelerated array computing and code transformations for R, allowing you
to run numerical programs at the speed of light. The package supports
just-in-time (JIT) compilation for very fast execution and reverse-mode
automatic differentiation. Programs can run on CPU and NVIDIA GPU.
See the installation
guide for more
details, including prebuilt Docker images.
{anvl} makes numerical R code run fast on CPUs and GPUs, and computes
gradients of your functions automatically. It aspires to be for R what
JAX is for Python.查看完整 README ↗Package website: release | dev
Accelerated array computing and code transformations for R, allowing you to run numerical programs at the speed of light. The package supports just-in-time (JIT) compilation for very fast execution and reverse-mode automatic differentiation. Programs can run on CPU and NVIDIA GPU.
install.packages("anvl", repos = c("https://r-xla.r-universe.dev", getOption("repos")))
Afterwards, install the additional dependencies:
anvl::install_anvl()
See the installation guide for more details, including prebuilt Docker images.
{anvl} makes numerical R code run fast on CPUs and GPUs, and computes gradients of your functions automatically. It aspires to be for R what JAX is for Python.
There are three core ideas:
gradient(), which returns
the derivative of a function as another R function.Moreover, the package is designed to be extensible. As the package is written in R, new primitives and transformations can be added without needing a lower-level language.
We define an R function operating on AnvlArrays, which is the primary
data type of {anvl}. It can be executed in either eager mode (each
operation is performed immediately) or jit mode (the whole function is
compiled into a single executable via jit()).
library(anvl)
f <- function(a, b, x) {
nv_mul(a, x) + b
}
a <- nv_scalar(1)
b <- nv_scalar(2)
x <- nv_scalar(3)
# Eager mode
f(a, b, x)
#> AnvlArray
#> 5
#> [ CPUf32{} ]
# JIT mode
f_jit <- jit(f)
f_jit(a, b, x)
#> AnvlArray
#> 5
#> [ CPUf32{} ]
Through function transformation, we can also obtain the gradient of the above function.
g_jit <- jit(gradient(f, wrt = c("a", "b")))
g_jit(a, b, x)
#> $a
#> AnvlArray
#> 3
#> [ CPUf32{} ]
#>
#> $b
#> AnvlArray
#> 1
#> [ CPUf32{} ]
By default, floats use f32 precision in {anvl} because of its speed
advantage on GPUs. Changing this default to double-precision is possible
via the anvl.default_dtypes option:
with_default_dtypes(c(float = "f64"), {
nv_add(pi, 1)
})
#> AnvlArray
#> 4.1416
#> [ CPUf64{} ]
To learn more, see the Get Started article.
| OS | Architecture | CPU | CUDA |
|---|---|---|---|
| Linux | x86_64 | ✓ | ✓ |
| Linux | arm64 | ✓ | ✓ |
| Windows | x86_64 | ✓ | WSL2 |
| Windows | arm64 | ✗ | ✗ |
| macOS | x86_64 | ✓ | ✗ |
| macOS | arm64 | ✓ | ✗ |
✓ supported · WSL2: via the Windows Subsystem for Linux · ✗ not supported