balbasty / nitorch

Neuroimaging in PyTorch
Other
83 stars 14 forks source link

feat: Dropout layer #53

Closed brudfors closed 2 years ago

brudfors commented 2 years ago

@balbasty could you please tell me if you think this integration of Dropout into nitorch is okay?

I have added a dropout module, that is integrated into the conv class (see Line 833 in conv.py and Line 7 in dropout.py). I have a flag in the forward call of Dropout to ensure it is only applied during training. The only thing that is a bit messed up is the model printing:

image

because how I merge Dropout and the activation function.

The only model where I have included the dropout option is the regular CNN.

balbasty commented 2 years ago

Looks good! For pretty printing what you could do is not save self.dropout = dropout but only do self.activation = dropout. And in the dropout class, you could have the pretty printing show the activation as well, e.g. Dropout(ReLU()).

brudfors commented 2 years ago

Good suggestion (y) I will try that

brudfors commented 2 years ago

@balbasty your suggestion fixed the printing issue, want to merge?

balbasty commented 2 years ago

Done! Thanks :)