Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldforever authored Sep 29, 2024
1 parent d197e6c commit 7cde959
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def merge_threshold_with_next_layer(neuron, conv):


def quant_fc_in_once(fc, neuron, bitwidth):
'''Baseline: 传入全连接层和相邻的SNN层神经元,将整体进行量化'''
global exp_device
w = fc.weight.data # [out_features, in_features]
if len(fc.state_dict()) == 2:
Expand All @@ -149,7 +148,6 @@ def quant_conv2d_in_once(conv, neuron, bitwidth):
return conv, IFNeuron(v_threshold, True, neuron.v_threshold, "conv", exp_device)

def quant_res_conv_in_once(conv, shortcut, neuron, bitwidth):
''' shortcut也是conv '''
global exp_device
w_shortcut = shortcut.weight.data.cpu()
w = conv.weight.data.cpu() # [out_channels, in_channels, kernel_size, kernel_size]
Expand All @@ -161,7 +159,6 @@ def quant_res_conv_in_once(conv, shortcut, neuron, bitwidth):
return conv, shortcut, IFNeuron(v_threshold, True, neuron.v_threshold, "conv", exp_device)

def quant_res_linear_in_once(conv, shortcut, neuron, bitwidth):
''' shortcut是linear '''
global exp_device
w_shortcut = []
for i in range(conv.out_channels):
Expand Down Expand Up @@ -411,4 +408,4 @@ def reset_net(model):
def error(info):
print(info)
exit(1)


0 comments on commit 7cde959

Please sign in to comment.