Re: [Numpy-discussion] Speedup by avoiding memory alloc twice in scalar array

2014-01-08 Thread Frédéric Bastien
On Wed, Jan 8, 2014 at 3:40 PM, Nathaniel Smith wrote: > On Wed, Jan 8, 2014 at 12:13 PM, Julian Taylor > wrote: >> On 18.07.2013 15:36, Nathaniel Smith wrote: >>> On Wed, Jul 17, 2013 at 5:57 PM, Frédéric Bastien wrote: On the usefulness of doing only 1 memory allocation, on our old gpu >

Re: [Numpy-discussion] Speedup by avoiding memory alloc twice in scalar array

2014-01-08 Thread Nathaniel Smith
On Wed, Jan 8, 2014 at 12:13 PM, Julian Taylor wrote: > On 18.07.2013 15:36, Nathaniel Smith wrote: >> On Wed, Jul 17, 2013 at 5:57 PM, Frédéric Bastien wrote: >>> On the usefulness of doing only 1 memory allocation, on our old gpu ndarray, >>> we where doing 2 alloc on the GPU, one for metadata

Re: [Numpy-discussion] an indexing question

2014-01-08 Thread Jaime Fernández del Río
On Wed, Jan 8, 2014 at 11:12 AM, Neal Becker wrote: > I have a 1d vector d. I want compute the means of subsets of this vector. > The subsets are selected by looking at another vector s or same shape as d. > > This can be done as: > > [np.mean (d[s == i]) for i in range (size)] > > But I think t

[Numpy-discussion] an indexing question

2014-01-08 Thread Neal Becker
I have a 1d vector d. I want compute the means of subsets of this vector. The subsets are selected by looking at another vector s or same shape as d. This can be done as: [np.mean (d[s == i]) for i in range (size)] But I think this could be done directly with numpy addressing, without resorting

Re: [Numpy-discussion] Speedup by avoiding memory alloc twice in scalar array

2014-01-08 Thread Frédéric Bastien
Hi, As told, I don't think Theano swap the stride buffer. Most of the time, we allocated with PyArray_empty or zeros. (not sure of the capitals). The only exception I remember have been changed in the last release to use PyArray_NewFromDescr(). Before that, we where allocating the PyArray with the

Re: [Numpy-discussion] Speedup by avoiding memory alloc twice in scalar array

2014-01-08 Thread Julian Taylor
On 18.07.2013 15:36, Nathaniel Smith wrote: > On Wed, Jul 17, 2013 at 5:57 PM, Frédéric Bastien wrote: >> On Wed, Jul 17, 2013 at 10:39 AM, Nathaniel Smith wrote: On Tue, Jul 16, 2013 at 11:55 AM, Nathaniel Smith wrote: >>> It's entirely possible I misunderstood, so let's see if we can