Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Python net spec cleanups and top-less layers #2813
Conversation
longjon
added some commits
Jul 24, 2015
longjon
added the
Python
label
Jul 24, 2015
philkr
referenced
this pull request
Jul 24, 2015
Closed
Allowing netspec to have empty top (ntop=0) #2741
longjon
added the
ready for review
label
Jul 26, 2015
|
Cool! LGTM. |
|
Sweet. Thanks Jon! |
shelhamer
added a commit
that referenced
this pull request
Aug 8, 2015
|
|
shelhamer |
eb3e114
|
shelhamer
merged commit eb3e114
into
BVLC:master
Aug 8, 2015
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
longjon commentedJul 24, 2015
This PR makes small stylistic improvements to the net spec code and includes an alternative implementation of the functionality provided by #2741.
While #2741 generates top-less layers, it breaks the meaningfulness of
fn.tops(forfnaFunction); in particular, it need no longer be true thatfn.ntop == len(fn.tops), and iterating throughfn.topsis no longer the same as iterating throughfn's tops, which now requires a special case (https://github.com/BVLC/caffe/pull/2741/files#diff-57d5ca5bbea564c189da52386291f6d8R145), which, while mild in the current code, would need to propagate to future code that operates on the (Python-level) graph ofFunctions andTops.The fake top doesn't really need to be added to
fn.tops, and could just be generated around https://github.com/BVLC/caffe/pull/2741/files#diff-57d5ca5bbea564c189da52386291f6d8R198, except that this would prohibit the top-lessFunctionfrom discovering a name assigned to this fake top.We could simply forgo naming of top-less layers, but a more complete solution is to allow naming of
Functions (layers) separately fromTops (the fourth commit here), and have top-less layers return theirFunctions rather than any (fictitious)Tops (the fifth). It might be argued that this solution ungraciously overloads the semantics of net spec layer creation, since layers sometimes returnTops and sometimesFunctions, but this is surely no worse than any solution in which top-less layers return something, since something cannot be a top that isn't. It's probably best to view this as an abbreviation of a syntax in which all layers return both theirFunctionand all theirTops (an option which could actually be added in the future if it becomes desirable to create layers with distinct layer and first-top names).A simple test for top-less layers is included.
Thanks @philkr for getting the ball rolling on toplessness, and let me know how you feel about this solution.