divelab / LECI

The implementation of "Joint Learning of Label and Environment Causal Independence for Graph Out-of-Distribution Generalization" (NeurIPS 2023)
GNU General Public License v3.0
16 stars 1 forks source link

code problem #4

Open depcco opened 4 days ago

depcco commented 4 days ago

@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

CM-BF commented 4 days ago

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

depcco commented 4 days ago

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