I used forward_hook this function, it seems only print input and output, if I want to call the input and output data with variables that should I do? I tried to return input in the printnorm function, but failed.
yes，I want to fetch the input and output of each layer, I try to use the global variable in the fun function to fetch, but the fetched variable can not be changed to numpy, suggesting that ‘tuple’ object has no attribute ‘numpy’ In the following code
print('Inside '+ self.__class__.__name__ +'forward')
out = model(input)
so,If hook can not solve my problem, there are other ways to solve my problem?
forward can fetch the input and output of each layer? thank you very much
Thank you for your reply.I solved the above problem! I also have a question that I wish you can help me.
I have seen this Questions about ImageFolder about imagefolder. But I’m not really understand.
I have a picture datasets. Divided into trian and val two files Folder. Each folder has 0 and 1 subfolders.
I also create lables.txt about train and val. How do I load this dataset into pytorch?