Skip to content

Commit bfc8ee7

Browse files
committed
flownet2 patch: fix all the errors in CPU-Only mode build. All runtests pass.
1 parent 10194eb commit bfc8ee7

22 files changed

+124
-39
lines changed

include/caffe/layers/black_augmentation_layer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class BlackAugmentationLayer : public Layer<Dtype> {
3737
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
3838
const vector<Blob<Dtype>*>& top);
3939
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
40-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "BlackAugmentation cannot do backward"; }
40+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4141
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
42-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "BlackAugmentation cannot do backward"; }
42+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4343
};
4444

4545

include/caffe/layers/data_augmentation_layer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class DataAugmentationLayer : public AugmentationLayerBase<Dtype>, public Layer<
3636
const vector<Blob<Dtype>*>& top);
3737

3838
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
39-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { for(int i=0; i<propagate_down.size(); i++) if(propagate_down[i]) LOG(FATAL) << "DataAugmentationLayer cannot do backward."; return; }
39+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4040
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
41-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { for(int i=0; i<propagate_down.size(); i++) if(propagate_down[i]) LOG(FATAL) << "DataAugmentationLayer cannot do backward."; return; }
41+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4242

4343

4444
virtual inline bool DoesUseCustomCopyBlobs() const { return true; }

include/caffe/layers/flo_writer_layer.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ class FLOWriterLayer : public Layer<Dtype> {
3333
const vector<Blob<Dtype>*>& top);
3434

3535
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
36-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {}
37-
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
38-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {}
36+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
37+
3938
};
4039

4140
} // namespace caffe

include/caffe/layers/float_reader_layer.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class FloatReaderLayer : public Layer<Dtype> {
3333
const vector<Blob<Dtype>*>& top);
3434

3535
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
36-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "FloatReaderLayer cannot do backward."; return; }
37-
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
38-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "FloatReaderLayer cannot do backward."; return; }
36+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
3937
};
4038

4139
} // namespace caffe

include/caffe/layers/float_writer_layer.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class FloatWriterLayer : public Layer<Dtype> {
3333
const vector<Blob<Dtype>*>& top);
3434

3535
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
36-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {}
37-
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
38-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {}
36+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
3937
};
4038

4139
} // namespace caffe

include/caffe/layers/flow_augmentation_layer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class FlowAugmentationLayer : public AugmentationLayerBase<Dtype>, public Layer<
3737
const vector<Blob<Dtype>*>& top);
3838

3939
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
40-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "FlowAugmentationLayer cannot do backward."; return; }
40+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4141
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
42-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "FlowAugmentationLayer cannot do backward."; return; }
42+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4343

4444

4545
shared_ptr<SyncedMemory> coeff_matrices1_;

include/caffe/layers/generate_augmentation_parameters_layer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class GenerateAugmentationParametersLayer : public AugmentationLayerBase<Dtype>,
3535
const vector<Blob<Dtype>*>& top);
3636

3737
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
38-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "GenerateAugmentationParametersLayer cannot do backward."; return; }
38+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
3939
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
40-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "GenerateAugmentationParametersLayer cannot do backward."; return; }
40+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
4141

4242

4343
int num_params_;

include/caffe/layers/mean_layer.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class MeanLayer : public Layer<Dtype> {
2929
const vector<Blob<Dtype>*>& top);
3030

3131
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
32-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "MeanLayer cannot do backward."; return; }
33-
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
34-
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { LOG(FATAL) << "MeanLayer cannot do backward."; return; }
32+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
3533
};
3634

3735

src/caffe/layers/black_augmentation_layer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ void BlackAugmentationLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bott
4040
NOT_IMPLEMENTED;
4141
}
4242

43+
template <typename Dtype>
44+
void BlackAugmentationLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
45+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom)
46+
{
47+
LOG(FATAL) << "BlackAugmentation cannot do backward";
48+
return;
49+
}
50+
4351
#ifdef CPU_ONLY
4452
STUB_GPU(BlackAugmentationLayer);
4553
#endif

src/caffe/layers/black_augmentation_layer.cu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ void BlackAugmentationLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bott
9797
}
9898
}
9999

100+
template <typename Dtype>
101+
void BlackAugmentationLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
102+
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom)
103+
{
104+
LOG(FATAL) << "BlackAugmentation cannot do backward";
105+
return;
106+
}
100107

101108
INSTANTIATE_LAYER_GPU_FUNCS(BlackAugmentationLayer);
102109

0 commit comments

Comments
 (0)