You want to use the scan function as an accumulator. The accumulate by adding example in the scan docs is functionally very similar. SIGMA_trf and MU are your seqs variables.
On Friday, April 7, 2017 at 6:59:22 AM UTC-4, [email protected] wrote: > > I need a for loop for calculating my function values in a less memory > requirements way. > Nothing more. > I hope that theano will use then the less memory version for the function > for generating gradients also in a less memory usage way. > So is there a way looping it with theano symbolic code,, which works and > does not give errors like the one with standard python code. > Or perhaps does anyone know, what is the mistake in the loop before? > > Am Donnerstag, 9. März 2017 21:27:40 UTC+1 schrieb Gábor Borbély: >> >> Dear roman..., >> >> I don't understand what you are trying to achieve. >> What do you mean by "calculate the derivatives of a function"? >> Like f, f', f'', f''' ...? >> Or numerical derivatives? >> >> cheers >> gaebor >> >> 2017. február 27., hétfő 9:55:39UTC+1 időpontban [email protected] >> a következőt írta: >> >>> >>> I tried the for loop with standard python code: >>> >>> >>> 1. EPhiTPhi = np.zeros((50,50)) >>> 2. for i in range(0, 900): >>> 3. D_n_temp = SIGMA_trf[i,:][None,None, :] >>> 4. d_n_temp = MU[i,:][None,None, : >>> 5. EPhiTPhi = EPhiTPhi + T.exp(-0.5 * (S_hat_minus**2 * >>> D_n_temp).sum(2)) * T.cos((S_hat_minus * d_n_temp).sum(2) + >>> big_sum_minus) + T.exp(-0.5 * (S_hat_plus**2 * D_n_temp).sum(2)) * T. >>> cos((S_hat_plus * d_n_temp).sum(2) + big_sum_plus) >>> >>> >>> >>> But when I want to use it in theano, I get the error: >>> >>> ... >>> >>> File "theano\compile\pfunc.py", line 93, in clone_v_get_shared_updates >>> clone_v_get_shared_updates(i, copy_inputs_over) >>> >>> File "theano\compile\pfunc.py", line 93, in clone_v_get_shared_updates >>> clone_v_get_shared_updates(i, copy_inputs_over) >>> >>> RuntimeError: maximum recursion depth exceeded >>> >>> >>> Even by setting sys.setrecursionlimit(...) to very high number. >>> >>> Thanks for your help. >>> >> -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
