Hi Joseph,

You can probably transpose the array to make the target axis the innermost
one, and then reduce over it. Perhaps a specialized reduction will be
faster, but this will be a good first approximation.

On Fri, Aug 21, 2015 at 5:30 AM, Joseph Austerweil <
[email protected]> wrote:

> Hi All,
>
> First, thank you so much for your hard work on the package.
> It is a fantastic resource.
>
> A bit of context:
> My lab and I are working on building approximations
> for Bayesian nonparametric models implemented in
> Python using pyopencl (as far as I can tell, none exist).
> So far our package is in its infancy,
> but hope it will be useful for others in about a year.
>
> Problem:
> One operation that arises frequently is reducing over
> a single axis of a multi-dimensional array
> (for example, lets say we have the log probability
> calculated for each element of a N x D observation matrix
> and want to sum over D to get the log probability of each object
>  -- more frequently I have 3-d arrays
> and am summing over one axis of it).
>
> Is it possible to use clarray's reduce sum
> capabilities to sum over a single axis?
>
> Currently, I wrote my own for a simple 3-d case,
> but it's not nearly as robust as the one provided in
> clarray.
>
> Thank you in advance,
> Joseph Austerweil
> Brown University
> Assistant Professor of Cognitive, Linguistic, and Psychological Sciences
> [email protected]
>
>
> _______________________________________________
> PyOpenCL mailing list
> [email protected]
> http://lists.tiker.net/listinfo/pyopencl
>
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to