| 10 | |
| 11 | template <typename Dtype> |
| 12 | void MemoryDataLayer<Dtype>::DataLayerSetUp(const vector<Blob<Dtype>*>& bottom, |
| 13 | const vector<Blob<Dtype>*>& top) { |
| 14 | batch_size_ = this->layer_param_.memory_data_param().batch_size(); |
| 15 | channels_ = this->layer_param_.memory_data_param().channels(); |
| 16 | height_ = this->layer_param_.memory_data_param().height(); |
| 17 | width_ = this->layer_param_.memory_data_param().width(); |
| 18 | size_ = channels_ * height_ * width_; |
| 19 | CHECK_GT(batch_size_ * size_, 0) << |
| 20 | "batch_size, channels, height, and width must be specified and" |
| 21 | " positive in memory_data_param"; |
| 22 | vector<int> label_shape(1, batch_size_); |
| 23 | top[0]->Reshape(batch_size_, channels_, height_, width_); |
| 24 | top[1]->Reshape(label_shape); |
| 25 | added_data_.Reshape(batch_size_, channels_, height_, width_); |
| 26 | added_label_.Reshape(label_shape); |
| 27 | data_ = NULL; |
| 28 | labels_ = NULL; |
| 29 | added_data_.cpu_data(); |
| 30 | added_label_.cpu_data(); |
| 31 | } |
| 32 | |
| 33 | template <typename Dtype> |
| 34 | void MemoryDataLayer<Dtype>::AddDatumVector(const vector<Datum>& datum_vector) { |