@@ -232,32 +232,32 @@ def get_parameters(self, n_batch = 10000,
232
232
sys .stdout .write ("[%-20s] %d%%"
233
233
('=' * i , 5 * i ))
234
234
235
- exist = 'v' in locals ()
236
- if exist == False :
237
- batch = idx
238
- else :
239
- batch = idx [v :]
240
-
241
- im = np .matmul (self .gamma , self .theta [:, batch ])
242
- pos = np .argmax (im , axis = 0 )
243
- mx = np .max (im , axis = 0 )
244
- mn = np .min (im , axis = 0 )
245
- val_range = mx - mn
246
- im = ((im - mn ) / val_range )** alpha
247
- m_image = np .mean (im , axis = 0 ).transpose ()
248
-
249
- cx = np .floor (pos / self .r_stimulus )
250
- cy = pos % self .r_stimulus
251
- results ['mu_x' ][batch ] = cx / self .r_stimulus * max_radius * 2 - max_radius
252
- results ['mu_y' ][batch ] = - cy / self .r_stimulus * max_radius * 2 - max_radius
253
- R = np .sqrt (results ['mu_x' ][batch ]** 2 + results ['mu_y' ][batch ]** 2 )
254
- P = np .hstack ((m_image , R ))
255
- results ['sigma' ][batch ] = np .matmul (P , beta )
256
-
257
- i = int (v / n_mask * 21 )
258
- sys .stdout .write ('\r ' )
259
- sys .stdout .write ("[%-20s] %d%%"
260
- ('=' * i , 5 * i ))
235
+ exist = 'v' in locals ()
236
+ if exist == False :
237
+ batch = idx
238
+ else :
239
+ batch = idx [v :]
240
+
241
+ im = np .matmul (self .gamma , self .theta [:, batch ])
242
+ pos = np .argmax (im , axis = 0 )
243
+ mx = np .max (im , axis = 0 )
244
+ mn = np .min (im , axis = 0 )
245
+ val_range = mx - mn
246
+ im = ((im - mn ) / val_range )** alpha
247
+ m_image = np .mean (im , axis = 0 ).transpose ()
248
+
249
+ cx = np .floor (pos / self .r_stimulus )
250
+ cy = pos % self .r_stimulus
251
+ results ['mu_x' ][batch ] = cx / self .r_stimulus * max_radius * 2 - max_radius
252
+ results ['mu_y' ][batch ] = - cy / self .r_stimulus * max_radius * 2 - max_radius
253
+ R = np .sqrt (results ['mu_x' ][batch ]** 2 + results ['mu_y' ][batch ]** 2 )
254
+ P = np .hstack ((m_image , R ))
255
+ results ['sigma' ][batch ] = np .matmul (P , beta )
256
+
257
+ i = int (v / n_mask * 21 )
258
+ sys .stdout .write ('\r ' )
259
+ sys .stdout .write ("[%-20s] %d%%"
260
+ ('=' * i , 5 * i ))
261
261
262
262
return results
263
263
0 commit comments