LECI icon indicating copy to clipboard operation
LECI copied to clipboard

code problem

Open depcco opened this issue 1 year ago • 2 comments

@CM-BF HI,I have a question about a piece of code. In GOOD\networks\models\GINS, there is code as shown in the image. Based on my understanding, self.convs.extend is used for the assignment operation, so the returned self.convs should be None. However, when I debugged it, it actually returned a specific network structure. Could you tell me why this happens? Thank you so much. image

depcco avatar Sep 18 '24 10:09 depcco

Hi @depcco,

The code logic here is to create a GIN with num_layer layers with different initial modules. The .extend operation is just to append the num_layer - 1 GIN layers to the convs ModuleList. Note that convs.append only supports appending one module, while convs.extend supports merging with another list of modules. Please refer to the official reference for more details.

Thank you!

Best regards, Shurui

CM-BF avatar Sep 18 '24 16:09 CM-BF

thank you Shurui。I think I've figured out this problem

depcco avatar Sep 19 '24 02:09 depcco