code refine

This commit is contained in:
colin 2020-07-30 14:48:58 +08:00
parent 56b961459c
commit 486e9726c5
1 changed files with 4 additions and 10 deletions

View File

@ -22,9 +22,9 @@ resnet50 = torch.load(CurrentPath+'params.pth')
resnet50.eval() resnet50.eval()
# print("===========================") print("===========================")
# print("===========================") print("==========START============")
# print("===========================") print("===========================")
# print(resnet50) # print(resnet50)
@ -252,7 +252,6 @@ def genData(name, data):
strgShape = strgShape + " };\n" strgShape = strgShape + " };\n"
def hook_fn(m, i, o): def hook_fn(m, i, o):
print(m) print(m)
print("------------Input Grad------------") print("------------Input Grad------------")
@ -394,7 +393,6 @@ resnet50.layer1._modules['2'].conv3.register_forward_hook(lambda m, i, o: hook_p
resnet50.layer2._modules['0'].bn1.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn1", m, i, o)) resnet50.layer2._modules['0'].bn1.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn1", m, i, o))
resnet50.layer2._modules['0'].bn2.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn2", m, i, o)) resnet50.layer2._modules['0'].bn2.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn2", m, i, o))
resnet50.layer2._modules['0'].bn3.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn3", m, i, o)) resnet50.layer2._modules['0'].bn3.register_forward_hook(lambda m, i, o: hook_print("layer2_block0_bn3", m, i, o))
@ -428,7 +426,6 @@ resnet50.layer2._modules['3'].conv3.register_forward_hook(lambda m, i, o: hook_p
resnet50.layer3._modules['0'].bn1.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn1", m, i, o)) resnet50.layer3._modules['0'].bn1.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn1", m, i, o))
resnet50.layer3._modules['0'].bn2.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn2", m, i, o)) resnet50.layer3._modules['0'].bn2.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn2", m, i, o))
resnet50.layer3._modules['0'].bn3.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn3", m, i, o)) resnet50.layer3._modules['0'].bn3.register_forward_hook(lambda m, i, o: hook_print("layer3_block0_bn3", m, i, o))
@ -515,9 +512,6 @@ shapefile.write(strgShape)
binaryfile.close() binaryfile.close()
weightfile.close() weightfile.close()
# print(strg)
print("===========================")
print("===========================") print("===========================")
print("============END============")
print("===========================") print("===========================")