TileLayer #2083

Merged
merged 2 commits into from Aug 26, 2015

Conversation

Projects
None yet
4 participants
Contributor

jeffdonahue commented Mar 9, 2015

This adds a layer to duplicate an input Blob N times along any axis. AKA repmat. (This is less general than either np.tile or repmat as those allow arbitrary tiling along all axes, but this satisfies a lot of use cases and could be generalized later, or even now, chained together with other Tile layers to get the more general behavior in a less convenient and probably less efficient way.)

Contributor

jeffdonahue commented Mar 9, 2015

Oh yeah, as noted by @petergehler in #966, this can already be done by a combination of SplitLayer with N tops and ConcatLayer with the corresponding N bottoms and concat_param { axis: K } where you'd set tile_param { tiles: N axis: K } here. I'm not actually sure if this is more efficient than the combination of those layers, but I think it's a bit easier and more natural to write...

@myfavouritekk myfavouritekk commented on an outdated diff Mar 22, 2015

src/caffe/layers/tile_layer.cpp
+ for (int i = 0; i < outer_dim_; ++i) {
+ caffe_copy(inner_dim_, top_diff, bottom_diff);
+ top_diff += inner_dim_;
+ for (int t = 1; t < tiles_; ++t) {
+ caffe_gpu_axpy(inner_dim_, Dtype(1), top_diff, bottom_diff);
+ top_diff += inner_dim_;
+ }
+ bottom_diff += inner_dim_;
+ }
+}
+
+INSTANTIATE_LAYER_GPU_FUNCS(TileLayer);
+
+#endif // #ifdef CPU_ONLY
+
+INSTANTIATE_CLASS(TileLayer);
@myfavouritekk

myfavouritekk Mar 22, 2015

INSTANTIATE_LAYER_GPU_FUNCS(TileLayer); and INSTANTIATE_CLASS(TileLayer); seem to cause duplicate explicit instantiation of Forward_gpu and Backward_gpu. I put the else block in a new tile_layer.cu and solved the problem.

@myfavouritekk myfavouritekk added a commit to myfavouritekk/caffe that referenced this pull request Mar 25, 2015

@myfavouritekk myfavouritekk Merge pull request #2083 from jeffdonahue/tile-layer
TileLayer

* jeffdonahue/tile-layer:
  Add TileLayer
662f336

@weiliu89 weiliu89 added a commit to weiliu89/caffe that referenced this pull request Apr 14, 2015

@weiliu89 weiliu89 Merge pull request #2083 and fix conflicts 6eeb282
Contributor

jeffdonahue commented Aug 19, 2015

This is rebased and ready for review. I also added CUDA kernels for the GPU implementation in the latter commit.

Owner

shelhamer commented Aug 25, 2015

@jeffdonahue this looks ready to me once it's rebased for the layer param ID since #2032 was merged. Feel free to update and merge.

Contributor

jeffdonahue commented Aug 26, 2015

Rebased. Thanks for reviewing @shelhamer!

@jeffdonahue jeffdonahue added a commit that referenced this pull request Aug 26, 2015

@jeffdonahue jeffdonahue Merge pull request #2083 from jeffdonahue/tile-layer
TileLayer
990835f

@jeffdonahue jeffdonahue merged commit 990835f into BVLC:master Aug 26, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ctrevino ctrevino added a commit to Robotertechnik/caffe that referenced this pull request Aug 26, 2015

@ctrevino ctrevino Merge remote-tracking branch 'upstream/master'
Tile Layer #2083
e303c28

jeffdonahue deleted the jeffdonahue:tile-layer branch Aug 26, 2015

Hi, would you please take a look at TileLayer Usage #4422

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