Element wise product of two blobs with N and 1 channels?

44 views
Skip to first unread message

Ilya Zhenin

unread,
Jul 11, 2017, 12:05:14 PM7/11/17
to Caffe Users
I want to mask out one blob that has shape (1, c, h, w), c > 1 by other blob with shape (1,1, h, w). I.E. perform element wise product by second blob with each feauture map from first blob. 

At forward try Caffe gives an error - shape mismatch. Is there a way to do such thing? Without extreme slicing and concatenating 

Przemek D

unread,
Jul 12, 2017, 4:33:57 AM7/12/17
to Caffe Users
You can broadcast the other blob (1,1,H,W) to your desired shape using a Tile layer. In its tile_param specify axis: 1 and set tiles to the number of channels in the first blob.
Reply all
Reply to author
Forward
0 new messages