當前位置: 首頁>>代碼示例>>Python>>正文


Python Activity.get_acts方法代碼示例

本文整理匯總了Python中activity.Activity.get_acts方法的典型用法代碼示例。如果您正苦於以下問題:Python Activity.get_acts方法的具體用法?Python Activity.get_acts怎麽用?Python Activity.get_acts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在activity.Activity的用法示例。


在下文中一共展示了Activity.get_acts方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: validation_data

# 需要導入模塊: from activity import Activity [as 別名]
# 或者: from activity.Activity import get_acts [as 別名]
    def validation_data(self, contrast=1., small_batch_size = 1000,large_batch_size = 50000):

        parameters = self.network.parameters        
        parameters.batch_size = small_batch_size
        orig_time_data = parameters.time_data
        orig_keep_spikes = parameters.keep_spikes
        #parameters.time_data = True
        #parameters.static_data_control = True
        parameters.keep_spikes = True
        if orig_keep_spikes == False:
            self.network.spike_train = ()
            nout = parameters.M
            for ii in np.arange(self.network.n_layers):
                out_dim = nout[ii]
                self.network.spike_train += (nw.make_shared((parameters.batch_size,
                                                  out_dim,
                                                  parameters.num_iterations)),)
                                                  
        small_bs = self.network.parameters.batch_size        
        batch_size = large_batch_size
        
        if parameters.time_data and not parameters.static_data_control:
            data = Time_Data(os.path.join(os.environ['DATA_PATH'],'vanhateren/whitened_images.h5'),
            1000,
            parameters.batch_size,
            parameters.N,
            parameters.num_frames,
            start=35)     
        else:
            data = Static_Data(os.path.join(os.environ['DATA_PATH'],'vanhateren/whitened_images.h5'),
            1000,
            parameters.batch_size,
            parameters.N,
            start=35)    
            
        self.network.to_gpu()
        activity = Activity(self.network)
        self.big_X = np.zeros((batch_size, parameters.N), dtype='float32')
        self.big_Y = ()
        
        for layer in range(self.network.n_layers):
            self.big_Y += (np.zeros((batch_size, parameters.M[layer]), dtype='float32'),)

        for ii in range(batch_size/small_bs):
            data.make_X(self.network) 
            if contrast != 1.:
                self.network.X.set_value(self.network.X.get_value() *
                                         np.array(contrast, dtype='float32'))
            activity.get_acts()
            
            self.big_X[ii*small_bs:(ii+1)*small_bs,:] = self.network.X.get_value()
            for layer in range(self.network.n_layers):
                self.big_Y[layer][ii*small_bs:(ii+1)*small_bs,:] = self.network.Y[layer].get_value()
        
        self.network.to_cpu()
        self.network.Y = self.big_Y
        self.network.X = self.big_X
        self.network.parameters.time_data = orig_time_data
        self.network.parameters.keep_spikes = orig_keep_spikes
開發者ID:JesseLivezey,項目名稱:SAILNet_STDP,代碼行數:61,代碼來源:plotter.py


注:本文中的activity.Activity.get_acts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。