-
Notifications
You must be signed in to change notification settings - Fork 18.6k
fix LossLayer::Reshape() for Nd-blobs #2814
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
Conversation
|
Thanks for noticing this. The check pretty clearly needs to go since there's no reason loss layers must take 4-d bottoms. Options:
|
|
Thanks for the analysis @longjon -- since ND blobs there are a lot of parts of the code that still awkwardly/incorrectly assume that blobs have a first dimension that corresponds to a "batch", whose items are independent instances. As Caffe becomes more general the notions of instances and batches get less well-defined, e.g. with sequence problems, one might have a data with dimensions Anyway, I'd be in favor of your last option -- removing the check here and moving it to individual layers. I'd also be fine with merging this for now as it's a strict improvement over what's currently there. |
|
I think removing it and only adding it to layers that expect it is a good idea. However, offhand, I can't think of a loss layer that requires this check? |
|
Well, no need to be offhand, let's take a glance:
So it looks like all but If you want to simply distribute this check to the non- |
LossLayer::Reshape() uses old-style code for accessing blobs, which will cause a CHECK failure for N-d blobs. This patch fixes it.