thanks for mentioning this but theano function itself doesn't accept this 
implementation. how can I implement it ?

On Wednesday, January 25, 2017 at 8:14:25 PM UTC+1, nouiz wrote:
>
> That way of working will be super slow. Try to make your code "vectorized" 
> by using advanced indexing when possible:
>
>
> https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing
>
> On Tue, Jan 24, 2017 at 4:17 PM, Feras Almasri <[email protected] 
> <javascript:>> wrote:
>
>> layer_Fmaps of size (1,69,236,236) sitwches of size (1,69,708,708)
>>
>> in each 3 by 3 matrix in layer_Fmaps there is only cell having a value 1 
>> which should be replace by the opposite value of sitwches
>>
>> I can't find a way to solve the problem by assigning a direct value into 
>> a certain location using a loop
>>
>> def switchs(layer_Fmaps, step=2, switches):
>>         for idx in range(96):
>>             for i in range(0, 708, step):
>>                 for j in range(0, 708, step):
>>                     val = layer_Fmaps[0][idx][i/2,j/2]
>>                     switches = T.set_subtensor(switches[0][idx][i:i + step, 
>> j:j + step],val)
>>         return  switches
>>
>> knowing that switchs and layer_Fmaps are tensor4
>>
>> img = np.zeros((1,96,236,236))
>> sswitchs =  np.zeros((1,96,708,708))
>>
>> inp = T.tensor4('img')
>> SW = T.tensor4('SW')
>>
>> tester = switchs(img,3,sswitchs)
>>
>> f = theano.function([inp, SW], tester)    
>>
>> d = f(img,sswitchs)
>>
>> Any suggestion would be appreciated.
>>
>> -- 
>>
>> --- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
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.

Reply via email to