code refine
This commit is contained in:
		
							parent
							
								
									56b961459c
								
							
						
					
					
						commit
						486e9726c5
					
				| 
						 | 
					@ -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("===========================")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue