ag_tensor: Create a dynamic tensor (no gradient tracking)

View source: R/autograd.R

ag_tensorR Documentation

Create a dynamic tensor (no gradient tracking)

Description

ag_tensor is backed by an R environment so all references to the same tensor see updates (like PyTorch tensors).

Usage

ag_tensor(
  data,
  device = .ag_device_state$device,
  dtype = .ag_device_state$dtype
)

Arguments

data

Numeric matrix or vector

device

"cpu" (default) or "gpu". When "gpu", compute operations will be dispatched to the ggml backend.

dtype

Floating-point precision: "f32" (default), "f16", or "bf16". Ignored on CPU; controls upload precision on GPU.

Value

An ag_tensor object (environment)


ggmlR documentation built on July 14, 2026, 1:08 a.m.