Skip to contents

Multiplies tensor elements along the specified dimensions.

Usage

nv_reduce_prod(operand, dims, drop = TRUE)

Arguments

operand

(tensorish)
Operand.

dims

(integer())
Dimensions to reduce.

drop

(logical(1))
Whether to drop reduced dimensions.

Value

tensorish
Has the same data type as the input. When drop = TRUE, the reduced dimensions are removed. When drop = FALSE, the reduced dimensions are set to 1.

See also

nvl_reduce_prod() for the underlying primitive.

Examples

jit_eval({
  x <- nv_tensor(matrix(1:6, nrow = 2))
  nv_reduce_prod(x, dims = 1L)
})
#> AnvilTensor
#>   2
#>  12
#>  30
#> [ CPUi32{3} ]