I am using pytorch in my research about adversary machine learning. I am writing a code using inceptionV3 network. I am trying to get the input for the first layer(list(model.children())), which the input should have 3 channel. The structure of the network is showed below:
(See figure 1)
However when I add hook in this layer, shows below in the deal_inception method, I can only get input information of one channel.
(See figure 2)
The first layer and output of the model is showed below:
(See figure 3)
From the size of the inputs which returned by the hook(get_hook method), it is as the following:
(See figure 4)
From the code showed before, the ‘inputs’ is the list where hook function store the input in, and this list only contain one element since we only inference one image in to the network. The inputs.shape should be (3,32,127,127), but it turns out (1,32,127,127) instead, it looks like only one channel input information or hooked.
Could you tell me where the other two is, and how to revise my code to get the whole input about the first layer? Thanks.
Could you post a code snippet by wrapping it into three backticks ```, which would make debugging easier, as the posted image is hard to read?