当前位置: 首页>>代码示例>>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;未经允许,请勿转载。