Skip to content

Comments

Switch layer#1496

Closed
sguada wants to merge 4 commits intoBVLC:devfrom
sguada:switch_layer
Closed

Switch layer#1496
sguada wants to merge 4 commits intoBVLC:devfrom
sguada:switch_layer

Conversation

@sguada
Copy link
Contributor

@sguada sguada commented Nov 28, 2014

This layers allows to have multiple input blobs and a selector (last blob) which will select from which input the data will be copied into the top.
All the inputs (bottoms 0 to n-2) should have the same shape, and the last bottom (n-1) contain n indices between 0 and n-2 to fill the top.
Currently if the index is out of range it will fill the corresponding part of top with zeros, this allows to do block dropout, but just passing one input bottom and a selector with 0s and 1s (the blocks corresponding with 1s will be replaced with zeros)
@longjon do you think the logic about indices out of range is confusing?

@bhack
Copy link
Contributor

bhack commented Nov 28, 2014

cc: @mtamburrano

@longjon
Copy link
Contributor

longjon commented Dec 1, 2014

Let's make this consistent with #1482 in terms of which blob is the "selector" (is it the first or the last?). I guess I like the first better, but I know both are awkward; you and @mtamburrano may discuss.

I think the out-of-range logic is dangerous. It's not uncommon in this business to accidentally feed garbage data into a layer, and currently (I think) this layer will make no complaint. I'd rather we CHECK or DCHECK the bounds, provide block dropout as a non-default option, and demand a specific value (-1, I guess (sigh)) for the dropped blocks.

@sguada
Copy link
Contributor Author

sguada commented Dec 3, 2014

@longjon I don't mind which bottom is the selector, in the first position it is easier to know which one it is but make the code a bit uglier due to the +1/-1 offsets. The selector in the last position makes the mapping easier and the order of the blobs is not altered. @mtamburrano What do you prefer?

Ok, you convince me that allowing out of bounds is probably not a good idea, so let's leave the block dropout for an actual block_dropout_layer, and enforce that the indices are within bounds.

@mtamburrano
Copy link
Contributor

@sguada, I put the selector on first blob because seems to me a bit more intuitive, but I've no preferences.
So, I'll shift the selector to last position tomorrow

Jian Leong and others added 3 commits December 3, 2014 16:04
Assume selector is last bottom blob to simplify indexing
If index is out of range just put zeros
@sguada
Copy link
Contributor Author

sguada commented Dec 4, 2014

@longjon I have leave the selector in the last bottom, but now added DCHECKS for indices.
I think indices between [0, n-1] makes sense to refer to the bottom[0] to bottom[n-1]

@mtamburrano
Copy link
Contributor

moved the selector blob to last bottom blobs position in #1482

@shelhamer shelhamer added the JD label Mar 10, 2015
@shelhamer
Copy link
Member

Closing since the dev branch is deprecated. Please send PRs to master.

@shelhamer shelhamer closed this Aug 26, 2015
@bhack
Copy link
Contributor

bhack commented Aug 26, 2015

@shelhamer Is this was already merged at #2054?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants