Esempio n. 1
0
 def handle_offsize(self, batch_size):
     if self.activation_offsize == None:
         split_axis = (2 if self.config['parallelism'] == 'data' else -1)
         self.activation_offsize = gpu.empty((batch_size, self.unitcount),
                                             split_axis)
         self.out_offsize = gpu.empty((batch_size, self.unitcount),
                                      split_axis)
         self.error_offsize = gpu.empty((batch_size, self.unitcount),
                                        split_axis)
         self.bias_ones_offsize = gpu.zeros((batch_size, 1), split_axis) + 1
         swap(self.activation, self.activation_offsize)
         swap(self.out, self.out_offsize)
         swap(self.error, self.error_offsize)
         swap(self.bias_ones, self.bias_ones_offsize)
     elif self.activation_offsize.shape[2] != batch_size:
         del self.activation
         del self.out
         del self.error
         del self.bias_ones
         self.create_buffers(batch_size)
     else:
         swap(self.activation, self.activation_offsize)
         swap(self.out, self.out_offsize)
         swap(self.error, self.error_offsize)
         swap(self.bias_ones, self.bias_ones_offsize)
Esempio n. 2
0
 def handle_offsize(self, batch_size):
     if self.activation_offsize == None:
         split_axis = (2 if self.config['parallelism'] == 'data' else -1)
         self.activation_offsize = gpu.empty((batch_size,self.unitcount),split_axis)
         self.out_offsize = gpu.empty((batch_size,self.unitcount),split_axis)
         self.error_offsize = gpu.empty((batch_size,self.unitcount),split_axis)
         self.bias_ones_offsize = gpu.zeros((batch_size,1),split_axis)+1
         swap(self.activation, self.activation_offsize)
         swap(self.out, self.out_offsize)
         swap(self.error, self.error_offsize)
         swap(self.bias_ones, self.bias_ones_offsize)            
     elif self.activation_offsize.shape[2] != batch_size:
         del self.activation
         del self.out
         del self.error
         del self.bias_ones
         self.create_buffers(batch_size)
     else:
         swap(self.activation, self.activation_offsize)
         swap(self.out, self.out_offsize)
         swap(self.error, self.error_offsize)
         swap(self.bias_ones, self.bias_ones_offsize)    
Esempio n. 3
0
 def create_buffers(self, batch_size):
     self.activation = gpu.empty((batch_size,self.unitcount))
     self.out = gpu.empty((batch_size,self.unitcount))
     self.error = gpu.empty((batch_size,self.unitcount))
     self.bias_ones = gpu.ones((batch_size,1))
Esempio n. 4
0
def normal(mean, std, shape):
    A = gpu.empty(shape)
    randomize_gaussian(A, mean, std)
    return A
Esempio n. 5
0
def randn(d0, d1):
    A = gpu.empty((d0, d1))
    randomize_gaussian(A, 0, 1)
    return A
Esempio n. 6
0
def rand(d0, d1):
    A = gpu.empty((d0, d1))
    randomize_uniform(A)
    return A
Esempio n. 7
0
 def create_buffers(self, batch_size):
     self.activation = gpu.empty((batch_size, self.unitcount))
     self.out = gpu.empty((batch_size, self.unitcount))
     self.error = gpu.empty((batch_size, self.unitcount))
     self.bias_ones = gpu.ones((batch_size, 1))
Esempio n. 8
0
def normal(mean, std, shape):
    A = gpu.empty(shape)
    randomize_gaussian(A,mean,std)
    return A    
Esempio n. 9
0
def randn(d0, d1):    
    A = gpu.empty((d0,d1))
    randomize_gaussian(A,0,1)
    return A    
Esempio n. 10
0
def rand(d0, d1):    
    A = gpu.empty((d0,d1))
    randomize_uniform(A)
    return A