Tensor reductions
Details
Labels on dimensions that are not reduced are retained. A reduced
dimension kept with size one retains its axis name but not its individual
labels. Supplying integer(0) performs no reduction and returns the
tensor values, shape, device, and dimnames unchanged (with the documented
reduction dtype promotion).
Examples
x <- cuda_tensor(matrix(1:6, 2), device = "cpu")
tensor_sum(x)
#> <cudatensor[1] device=cpu backend=base dtype=float64>
#> [1] 21
tensor_mean(x, dim = 1)
#> <cudatensor[3] device=cpu backend=base dtype=float64>
#> [1] 1.5 3.5 5.5