Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ sum_2d()

template<typename T , require_all_kernel_expressions_t< T > * = nullptr>
auto stan::math::sum_2d ( T &&  a)
inline

Two dimensional sum - reduction of a kernel generator expression.

So as to be efficient two dimensional reductions are only done partially. That means instead of 1 element kernel output can have a few rows and a few columns that need to be reduced to obtain final result (actually it is 1 result per work group run - roughly 16 times the number of compute units on the OpenCL device). This can be done in a separate kernel or after copying to CPU. Also two dimensional reductions can not be used as arguments to other operations - they can only be evaluated.

Template Parameters
Ttype of input expression
Parameters
athe expression to reduce
Returns
sum

Definition at line 233 of file reduction_2d.hpp.