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

net.cpp now allows zero-sized batches #1484

Closed
wants to merge 1 commit into from

Conversation

mtamburrano
Copy link
Contributor

Implemented a way to allow zero-sized batches as discussed in #1448 with @sguada and @longjon (point 5).
The net now checks, before forwarding or backwarding anything, if some blob has num == 0, if so forward and backward are denyied and all subsequent layers are reshaped to avoid forward and bacward to those, too.
Actually the net doesn't allow a batch to have 0 size, but this could happen because #1482

This was referenced Nov 26, 2014
@longjon
Copy link
Contributor

longjon commented Dec 1, 2014

Why not just remove https://github.com/BVLC/caffe/blob/dev/src/caffe/blob.cpp#L11? (And after #1486, probably do without this requirement for all dimensions.)

One has to check to make sure this doesn't cause any problems, but most layers have a loop like https://github.com/BVLC/caffe/blob/dev/src/caffe/layers/conv_layer.cpp#L153, so they should just appropriately do nothing.

@mtamburrano
Copy link
Contributor Author

@longjon, I'm not sure all layers correctly checks for num size, for example https://github.com/BVLC/caffe/blob/dev/src/caffe/layers/inner_product_layer.cpp doesn't (I didn't check all the layers, just picked up one randomly).
With the solution implemented we don't care about layer specific implementations and the forward and backward methods are not called at all, so any useless computation is avoided.
Can't be a solution to let net.cpp to check for zero-sized batches and eventually remove these checks when we are sure that all layers act properly when num == 0?

@bhack
Copy link
Contributor

bhack commented Dec 22, 2014

@shelhamer Needs feedbacks by core members by 21 days

@bhack
Copy link
Contributor

bhack commented Feb 7, 2015

@shelhamer @longjon can you give us a follow-up?

@mtamburrano
Copy link
Contributor Author

closed, new PR is #2053

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.

4 participants