Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs for Conv etc. #1391

Merged
merged 12 commits into from
Nov 14, 2020
Merged

Improve docs for Conv etc. #1391

merged 12 commits into from
Nov 14, 2020

Conversation

mcabbott
Copy link
Member

@mcabbott mcabbott commented Nov 9, 2020

This re-writes the docstrings for the convolutional layers, as I thought they were confusing and occasionally misleading. (I guess they grew organically over time.) It adds many examples as these often seem clearer than words; hopefully they will be run as doctests but I'm not entirely sure.

No functional changes.

One small printing change, that MaxPool((5, 5), pad = 2, stride = (5, 5)) prints like this, not pad = (2, 2, 2, 2). Perhaps that should be made still less verbose. Or Conv more verbose?

@DrChainsaw
Copy link
Contributor

Worth pointing out that ConvTranspose is the odd bird in the conv-gang w.r.t SamePad as it has the relationship outsize = insize * stride.

src/layers/conv.jl Outdated Show resolved Hide resolved
@CarloLucibello
Copy link
Member

This PR is a great improvement, thanks! It's ready to be merged?

@mcabbott
Copy link
Member Author

I have one more commit, to simplify printing of MaxPool by hiding strides & padding when they have their default values. May as well, right?

@CarloLucibello
Copy link
Member

sure

@CarloLucibello
Copy link
Member

I have one more commit, to simplify printing of MaxPool by hiding strides & padding when they have their default values. May as well, right?

actually I'm not sure about this, but I think it's ok since the defaults are so commonly used and intuitive for this layer

@mcabbott
Copy link
Member Author

mcabbott commented Nov 14, 2020

Can un-do if you think it's better. But otherwise I am done here.

At the moment Conv doesn't print padding/stride etc. at all. But if we want to make that verbose too, so that copying the printed output gives the same dimensions, then perhaps that's another PR.

@CarloLucibello
Copy link
Member

look's fine like this, thanks

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 14, 2020

Build succeeded:

@bors bors bot merged commit c469b40 into FluxML:master Nov 14, 2020
@mcabbott mcabbott deleted the convdoc branch November 14, 2020 16:03
@mcabbott mcabbott mentioned this pull request Nov 14, 2020
4 tasks
@mcabbott mcabbott mentioned this pull request Nov 27, 2020
4 tasks
@mcabbott
Copy link
Member Author

Note to self: Only the docstring for the first method of Conv seems to show up here:

https://fluxml.ai/Flux.jl/dev/models/layers/#Flux.Conv

According to https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@docs-block one can give signatures, but they must be exact. So we should fix that once the signature has settled down.

bors bot added a commit that referenced this pull request Dec 30, 2020
1394: remove some unused Conv constructors r=DhairyaLGandhi a=CarloLucibello

I think these constructors can go, I suspect no one is using them and they weren't even tested. 
Docstrings need some love, I won't do it here in order to avoid conflicts with #1391 

As a general rule, we consistently provide `Layer(W, b)` constructors, so no need to also have `Layer(; weight=W, bias=b)` for an arbitrary subset of the layers. 

### PR Checklist

- [ ] Tests are added
- [x] Entry in NEWS.md
- [ ] Documentation, if applicable
- [ ] Final review from `@dhairyagandhi96` (for API changes).


Co-authored-by: Carlo Lucibello <[email protected]>
bors bot added a commit that referenced this pull request Dec 31, 2020
1394: remove some unused Conv constructors r=DhairyaLGandhi a=CarloLucibello

I think these constructors can go, I suspect no one is using them and they weren't even tested. 
Docstrings need some love, I won't do it here in order to avoid conflicts with #1391 

As a general rule, we consistently provide `Layer(W, b)` constructors, so no need to also have `Layer(; weight=W, bias=b)` for an arbitrary subset of the layers. 

### PR Checklist

- [ ] Tests are added
- [x] Entry in NEWS.md
- [ ] Documentation, if applicable
- [ ] Final review from `@dhairyagandhi96` (for API changes).


Co-authored-by: Carlo Lucibello <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants