Skip to content

Conversation

@jeffdonahue
Copy link
Contributor

(Cherry-picked from my RNN PR -- #2033)

This is a version of ReshapeLayer that just takes a BlobShape and reshapes its input to be that shape. It doesn't have any of the options from #108 or #1263 (infer special defaults when dim is set to 0 or 1 for some axes), but works with the new ND blobs (#1970), and I think the added options to FlattenLayer in #2082 satisfy a lot of the use cases of those options. But I'm happy to see those options added later, or maybe this shouldn't be merged without them? (I was originally in favor of replacing FlattenLayer with ReshapeLayer altogether, but the implementations are very light (all in SetUp), and I now think it's probably more intuitive just to call a "flatten" layer than figuring out the special dimension values for reshape layer to get the equivalent output.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@longjon I guess this should technically all be done in LayerSetUp since the top shape doesn't vary with the bottom shape? (But then if special options were added when certain dims of the shape are set to 0 or -1, the top would then vary with the bottom shape, so it would be moved to Reshape then? Maybe better to keep it in Reshape then?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, to me it feels like this should go in LayerSetUp. If special options were added so that top shape depended on bottom shape, then Reshape would be needed. But that isn't the case in this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed. I kept the CHECK_EQ for counts in Reshape though, which still seems right.

@jeffdonahue jeffdonahue force-pushed the simple-reshape-layer branch 2 times, most recently from 74020cc to f45c3c1 Compare March 10, 2015 20:20
@jeffdonahue jeffdonahue force-pushed the simple-reshape-layer branch from f45c3c1 to 6be7ef9 Compare March 13, 2015 01:27
myfavouritekk added a commit to myfavouritekk/caffe that referenced this pull request Mar 25, 2015
Very simple version of ReshapeLayer

* jeffdonahue/simple-reshape-layer:
  Add (very simple version of) ReshapeLayer
@jeffdonahue
Copy link
Contributor Author

replaced by #2217

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants