summaryrefslogtreecommitdiff
path: root/caffe2
diff options
context:
space:
mode:
authorMichael Liu <michaeluw@fb.com>2019-02-13 20:51:55 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-02-13 21:01:28 -0800
commit92a516b9ff42225feaa5887eae8d9075239597fd (patch)
tree4d8a2fc79913720408be43a45931fb1cd5312026 /caffe2
parent84bdf860349031eaf8b64c5f075875eeaa0d3fc1 (diff)
downloadpytorch-92a516b9ff42225feaa5887eae8d9075239597fd.tar.gz
pytorch-92a516b9ff42225feaa5887eae8d9075239597fd.tar.bz2
pytorch-92a516b9ff42225feaa5887eae8d9075239597fd.zip
Apply modernize-use-override - 2/2
Summary: Use C++11’s override and remove virtual where applicable. Change are automatically generated. Reviewed By: Orvid Differential Revision: D14054721 fbshipit-source-id: 15d266fa1779b1e3ea6270f00841d7fb1e4d44ee
Diffstat (limited to 'caffe2')
-rw-r--r--caffe2/operators/conv_transpose_op_cudnn.cc6
-rw-r--r--caffe2/operators/counter_ops.cc2
-rw-r--r--caffe2/operators/dataset_ops.cc2
-rw-r--r--caffe2/operators/dropout_op_cudnn.cc4
-rw-r--r--caffe2/operators/index_ops.cc2
-rw-r--r--caffe2/operators/local_response_normalization_op_cudnn.cc4
-rw-r--r--caffe2/operators/mem_query_op.cu2
-rw-r--r--caffe2/operators/norm_planar_yuv_op.cc2
-rw-r--r--caffe2/operators/operator_fallback_gpu_test.cc2
-rw-r--r--caffe2/operators/order_switch_ops_cudnn.cc2
-rw-r--r--caffe2/operators/pool_op_cudnn.cc4
-rw-r--r--caffe2/operators/softmax_op_cudnn.cc4
-rw-r--r--caffe2/operators/stylizer_ops.cc4
-rw-r--r--caffe2/operators/text_file_reader_utils_test.cc4
-rw-r--r--caffe2/operators/transpose_op_cudnn.cc2
-rw-r--r--caffe2/operators/utility_ops_cudnn.cc2
-rw-r--r--caffe2/opt/converter.cc12
-rw-r--r--caffe2/python/pybind_state_ideep.cc7
-rw-r--r--caffe2/utils/threadpool/ThreadPool.cc4
19 files changed, 37 insertions, 34 deletions
diff --git a/caffe2/operators/conv_transpose_op_cudnn.cc b/caffe2/operators/conv_transpose_op_cudnn.cc
index cd2ec26d79..a4ee8d28ac 100644
--- a/caffe2/operators/conv_transpose_op_cudnn.cc
+++ b/caffe2/operators/conv_transpose_op_cudnn.cc
@@ -53,7 +53,7 @@ class CudnnConvTransposeOpBase : public ConvTransposeUnpoolBase<CUDAContext> {
CUDNN_ENFORCE(cudnnCreateConvolutionDescriptor(&conv_desc_));
}
- ~CudnnConvTransposeOpBase() {
+ ~CudnnConvTransposeOpBase() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(bottom_desc_));
CUDNN_ENFORCE(cudnnDestroyFilterDescriptor(filter_desc_));
if (InputSize() == 3) {
@@ -88,7 +88,7 @@ class CudnnConvTransposeOp final : public CudnnConvTransposeOpBase {
CudnnConvTransposeOp(const OperatorDef& operator_def, Workspace* ws)
: CudnnConvTransposeOpBase(operator_def, ws) {}
- ~CudnnConvTransposeOp() {}
+ ~CudnnConvTransposeOp() override {}
bool RunOnDevice() override;
@@ -111,7 +111,7 @@ class CudnnConvTransposeGradientOp final : public CudnnConvTransposeOpBase {
"If bias is not present, you should not have 3 grad output.");
}
- ~CudnnConvTransposeGradientOp() {}
+ ~CudnnConvTransposeGradientOp() override {}
bool RunOnDevice() override;
diff --git a/caffe2/operators/counter_ops.cc b/caffe2/operators/counter_ops.cc
index 2a2278c313..e971aae876 100644
--- a/caffe2/operators/counter_ops.cc
+++ b/caffe2/operators/counter_ops.cc
@@ -136,7 +136,7 @@ namespace {
class CounterSerializer : public BlobSerializerBase {
public:
CounterSerializer() {}
- ~CounterSerializer() {}
+ ~CounterSerializer() override {}
void Serialize(
const void* pointer,
diff --git a/caffe2/operators/dataset_ops.cc b/caffe2/operators/dataset_ops.cc
index 4a8efc4621..f371c9f752 100644
--- a/caffe2/operators/dataset_ops.cc
+++ b/caffe2/operators/dataset_ops.cc
@@ -1419,7 +1419,7 @@ SHOULD_NOT_DO_GRADIENT(PackRecords);
class TreeCursorSerializer : public BlobSerializerBase {
public:
TreeCursorSerializer() {}
- ~TreeCursorSerializer() {}
+ ~TreeCursorSerializer() override {}
void Serialize(
const void* pointer,
diff --git a/caffe2/operators/dropout_op_cudnn.cc b/caffe2/operators/dropout_op_cudnn.cc
index ffec6b1c2e..8f3241e3ae 100644
--- a/caffe2/operators/dropout_op_cudnn.cc
+++ b/caffe2/operators/dropout_op_cudnn.cc
@@ -36,7 +36,7 @@ class CuDNNDropoutOp final : public Operator<CUDAContext> {
}
}
- ~CuDNNDropoutOp() noexcept {
+ ~CuDNNDropoutOp() noexcept override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(data_desc_));
CUDNN_ENFORCE(cudnnDestroyDropoutDescriptor(dropout_desc_));
}
@@ -98,7 +98,7 @@ class CuDNNDropoutGradientOp final : public Operator<CUDAContext> {
CAFFE_ENFORCE(scratch_blob_);
}
- ~CuDNNDropoutGradientOp() noexcept {
+ ~CuDNNDropoutGradientOp() noexcept override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(data_desc_));
CUDNN_ENFORCE(cudnnDestroyDropoutDescriptor(dropout_desc_));
}
diff --git a/caffe2/operators/index_ops.cc b/caffe2/operators/index_ops.cc
index b06c706bc9..b4db62b78d 100644
--- a/caffe2/operators/index_ops.cc
+++ b/caffe2/operators/index_ops.cc
@@ -248,7 +248,7 @@ SHOULD_NOT_DO_GRADIENT(IndexSize);
class IndexSerializer : public BlobSerializerBase {
public:
IndexSerializer() {}
- ~IndexSerializer() {}
+ ~IndexSerializer() override {}
void Serialize(
const void* pointer,
diff --git a/caffe2/operators/local_response_normalization_op_cudnn.cc b/caffe2/operators/local_response_normalization_op_cudnn.cc
index 10d1a9a10d..02937a758b 100644
--- a/caffe2/operators/local_response_normalization_op_cudnn.cc
+++ b/caffe2/operators/local_response_normalization_op_cudnn.cc
@@ -23,7 +23,7 @@ class CuDNNLRNOp final : public Operator<CUDAContext> {
cudnnSetLRNDescriptor(norm_desc_, size_, alpha_, beta_, bias_));
}
- ~CuDNNLRNOp() {
+ ~CuDNNLRNOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(data_desc_));
CUDNN_ENFORCE(cudnnDestroyLRNDescriptor(norm_desc_));
}
@@ -65,7 +65,7 @@ class CuDNNLRNGradientOp final : public Operator<CUDAContext> {
cudnnSetLRNDescriptor(norm_desc_, size_, alpha_, beta_, bias_));
}
- ~CuDNNLRNGradientOp() {
+ ~CuDNNLRNGradientOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(data_desc_));
CUDNN_ENFORCE(cudnnDestroyLRNDescriptor(norm_desc_));
}
diff --git a/caffe2/operators/mem_query_op.cu b/caffe2/operators/mem_query_op.cu
index fcd14a9aa9..a9ea23573b 100644
--- a/caffe2/operators/mem_query_op.cu
+++ b/caffe2/operators/mem_query_op.cu
@@ -8,7 +8,7 @@ class GetGPUMemoryUsageOp final : public Operator<CUDAContext> {
public:
GetGPUMemoryUsageOp(const OperatorDef& operator_def, Workspace* ws)
: Operator<CUDAContext>(operator_def, ws) {}
- ~GetGPUMemoryUsageOp() {}
+ ~GetGPUMemoryUsageOp() override {}
bool RunOnDevice() override {
CHECK_EQ(InputSize(), 0);
diff --git a/caffe2/operators/norm_planar_yuv_op.cc b/caffe2/operators/norm_planar_yuv_op.cc
index 724ce14e80..19fc08aba2 100644
--- a/caffe2/operators/norm_planar_yuv_op.cc
+++ b/caffe2/operators/norm_planar_yuv_op.cc
@@ -12,7 +12,7 @@ class NormalizePlanarYUVOp : public Operator<CPUContext> {
USE_OPERATOR_FUNCTIONS(CPUContext);
using Operator<CPUContext>::Operator;
- bool RunOnDevice() {
+ bool RunOnDevice() override {
const auto& X = Input(0);
const auto& M = Input(1); // mean
const auto& S = Input(2); // standard deviation
diff --git a/caffe2/operators/operator_fallback_gpu_test.cc b/caffe2/operators/operator_fallback_gpu_test.cc
index 7b8bb97040..5606bac38c 100644
--- a/caffe2/operators/operator_fallback_gpu_test.cc
+++ b/caffe2/operators/operator_fallback_gpu_test.cc
@@ -11,7 +11,7 @@ class IncrementByOneOp final : public Operator<CPUContext> {
public:
IncrementByOneOp(const OperatorDef& def, Workspace* ws)
: Operator<CPUContext>(def, ws) {}
- bool RunOnDevice() {
+ bool RunOnDevice() override {
const auto& in = Input(0);
auto* out = Output(0, in.sizes(), at::dtype<float>());
diff --git a/caffe2/operators/order_switch_ops_cudnn.cc b/caffe2/operators/order_switch_ops_cudnn.cc
index 46704c812c..6d4f7c5bf4 100644
--- a/caffe2/operators/order_switch_ops_cudnn.cc
+++ b/caffe2/operators/order_switch_ops_cudnn.cc
@@ -22,7 +22,7 @@ class CuDNNOrderSwithOpBase : public Operator<CUDAContext> {
CUDNN_ENFORCE(cudnnCreateTensorDescriptor(&Y_desc_));
}
- virtual ~CuDNNOrderSwithOpBase() {
+ ~CuDNNOrderSwithOpBase() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(X_desc_));
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(Y_desc_));
}
diff --git a/caffe2/operators/pool_op_cudnn.cc b/caffe2/operators/pool_op_cudnn.cc
index 120d29bb11..45dfc41b79 100644
--- a/caffe2/operators/pool_op_cudnn.cc
+++ b/caffe2/operators/pool_op_cudnn.cc
@@ -86,7 +86,7 @@ class CuDNNPoolOp final : public ConvPoolOpBase<CUDAContext> {
}
}
- ~CuDNNPoolOp() {
+ ~CuDNNPoolOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(X_desc_));
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(Y_desc_));
CUDNN_ENFORCE(cudnnDestroyPoolingDescriptor(pooling_desc_));
@@ -226,7 +226,7 @@ class CuDNNPoolGradientOp final : public ConvPoolOpBase<CUDAContext> {
}
}
- ~CuDNNPoolGradientOp() {
+ ~CuDNNPoolGradientOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(X_desc_));
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(Y_desc_));
CUDNN_ENFORCE(cudnnDestroyPoolingDescriptor(pooling_desc_));
diff --git a/caffe2/operators/softmax_op_cudnn.cc b/caffe2/operators/softmax_op_cudnn.cc
index 28880e9787..38f9c40bf4 100644
--- a/caffe2/operators/softmax_op_cudnn.cc
+++ b/caffe2/operators/softmax_op_cudnn.cc
@@ -22,7 +22,7 @@ class CuDNNSoftmaxOp final : public Operator<CUDAContext> {
CUDNN_ENFORCE(cudnnCreateTensorDescriptor(&desc_));
}
- ~CuDNNSoftmaxOp() {
+ ~CuDNNSoftmaxOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(desc_));
}
@@ -84,7 +84,7 @@ class CuDNNSoftmaxGradientOp final : public Operator<CUDAContext> {
CUDNN_ENFORCE(cudnnCreateTensorDescriptor(&desc_));
}
- ~CuDNNSoftmaxGradientOp() {
+ ~CuDNNSoftmaxGradientOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(desc_));
}
diff --git a/caffe2/operators/stylizer_ops.cc b/caffe2/operators/stylizer_ops.cc
index 76bdbce45b..9b4e69f231 100644
--- a/caffe2/operators/stylizer_ops.cc
+++ b/caffe2/operators/stylizer_ops.cc
@@ -74,7 +74,7 @@ class PackedInt8BGRANHWCToNCHWCStylizerPreprocessOp
Workspace* ws)
: Operator<CPUContext>(operator_def, ws), ws_(ws) {}
- bool RunOnDevice() {
+ bool RunOnDevice() override {
const auto& X = Input(0);
const auto& mean = Input(1);
@@ -410,7 +410,7 @@ class BRGNCHWCToPackedInt8BGRAStylizerDeprocessOp
// Expect this many channels as output
static constexpr int kOutputChannels = 4;
- bool RunOnDevice() {
+ bool RunOnDevice() override {
const auto& X = Input(0);
const auto& mean = Input(1);
diff --git a/caffe2/operators/text_file_reader_utils_test.cc b/caffe2/operators/text_file_reader_utils_test.cc
index 43d8d1466a..ddec638b3a 100644
--- a/caffe2/operators/text_file_reader_utils_test.cc
+++ b/caffe2/operators/text_file_reader_utils_test.cc
@@ -66,7 +66,7 @@ TEST(TextFileReaderUtilsTest, TokenizeTest) {
ChunkProvider(const std::string& str) : ch(str) {}
std::string ch;
size_t charIdx{0};
- void operator()(CharRange& range) {
+ void operator()(CharRange& range) override {
if (charIdx >= ch.size()) {
range.start = nullptr;
range.end = nullptr;
@@ -77,7 +77,7 @@ TEST(TextFileReaderUtilsTest, TokenizeTest) {
charIdx = endIdx;
}
};
- void reset() {
+ void reset() override {
charIdx = 0;
}
};
diff --git a/caffe2/operators/transpose_op_cudnn.cc b/caffe2/operators/transpose_op_cudnn.cc
index 874ecf6a23..2b0f12ec0e 100644
--- a/caffe2/operators/transpose_op_cudnn.cc
+++ b/caffe2/operators/transpose_op_cudnn.cc
@@ -34,7 +34,7 @@ class CuDNNTransposeOp final : public Operator<CUDAContext> {
CUDNN_ENFORCE(cudnnCreateTensorDescriptor(&yDesc_));
}
- ~CuDNNTransposeOp() {
+ ~CuDNNTransposeOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(xDesc_));
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(yDesc_));
}
diff --git a/caffe2/operators/utility_ops_cudnn.cc b/caffe2/operators/utility_ops_cudnn.cc
index bd04f30762..7fe4503b2b 100644
--- a/caffe2/operators/utility_ops_cudnn.cc
+++ b/caffe2/operators/utility_ops_cudnn.cc
@@ -21,7 +21,7 @@ class CuDNNWeightedSumOp : public Operator<CUDAContext> {
add_desc_, CUDNN_OP_TENSOR_ADD, CUDNN_DATA_FLOAT, CUDNN_PROPAGATE_NAN));
}
- ~CuDNNWeightedSumOp() {
+ ~CuDNNWeightedSumOp() override {
CUDNN_ENFORCE(cudnnDestroyTensorDescriptor(data_desc_));
CUDNN_ENFORCE(cudnnDestroyOpTensorDescriptor(add_desc_));
}
diff --git a/caffe2/opt/converter.cc b/caffe2/opt/converter.cc
index 2f9c8fbe2d..6f5cde56bc 100644
--- a/caffe2/opt/converter.cc
+++ b/caffe2/opt/converter.cc
@@ -137,7 +137,7 @@ class ConvConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~ConvConverter() {}
+ ~ConvConverter() override {}
};
REGISTER_CONVERTER(Conv, ConvConverter);
@@ -175,7 +175,7 @@ class ClipConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~ClipConverter() {}
+ ~ClipConverter() override {}
};
REGISTER_CONVERTER(Clip, ClipConverter);
@@ -190,7 +190,7 @@ class AveragePoolConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~AveragePoolConverter() {}
+ ~AveragePoolConverter() override {}
};
REGISTER_CONVERTER(AveragePool, AveragePoolConverter);
@@ -205,7 +205,7 @@ class MaxPoolConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~MaxPoolConverter() {}
+ ~MaxPoolConverter() override {}
};
REGISTER_CONVERTER(MaxPool, MaxPoolConverter);
@@ -231,7 +231,7 @@ class ConcatConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~ConcatConverter() {}
+ ~ConcatConverter() override {}
};
REGISTER_CONVERTER(Concat, ConcatConverter);
@@ -258,7 +258,7 @@ class FCConverter : public Converter {
}
// Does not override default converter to OperatorDef
- virtual ~FCConverter() {}
+ ~FCConverter() override {}
};
REGISTER_CONVERTER(FC, FCConverter);
diff --git a/caffe2/python/pybind_state_ideep.cc b/caffe2/python/pybind_state_ideep.cc
index f829622e38..7057ca9eca 100644
--- a/caffe2/python/pybind_state_ideep.cc
+++ b/caffe2/python/pybind_state_ideep.cc
@@ -160,8 +160,11 @@ public:
#endif
}
- void Feed(const DeviceOption &option, PyArrayObject *original_array,
- Blob *blob, bool in_place) {
+ void Feed(
+ const DeviceOption& option,
+ PyArrayObject* original_array,
+ Blob* blob,
+ bool in_place) override {
#ifdef USE_NUMPY
try {
PyArrayObject *array = PyArray_GETCONTIGUOUS(original_array);
diff --git a/caffe2/utils/threadpool/ThreadPool.cc b/caffe2/utils/threadpool/ThreadPool.cc
index cf0dbc25f8..b6e8d7519d 100644
--- a/caffe2/utils/threadpool/ThreadPool.cc
+++ b/caffe2/utils/threadpool/ThreadPool.cc
@@ -113,12 +113,12 @@ void ThreadPool::run(const std::function<void(int, size_t)>& fn, size_t range) {
struct FnTask : public Task {
FnTask(){};
- virtual ~FnTask(){};
+ ~FnTask() override{};
const std::function<void(int, size_t)> *fn_;
int idx_;
size_t start_;
size_t end_;
- virtual void Run() override {
+ void Run() override {
for (auto i = start_; i < end_; ++i) {
(*fn_)(idx_, i);
}