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

◆ indexing_rev() [2/2]

__kernel void stan::math::opencl_kernels::indexing_rev ( __global double *  adj,
const __global int *  index,
const __global double *  res,
__local double *  adj_loc,
int  index_size,
int  adj_size 
)

Increments adjoint of the indexing operation argument given the indices and adjoints of the indexing result.

This kernel uses local atomics and is the fastest for medium sizes of the indexed matrix (and will not work for large sizes).

Parameters
[in,out]adjadjoint to increment
index
resadjoint of the result of indexing
batch_sizeNumber of matrices in the batch.
Note
Code is a const char* held in add_batch_kernel_code.

This kernel makes each thread build its own copy of the adjoints before combining them. It is the fastest (and only works for) small size of the indexed matrix.

Parameters
[in,out]adjadjoint to increment
indexint array index
resadjoint of the result of indexing
adj_loc
index_sizenumber of elements in index
adj_size
Note
Code is a const char* held in add_batch_kernel_code.

Definition at line 71 of file indexing_rev.hpp.