Deprecate ForwardPrefilled(), Forward(bottom, loss) in lieu of dropping

Relax removal of `Forward()` variations by deprecating instead.
This commit is contained in:
Evan Shelhamer 2016-02-26 22:20:50 -08:00
Родитель 2cc3844cb2
Коммит f88073aad8
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -36,6 +36,12 @@ class Net {
* *
*/ */
const vector<Blob<Dtype>*>& Forward(Dtype* loss = NULL); const vector<Blob<Dtype>*>& Forward(Dtype* loss = NULL);
/// @brief DEPRECATED; use Forward() instead.
const vector<Blob<Dtype>*>& ForwardPrefilled(Dtype* loss = NULL) {
LOG_EVERY_N(WARNING, 1000) << "DEPRECATED: ForwardPrefilled() "
<< "will be removed in a future version. Use Forward().";
return Forward(loss);
}
/** /**
* The From and To variants of Forward and Backward operate on the * The From and To variants of Forward and Backward operate on the
@ -48,6 +54,9 @@ class Net {
Dtype ForwardFromTo(int start, int end); Dtype ForwardFromTo(int start, int end);
Dtype ForwardFrom(int start); Dtype ForwardFrom(int start);
Dtype ForwardTo(int end); Dtype ForwardTo(int end);
/// @brief DEPRECATED; set input blobs then use Forward() instead.
const vector<Blob<Dtype>*>& Forward(const vector<Blob<Dtype>* > & bottom,
Dtype* loss = NULL);
/** /**
* @brief Zeroes out the diffs of all net parameters. * @brief Zeroes out the diffs of all net parameters.

Просмотреть файл

@ -566,6 +566,18 @@ const vector<Blob<Dtype>*>& Net<Dtype>::Forward(Dtype* loss) {
return net_output_blobs_; return net_output_blobs_;
} }
template <typename Dtype>
const vector<Blob<Dtype>*>& Net<Dtype>::Forward(
const vector<Blob<Dtype>*> & bottom, Dtype* loss) {
LOG_EVERY_N(WARNING, 1000) << "DEPRECATED: Forward(bottom, loss) "
<< "will be removed in a future version. Use Forward(loss).";
// Copy bottom to net bottoms
for (int i = 0; i < bottom.size(); ++i) {
net_input_blobs_[i]->CopyFrom(*bottom[i]);
}
return Forward(loss);
}
template <typename Dtype> template <typename Dtype>
void Net<Dtype>::BackwardFromTo(int start, int end) { void Net<Dtype>::BackwardFromTo(int start, int end) {
CHECK_GE(end, 0); CHECK_GE(end, 0);