Search code examples
luadeep-learningtorch

understand use of nn.Identity() in model definition using torch


I was understanding the CGAN model given here. The generative model has symmetric skip connections as it is explained in the paper here. Hence, I understand the lines such as:

 d2 = {d2_,e4} - nn.CAddTable(true)

However, instead of doing the same thing after the last deconv layer d6, the following thing is done:

d6 = d61 - nn.Identity()

Can someone please help me understand why nn.Identity() is used here?


Solution

  • nn.Identity() is a module that forwards the input as such. It could be skipped in their code. Nevertheless it seems that they aren't implementing the model they described in figure 3 of their paper. Maybe it performs better without the third skip connection.