How to have multiple blob in a single layer.

23 views
Skip to first unread message

Raj

unread,
Feb 22, 2018, 12:24:28 AM2/22/18
to Caffe Users
Hello,

     Can you please help with an issue I am facing while using caffe .

     I want to keep data in multiple blobs in my layer. In order to do so I have the following code in the layersetup function.

template<typename Dtype>
void LayerName<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top)
{
     this->blob_.resize(2);

     vector<int> blob0_size;
     vector<int> blob1_size;

     blob0.push_back(1024); blob0.push_back(8);   // first blob is of size 1024x8
     blob1.push_back(1024); blob1.push_back(8); blob1.push_back(6);    // second blob is of size 1024x8x6

    this->blobs_[0].reset(new Blob<Dtype>(blob0));
    this->blobs_[1].reset(new Blob<Dtype>(blob1));
}

However though this code compiles, I am facing issues with the data stored in the blob.
On suspecting that data is changing strangely with iterations, I tried printing the blob information after doing no updates in the backward_gpu function.

My backward_gpu function is now simply :

emplate<typename Dtype>
  void LayerName<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom)
{
   // Do nothing.
}

however I see updates in the layer blobs data insipte of that :( . (I observe blob data values reducing and coverging to 0 ) .
Can you please help by confirming that the blob initialization is correct and if more information is to be added in other files in order to resize the layer blobs.
What can be the possible reasons for blob data updates even though the backward gpu function makes no updates at all ?

Any help would be appreicated. Thanks.

Raj
Reply all
Reply to author
Forward
0 new messages