Theano/Theano — pull request #1309 by viveksck (2013-03-28 15:47:26+00:00)
Title: REBASED: C code for GPUAdvancedIncSubtensor1.Handles one case to make it faster

The GPU's advanced_inc_subtensor1 op was pretty slow for inputs of the same dimensions.The following optimizes that case. For more context , please see the following thread on theano-users:
[Theano Performance] : GPUAdvancedIncSubtensor1 seems to be pretty slow on the GPU

In the case when x and y have exactly the same dimension and we are not setting (and only incrementing), the following loop is implemented in C:
if y.ndim == x.ndim:
assert len(y) == len(idx)
for (j, i) in enumerate(idx):
x[i] += y[j]

We use the already available APi's: CudaNdarraySubscript and CudaNdArray_inplace_add

Subsequent optimizations can be made incrementally.

This is the original pull request: https://github.com/Theano/Theano/pull/1208