[SciPy-User] optimising python numpy snippet

Sai Rajeshwar rajsai24 at gmail.com
Thu Jul 24 13:40:46 EDT 2014


hi all,

  I have written the following for loop statement inn my code..  when i
profiled it.. i found that it is taking huge amount of time..  can any one
suggest to make this statement faster
----------------------------------------------------------------------------

f



*or i in xrange(self.pooled_shape[1]):            for j in
xrange(self.pooled_shape[2]):                for k in
xrange(self.pooled_shape[3]):                    for l in
xrange(self.pooled_shape[4]):
self.pooled[0][i][j][k][l]=math.tanh((numpy.sum(self.conv_out[0][i][j][k*3][l*3:(l+1)*3])+numpy.sum(self.conv_out[0][i][j][k*3+1][l*3:(l+1)*3])+numpy.sum(self.conv_out[0][i][j][k*3+2][l*3:(l+1)*3]))/9.0+self.b[i][j])*

thanks a lot in advance


*with regards..*

*M. Sai Rajeswar*
*M-tech  Computer Technology*


*IIT Delhi----------------------------------Cogito Ergo Sum---------*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20140724/ff0c3dbd/attachment.html>


More information about the SciPy-User mailing list