Skip to contents

AnvilBox subclass that wraps an AbstractTensor for use in debug mode. When anvil operations (e.g. nv_add()) are called outside of jit(), they return DebugBox objects instead of actual computed results. This allows checking the types and shapes of intermediate values without compiling or running a computation – see vignette("debugging") for details.

The convenience constructor debug_box() creates a DebugBox from a dtype and shape directly.

Usage

DebugBox(aval)

Arguments

aval

(AbstractTensor)
The abstract tensor representing the value.

Value

(DebugBox)

Examples

x <- nv_tensor(1:4)
y <- nv_tensor(5:8)
result <- nv_add(x, y)
result
#> i32{4}
dtype(result)
#> <i32>
shape(result)
#> [1] 4

# Create directly via debug_box()
db <- debug_box("f32", c(2L, 3L))
db
#> f32{2,3}
nv_reduce_sum(db, dims = 2L)
#> f32{2}