nmhkahn / torchsummaryX

torchsummaryX: Improved visualization tool of torchsummary
302 stars 32 forks source link

support siamese network? #5

Closed JiangStein closed 5 years ago

JiangStein commented 5 years ago

Hi, I build a siamese network, and the forward function is like def forward(self, input1, input2): x1 = self.cnn(input1) x2 = self.cnn(input2) output = x1-x2 return output Does torchsummaryX support such situation? If so, how should I write summary? I tried summary(net,(3,224,224),(3,224,224)), but it didn't work. Thank you!

nmhkahn commented 5 years ago

Hi. In that case, summary(net, torch.zeros((1, 3, 224, 224)), input2=torch.zeros((1, 3, 224, 224))) will work. Unlike torchsummary, you should pass the tensor to the summary function not shape of input.

JiangStein commented 5 years ago

It works! Thanks a lot for your help, it is much more brief than print!