Beispiel #1
0
 def TestSequence(self, testing_data, step_list):
     step_array_size = len(step_list)
     step_array = np.array(step_list)
     step_array = np.reshape(step_array, step_array.size)
     step_array = np.ascontiguousarray(step_array, dtype=np.int32)
     cTestSequence(ctypes.byref(self), ctypes.byref(testing_data), step_array, step_array_size)
     return ctypes2numpy(self.network_output, self.test_size)
Beispiel #2
0
 def TestSequence(self, testing_data, step_list):
     step_array_size = len(step_list)
     step_array = np.array(step_list)
     step_array = np.reshape(step_array, step_array.size)
     step_array = np.ascontiguousarray(step_array, dtype=np.int32)
     cTestSequence(ctypes.byref(self), ctypes.byref(testing_data),
                   step_array, step_array_size)
     return ctypes2numpy(self.network_output, self.test_size)
Beispiel #3
0
 def Unload(self, filename):
     network_memory = ctypes2numpy(self.memories, self.number_of_neurons * self.memory_size * (self.memory_bit_group_size + 1) )
     
     network_metadata = {
                         'network_layer_width': self.network_layer_width,
                         'network_layer_height': self.network_layer_height,
                         'number_of_neurons': self.number_of_neurons,
                         'number_of_synapses_per_neuron': self.number_of_synapses_per_neuron,
                         'input_size': self.input_size, 
                         'memory_bit_group_size': self.memory_bit_group_size,
                         'memory_size': self.memory_size, 
                         'memory': network_memory
                         }
     
     network_file = open(filename, 'wb')
     pickle.dump(network_metadata, network_file)
     network_file.close()
Beispiel #4
0
    def Unload(self, filename):
        network_memory = ctypes2numpy(
            self.memories,
            self.number_of_neurons * self.memory_size *
            (self.memory_bit_group_size + 1))

        network_metadata = {
            'network_layer_width': self.network_layer_width,
            'network_layer_height': self.network_layer_height,
            'number_of_neurons': self.number_of_neurons,
            'number_of_synapses_per_neuron':
            self.number_of_synapses_per_neuron,
            'input_size': self.input_size,
            'memory_bit_group_size': self.memory_bit_group_size,
            'memory_size': self.memory_size,
            'memory': network_memory
        }

        network_file = open(filename, 'wb')
        pickle.dump(network_metadata, network_file)
        network_file.close()
Beispiel #5
0
 def Test(self, input_image, input_class, sample):
     inputDataTemp = np.ascontiguousarray(input_image, dtype=np.int32)
     cTest(ctypes.byref(self), inputDataTemp, input_class, sample)
     return ctypes2numpy(self.network_output,
                         self.number_of_neurons * self.test_size)
Beispiel #6
0
 def Test(self, testing_data):
     cTest(ctypes.byref(self), ctypes.byref(testing_data))
     return ctypes2numpy(self.network_output, self.number_of_neurons * self.test_size)