Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Luke,
Thanks for sharing this implementation - it's getting a lot of use on Kaggle!
Changes
This PR makes some minor changes to the final layers of the network, in order to allow for a simpler and more flexible implementation of
forward()
:nn.Module
instead of thefunctional
version. This makes the final layers of the network easier to modify, as users can simply override the values of these attributes.forward()
has been refactored to useview()
instead of multiple calls tosqueeze()
. This allows users to replace the pooling module without having to conform to dimension requirements.Notes
Dropout training/eval
The current training check for dropout is no longer necessary:
When you call
net.train()
ornet.eval()
, it recursively sets thetraining
attribute on all child modules. This is then used by thenn.Dropout
instance in its call toF.dropout( ... )
. Source here.I've added some tests to make it easy for you to check this.
Modifying the final layers
I've added some tests to show how users can now replace the final layers of the network, without having to subclass
EfficientNet
and override theforward()
method.Running the tests
These tests are provided as a convenience - it's of course up to you whether you want to merge any of them in. Let me know what you think!
Kind Regards,
Karl