Caffe Slice Layer

19 views
Skip to first unread message

Khan

unread,
Jun 8, 2018, 11:17:51 AM6/8/18
to Caffe Users
Hi, If I have a dense layer with 1000 nodes as a bottom blob to slice layer. I want to get 2 outputs each having 500 units. How can I do this using the slice layer?
Thanks.

Przemek D

unread,
Aug 21, 2018, 9:14:36 AM8/21/18
to Caffe Users
Assuming there's an InnerProduct layer with num_output: 1000 and it produces a blob "dense", you should do something like this:
layer {
  type: "Slice"
  name: "slice"
  bottom: "dense"
  top: "dense1"
  top: "dense2"
  slice_param {
    axis: 1 #slice along dimension 1 - could be omitted since 1 is a default value
    slice_point: 500 #slice at index 500; indices [0-499] will go to dense1, while [500-...] to dense2
  }
}
A 32x1000 blob will be cut into 32x500 and 32x500 blobs. A 64x700x2 blob will be cut into 64x500x2 and 64x200x2. A 1x100 blob will error out.
Reply all
Reply to author
Forward
0 new messages