| 106 | |
| 107 | template <typename Dtype> |
| 108 | void MemoryDataLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, |
| 109 | const vector<Blob<Dtype>*>& top) { |
| 110 | CHECK(data_) << "MemoryDataLayer needs to be initialized by calling Reset"; |
| 111 | top[0]->Reshape(batch_size_, channels_, height_, width_); |
| 112 | top[1]->Reshape(batch_size_, 1, 1, 1); |
| 113 | top[0]->set_cpu_data(data_ + pos_ * size_); |
| 114 | top[1]->set_cpu_data(labels_ + pos_); |
| 115 | pos_ = (pos_ + batch_size_) % n_; |
| 116 | if (pos_ == 0) |
| 117 | has_new_data_ = false; |
| 118 | } |
| 119 | |
| 120 | INSTANTIATE_CLASS(MemoryDataLayer); |
| 121 | REGISTER_LAYER_CLASS(MemoryData); |
nothing calls this directly
no test coverage detected