Skip to content

Commit

Permalink
fix for new pruner
Browse files Browse the repository at this point in the history
  • Loading branch information
Nellie Wu authored and Nellie Wu committed Dec 9, 2017
1 parent e3989e1 commit 747f5be
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 5 deletions.
Binary file added os_arch/.DS_Store
Binary file not shown.
Binary file modified os_arch/__pycache__/glb.cpython-36.pyc
Binary file not shown.
Binary file modified os_arch/__pycache__/serdes.cpython-36.pyc
Binary file not shown.
Binary file modified os_arch/__pycache__/stimulus.cpython-36.pyc
Binary file not shown.
Binary file modified os_arch/__pycache__/swlayers.cpython-36.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion os_arch/serdes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def instantiate(self, arch_input_chn, arr_y, block_size, num_nonzero, pruner_nam

#user defined pruner for this layer, default to naive pruner
self.pruner = getattr(pruner, pruner_name)(self.prune_chn,self.arch_input_chn, \
self.num_nonzero,True)
self.num_nonzero, self.block_size, True)


self.ifmap = None
Expand Down
3 changes: 2 additions & 1 deletion os_arch/tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def one_layer(image_size, filter_size, in_chn, out_chn, block_size, ifmap, weigh
out_chn = [16, 16, 8, None]
block_size = [8, 8, 8, None]
num_nonzeros = [[8, 8, 8, None], [4, 4, 4, None], [2, 2, 2, None], [1, 1, 1, None]]
pruner_name = "NaivePruner"
#pruner_name = "NaivePruner"
pruner_name = "ClusteredPruner"

# Load weights and biases from file
saved_weights = np.load("../cnn/98.npy")
Expand Down
3 changes: 2 additions & 1 deletion pruning/pruner.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def tick(self):
# and perform pruning
if (self.in_chn.valid() and not self.ready_to_switch):
data = self.in_chn.pop()
#store the data in the storage buffer
#store the data in the storage buffer
# print("valid_marker: ", self.valid_marker, "block_size: ",self.block_size)
self.storage[self.valid_marker] = [data[0], data[1]]
self.valid_marker += 1
if data[2] == 1: #if this is the last data of the block, need to prune the block and store it to write-to buffer
Expand Down
4 changes: 2 additions & 2 deletions pruning/tb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def instantiate(self):

self.converter = Converter(self.in_chn, self.mid_chn, self.input_size, self.block_size)
#self.pruner = NaivePruner(self.mid_chn,self.out_chn,self.num_nonzero, self.block_size, self.preserve_order)
#self.pruner = ClusteredPruner(self.mid_chn,self.out_chn,self.num_nonzero, self.block_size, self.preserve_order)
self.pruner = ThresholdPruner(self.mid_chn,self.out_chn,self.num_nonzero, self.block_size, self.preserve_order)
self.pruner = ClusteredPruner(self.mid_chn,self.out_chn,self.num_nonzero, self.block_size, self.preserve_order)
#self.pruner = ThresholdPruner(self.mid_chn,self.out_chn,self.num_nonzero, self.block_size, self.preserve_order)

self.iterations = 10
self.iteration = 0
Expand Down

0 comments on commit 747f5be

Please sign in to comment.