Prints an array value to the console during JIT execution and returns the
input unchanged. Useful for debugging.
For RData inputs, that do not have an actual data type, the default data type
is used for printing.
Arguments
- x
(
arrayish)
One input. Can be any data type. An R value materializes at its default data type.
Value
(arrayish)
Returns the input unchanged, data type and shape included.
Order of prints
A print is currently not ordered with respect to other prints. Due to compiler reordering it is possible that the order of the prints differs from their location in the code.
See also
prim_print() for the underlying primitive.
Examples
# the value is printed and handed back unchanged
x <- nv_array(c(1, 2, 3))
nv_print(x)
#> AnvlArray
#> 1
#> 2
#> 3
#> [ f32{3} ]
#> AnvlArray
#> 1
#> 2
#> 3
#> [ CPUf32{3} ]
# RData is printed at the default dtype
nv_print(1)
#> RData
#> 1
#> [ double{} printed at f32 ]
#> AnvlArray
#> 1
#> [ CPUf32{} ]