Пример #1
0
Файл: sp.py Проект: ursk/sparco
 def create_node_buffers(self, buffer_dimensions):
     nodebufs, nodebufs_mean = {}, {}
     for name, dims in buffer_dimensions.items():
         nodebufs[name] = np.zeros((self.patches_per_node, ) + dims)
         nodebufs_mean[name] = np.zeros(dims)
     self.nodebufs = pfacets.data(mean=pfacets.data(**nodebufs_mean),
                                  **nodebufs)
Пример #2
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers2(self, buffer_dimensions):
   rootbufs, rootbufs_mean = {}, {}
   proc_based = ['a_l0_norm', 'a_l1_norm', 'a_l2_norm', 'a_variance']
   for name,dims in buffer_dimensions.items():
     first_dim = mpi.procs if (name in proc_based) else self.batch_size
     rootbufs[name] = np.zeros((first_dim,) + dims)
     rootbufs_mean[name] = np.zeros(dims)
   self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean), **rootbufs)
Пример #3
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers1(self, buffer_dimensions):
   rootbufs, rootbufs_mean = {}, {}
   proc_based = list(set(buffer_dimensions.keys()) - set(['x'])) # TODO hack
   for name,dims in buffer_dimensions.items():
     first_dim = mpi.procs if (name in proc_based) else self.batch_size
     rootbufs[name] = np.zeros((first_dim,) + dims)
     rootbufs_mean[name] = np.zeros(dims)
   self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean), **rootbufs)
Пример #4
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers2(self, buffer_dimensions):
     rootbufs, rootbufs_mean = {}, {}
     proc_based = ['a_l0_norm', 'a_l1_norm', 'a_l2_norm', 'a_variance']
     for name, dims in buffer_dimensions.items():
         first_dim = mpi.procs if (name in proc_based) else self.batch_size
         rootbufs[name] = np.zeros((first_dim, ) + dims)
         rootbufs_mean[name] = np.zeros(dims)
     self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean),
                                  **rootbufs)
Пример #5
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers1(self, buffer_dimensions):
     rootbufs, rootbufs_mean = {}, {}
     proc_based = list(set(buffer_dimensions.keys()) -
                       set(['x']))  # TODO hack
     for name, dims in buffer_dimensions.items():
         first_dim = mpi.procs if (name in proc_based) else self.batch_size
         rootbufs[name] = np.zeros((first_dim, ) + dims)
         rootbufs_mean[name] = np.zeros(dims)
     self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean),
                                  **rootbufs)
Пример #6
0
 def allocate_buffers(self):
   C, N, P, T, B, Bp = self.job.C, self.job.N, self.job.P, self.job.T, self.job.B, self.job.Bp
   sample_dims = { 'a': (N, P+T-1), 'x': (C, T), 'xhat': (C,T),
       'dx': (C,T), 'dphi': (C,N,P), 'E': (1,), 'l1_penalty': (1,), 'a_l0_norm': (N,),
       'a_l1_norm': (N,), 'a_l2_norm': (N,), 'a_variance': (N,) }
   nbuf_dims = pf.merge({'npats': (1,), 'phi': (C,N,P)},
     { k: (Bp,) + v for (k,v) in sample_dims.items() })
   rbuf_dims = pf.merge(sample_dims,
       {'x': (B,) + sample_dims['x'], 'npats': mpi.procs})
   self.nbuf = pf.data(**{k: np.zeros(v) for (k,v) in nbuf_dims.items()})
   self.rbuf = pf.data(**{k: np.zeros(v) for (k,v) in rbuf_dims.items()})
   self.nbuf.npats = self.nbuf.npats.astype(int)
   self.rbuf.npats = self.rbuf.npats.astype(int)
   self.nbuf.sum = pf.data(**{'dphi': np.zeros(sample_dims['dphi'])})
Пример #7
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers1(self, buffer_dimensions):
   rootbufs, rootbufs_mean = {}, {}
   for name,dims in buffer_dimensions.items():
     rootbufs[name], rootbufs_mean['name'] = None, None
   self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean), **rootbufs)
Пример #8
0
Файл: sp.py Проект: ursk/sparco
 def create_node_buffers(self, buffer_dimensions):
   nodebufs, nodebufs_mean = {}, {}
   for name,dims in buffer_dimensions.items():
     nodebufs[name] = np.zeros((self.patches_per_node,) + dims)
     nodebufs_mean[name] = np.zeros(dims)
   self.nodebufs = pfacets.data(mean=pfacets.data(**nodebufs_mean), **nodebufs)
Пример #9
0
Файл: sp.py Проект: ursk/sparco
 def create_root_buffers1(self, buffer_dimensions):
     rootbufs, rootbufs_mean = {}, {}
     for name, dims in buffer_dimensions.items():
         rootbufs[name], rootbufs_mean['name'] = None, None
     self.rootbufs = pfacets.data(mean=pfacets.data(**rootbufs_mean),
                                  **rootbufs)