diff --git a/caffe2/binaries/make_image_db.cc b/caffe2/binaries/make_image_db.cc index 5c32ec4252e..1904447db99 100644 --- a/caffe2/binaries/make_image_db.cc +++ b/caffe2/binaries/make_image_db.cc @@ -37,8 +37,10 @@ CAFFE2_DEFINE_bool(warp, false, "If warp is set, warp the images to square."); namespace caffe2 { void ConvertImageDataset( - const string& input_folder, const string& list_filename, - const string& output_db_name, const bool shuffle) { + const string& input_folder, + const string& list_filename, + const string& output_db_name, + const bool /*shuffle*/) { std::ifstream list_file(list_filename); std::vector > lines; std::string filename; diff --git a/caffe2/contrib/nervana/nervana_math_gpu.cc b/caffe2/contrib/nervana/nervana_math_gpu.cc index 09c70e43435..c3e7e6b377b 100644 --- a/caffe2/contrib/nervana/nervana_math_gpu.cc +++ b/caffe2/contrib/nervana/nervana_math_gpu.cc @@ -22,7 +22,7 @@ void Gemm( const float beta, float* C, CUDAContext* context, - TensorProto::DataType math_type) { + TensorProto::DataType /*math_type*/) { // Note that cublas follows fortran order, so the order is different from // the cblas convention. int lda = (TransA == CblasNoTrans) ? K : M; diff --git a/caffe2/contrib/prof/cuda_profile_ops.cc b/caffe2/contrib/prof/cuda_profile_ops.cc index cd9dd64f0e6..d286801c131 100644 --- a/caffe2/contrib/prof/cuda_profile_ops.cc +++ b/caffe2/contrib/prof/cuda_profile_ops.cc @@ -56,7 +56,7 @@ class CudaProfileInitializeOp : public OperatorBase { unlink(config_.c_str()); } - virtual bool Run(int /* unused */ stream_id = 0) { + virtual bool Run(int /* unused */ /*stream_id*/ = 0) { // If this fails, check the contents of "output" for hints. CUDA_CHECK( cudaProfilerInitialize(config_.c_str(), output_.c_str(), cudaCSV)); @@ -73,7 +73,7 @@ class CudaProfileStartOp : public OperatorBase { CudaProfileStartOp(const OperatorDef& operator_def, Workspace* ws) : OperatorBase(operator_def, ws) {} - virtual bool Run(int /* unused */ stream_id = 0) { + virtual bool Run(int /* unused */ /*stream_id*/ = 0) { CUDA_ENFORCE(cudaProfilerStart()); return true; } @@ -84,7 +84,7 @@ class CudaProfileStopOp : public OperatorBase { CudaProfileStopOp(const OperatorDef& operator_def, Workspace* ws) : OperatorBase(operator_def, ws) {} - virtual bool Run(int /* unused */ stream_id = 0) { + virtual bool Run(int /* unused */ /*stream_id*/ = 0) { CUDA_ENFORCE(cudaProfilerStop()); return true; } diff --git a/caffe2/contrib/torch/torch_op.h b/caffe2/contrib/torch/torch_op.h index 0be6670bdba..c5860364400 100644 --- a/caffe2/contrib/torch/torch_op.h +++ b/caffe2/contrib/torch/torch_op.h @@ -56,7 +56,7 @@ class Torch final { return Traits::tensorTy; } - void setContext(Context* context) {} + void setContext(Context* /*context*/) {} void setTensor(typename Traits::Tensor* t, Blob* blob) { CAFFE_ENFORCE_EQ(tensorTy(*blob), Traits::tensorTy); diff --git a/caffe2/contrib/transform/transform.h b/caffe2/contrib/transform/transform.h index b59e9714893..280a547e885 100644 --- a/caffe2/contrib/transform/transform.h +++ b/caffe2/contrib/transform/transform.h @@ -63,9 +63,9 @@ class Transform { * Given the current subgraph (ordered), should we append the new node at idx? */ virtual bool PatternRule( - const transform::Graph& g, - const std::vector& subgraph, - int idx) { + const transform::Graph& /*g*/, + const std::vector& /*subgraph*/, + int /*idx*/) { CAFFE_NOT_IMPLEMENTED; } @@ -74,8 +74,8 @@ class Transform { * Given a subgraph, can we accept it? */ virtual bool ValidatorRule( - const transform::Graph& g, - const std::vector& subgraph) { + const transform::Graph& /*g*/, + const std::vector& /*subgraph*/) { CAFFE_NOT_IMPLEMENTED; } @@ -84,8 +84,8 @@ class Transform { * upon the subgraph. */ virtual bool ReplaceRule( - const std::vector& subgraph, - transform::Graph* g_ptr) { + const std::vector& /*subgraph*/, + transform::Graph* /*g_ptr*/) { CAFFE_NOT_IMPLEMENTED; } diff --git a/caffe2/contrib/warpctc/ctc_op.cpp b/caffe2/contrib/warpctc/ctc_op.cpp index 27df0e64288..11afc8424a8 100644 --- a/caffe2/contrib/warpctc/ctc_op.cpp +++ b/caffe2/contrib/warpctc/ctc_op.cpp @@ -6,7 +6,7 @@ namespace caffe2 { namespace detail { template <> -ctcComputeInfo workspaceInfo(const CPUContext& context) { +ctcComputeInfo workspaceInfo(const CPUContext& /*context*/) { ctcComputeInfo result; result.loc = CTC_CPU; result.num_threads = 1; diff --git a/caffe2/core/blob_serialization.cc b/caffe2/core/blob_serialization.cc index ee9a1adb930..92b1a77f3dd 100644 --- a/caffe2/core/blob_serialization.cc +++ b/caffe2/core/blob_serialization.cc @@ -86,7 +86,8 @@ std::string Blob::Serialize(const string& name) const { // Specialization for StoreDeviceDetail for CPU - nothing needs to be done. template <> void TensorSerializer::StoreDeviceDetail( - const Tensor& input, TensorProto* proto) {} + const Tensor& /*input*/, + TensorProto* /*proto*/) {} // The actual serialization registry objects. CAFFE_DEFINE_TYPED_REGISTRY( diff --git a/caffe2/core/blob_serialization.h b/caffe2/core/blob_serialization.h index 4eaa7bd8adf..c61678fb7d3 100644 --- a/caffe2/core/blob_serialization.h +++ b/caffe2/core/blob_serialization.h @@ -263,8 +263,11 @@ void TensorSerializer::SerializeWithChunkSize( template void TensorSerializer::Serialize( - const Tensor& input, const string& name, - TensorProto* proto_ptr, size_t chunkBegin, int32_t chunkSize) { + const Tensor& input, + const string& /*name*/, + TensorProto* proto_ptr, + size_t chunkBegin, + int32_t chunkSize) { CAFFE_ENFORCE( chunkBegin <= input.size(), "Chunk begin is out of tensor: ", diff --git a/caffe2/core/blob_serializer_base.h b/caffe2/core/blob_serializer_base.h index c50f1972ff6..4bf472450b7 100644 --- a/caffe2/core/blob_serializer_base.h +++ b/caffe2/core/blob_serializer_base.h @@ -46,7 +46,7 @@ class BlobSerializerBase { const Blob& blob, const std::string& name, SerializationAcceptor acceptor, - int chunk_size) { + int /*chunk_size*/) { // Base implementation. Serialize(blob, name, acceptor); } diff --git a/caffe2/core/blob_test.cc b/caffe2/core/blob_test.cc index c576569f89a..b6b099f2d9d 100644 --- a/caffe2/core/blob_test.cc +++ b/caffe2/core/blob_test.cc @@ -649,7 +649,7 @@ class VectorCursor : public db::Cursor { pos_ = 0; } ~VectorCursor() {} - void Seek(const string& key) override {} + void Seek(const string& /*key*/) override {} void SeekToFirst() override {} void Next() override { ++pos_; @@ -790,7 +790,8 @@ TEST(CustomChunkSize, BigTensorSerialization) { tensor->mutable_data(); std::mutex mutex; int counter = 0; - auto acceptor = [&](const std::string& key, const std::string& value) { + auto acceptor = [&](const std::string& /*key*/, + const std::string& /*value*/) { std::lock_guard guard(mutex); counter++; }; diff --git a/caffe2/core/common.h b/caffe2/core/common.h index 4fcf2a961dc..5cd3b60bd25 100644 --- a/caffe2/core/common.h +++ b/caffe2/core/common.h @@ -201,7 +201,7 @@ class SkipIndices { template <> class SkipIndices<> { public: - static inline bool Contains(const int i) { + static inline bool Contains(const int /*i*/) { return false; } }; diff --git a/caffe2/core/context.h b/caffe2/core/context.h index 7cdd8c1216f..36cb9a21f59 100644 --- a/caffe2/core/context.h +++ b/caffe2/core/context.h @@ -121,7 +121,7 @@ class CPUContext final { ~CPUContext() noexcept {} - inline void SwitchToDevice(int stream_id) {} + inline void SwitchToDevice(int /*stream_id*/) {} inline void SwitchToDevice() { SwitchToDevice(0); } diff --git a/caffe2/core/db.cc b/caffe2/core/db.cc index 6dcbb476d62..711def45784 100644 --- a/caffe2/core/db.cc +++ b/caffe2/core/db.cc @@ -28,7 +28,7 @@ class MiniDBCursor : public Cursor { } ~MiniDBCursor() {} - void Seek(const string& key) override { + void Seek(const string& /*key*/) override { LOG(FATAL) << "MiniDB does not support seeking to a specifi key."; } diff --git a/caffe2/core/db.h b/caffe2/core/db.h index 6495cc9ca49..f1a5f07a044 100644 --- a/caffe2/core/db.h +++ b/caffe2/core/db.h @@ -79,7 +79,7 @@ class Transaction { */ class DB { public: - DB(const string& source, Mode mode) : mode_(mode) {} + DB(const string& /*source*/, Mode mode) : mode_(mode) {} virtual ~DB() { } /** * Closes the database. diff --git a/caffe2/core/logging.h b/caffe2/core/logging.h index 1a2b9f8c0bf..807918b59a0 100644 --- a/caffe2/core/logging.h +++ b/caffe2/core/logging.h @@ -51,7 +51,7 @@ constexpr bool IsUsingGoogleLogging() { */ void ShowLogInfoToStderr(); -inline void MakeStringInternal(std::stringstream& ss) {} +inline void MakeStringInternal(std::stringstream& /*ss*/) {} template inline void MakeStringInternal(std::stringstream& ss, const T& t) { diff --git a/caffe2/core/net.h b/caffe2/core/net.h index 309f2683ffb..ccd4c85d0b9 100644 --- a/caffe2/core/net.h +++ b/caffe2/core/net.h @@ -52,9 +52,9 @@ class NetBase { * opeartor. */ virtual vector TEST_Benchmark( - const int warmup_runs, - const int main_runs, - const bool run_individual) { + const int /*warmup_runs*/, + const int /*main_runs*/, + const bool /*run_individual*/) { LOG(ERROR) << "Benchmark not implemented for this net type."; return vector(); } diff --git a/caffe2/core/net_test.cc b/caffe2/core/net_test.cc index 6c1f1d6f9d2..42a711aad13 100644 --- a/caffe2/core/net_test.cc +++ b/caffe2/core/net_test.cc @@ -23,7 +23,7 @@ class NetTestDummyOp final : public OperatorBase { : OperatorBase(operator_def, ws), fail_(OperatorBase::GetSingleArgument("fail", false)) {} - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { if (fail_) { return false; } diff --git a/caffe2/core/operator.h b/caffe2/core/operator.h index 73a0a2f70a1..1ef36ab3497 100644 --- a/caffe2/core/operator.h +++ b/caffe2/core/operator.h @@ -101,7 +101,7 @@ class OperatorBase { inline const vector& Inputs() const { return inputs_; } inline const vector& Outputs() { return outputs_; } - virtual bool Run(int /* unused */ stream_id = 0) { + virtual bool Run(int /* unused */ /*stream_id*/ = 0) { CAFFE_NOT_IMPLEMENTED; } @@ -413,7 +413,7 @@ struct DispatchHelper, ExtraArgs...> { template struct DispatchHelper, ExtraArgs...> { template - static bool call(Op* op, TIndex size) { + static bool call(Op* op, TIndex /*size*/) { return op->template DoRunWithValue(); } }; diff --git a/caffe2/core/operator_schema.cc b/caffe2/core/operator_schema.cc index 4adaa306066..7ecaf9da25b 100644 --- a/caffe2/core/operator_schema.cc +++ b/caffe2/core/operator_schema.cc @@ -210,11 +210,11 @@ OpSchema& OpSchema::IdenticalTypeAndShapeOfInputDim(int idx, int dim) { OpSchema& OpSchema::ScalarType(::caffe2::TensorProto_DataType dt) { return TensorInferenceFunction( - [dt](const OperatorDef&, const vector& input_types) { - vector out(1); - out[0].set_data_type(dt); - return out; - }); + [dt](const OperatorDef&, const vector& /*input_types*/) { + vector out(1); + out[0].set_data_type(dt); + return out; + }); } OpSchema& OpSchema::CostInferenceFunction(CostInferenceFunctionType function) { diff --git a/caffe2/core/operator_schema_test.cc b/caffe2/core/operator_schema_test.cc index e7c01dbc0e3..e5a056270ca 100644 --- a/caffe2/core/operator_schema_test.cc +++ b/caffe2/core/operator_schema_test.cc @@ -212,13 +212,12 @@ TEST(OperatorSchemaTest, TestCastSchema) { OPERATOR_SCHEMA(OpSchemaCostInference) .NumInputs(2) .NumOutputs(2) - .CostInferenceFunction( - [](const OperatorDef& def, const vector& inputs) { - struct OpSchema::Cost c; - c.flops = - 2 * inputs[0].dims(0) * inputs[0].dims(1) * inputs[1].dims(1); - return c; - }); + .CostInferenceFunction([](const OperatorDef& /*def*/, + const vector& inputs) { + struct OpSchema::Cost c; + c.flops = 2 * inputs[0].dims(0) * inputs[0].dims(1) * inputs[1].dims(1); + return c; + }); TEST(OperatorSchemaTest, TestCostInference) { const OpSchema* schema = OpSchemaRegistry::Schema("OpSchemaCostInference"); diff --git a/caffe2/core/operator_test.cc b/caffe2/core/operator_test.cc index 32c7fb2ec30..6f4195f3daf 100644 --- a/caffe2/core/operator_test.cc +++ b/caffe2/core/operator_test.cc @@ -12,7 +12,7 @@ namespace caffe2 { class JustTest : public OperatorBase { public: using OperatorBase::OperatorBase; - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { return true; } virtual string type() { @@ -26,7 +26,7 @@ class JustTestAndNeverConstructs : public JustTest { : JustTest(def, ws) { throw UnsupportedOperatorFeature("I just don't construct."); } - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { return true; } string type() override { @@ -37,7 +37,7 @@ class JustTestAndNeverConstructs : public JustTest { class JustTestAndDoesConstruct : public JustTest { public: using JustTest::JustTest; - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { return true; } string type() override { @@ -48,7 +48,7 @@ class JustTestAndDoesConstruct : public JustTest { class JustTestWithSomeOutput : public JustTest { public: using JustTest::JustTest; - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { *OperatorBase::Output(0) = 5; return true; } diff --git a/caffe2/core/plan_executor.cc b/caffe2/core/plan_executor.cc index d9de6932e60..6cfeacb2d0d 100644 --- a/caffe2/core/plan_executor.cc +++ b/caffe2/core/plan_executor.cc @@ -72,7 +72,7 @@ struct Reporter { // Returns a function that returns `true` if we should continue // iterating, given the current iteration count. std::function getContinuationTest( - Workspace* ws, + Workspace* /*ws*/, const ExecutionStep& step) { if (step.has_should_stop_blob()) { CAFFE_ENFORCE( @@ -93,7 +93,7 @@ std::function getContinuationTest( if (onlyOnce) { return [](int64_t i) { return i == 0; }; } else { - return [](int64_t i) { return true; }; + return [](int64_t /*i*/) { return true; }; } } }; diff --git a/caffe2/core/typeid.h b/caffe2/core/typeid.h index 52f3e024e64..a2a12b44e36 100644 --- a/caffe2/core/typeid.h +++ b/caffe2/core/typeid.h @@ -221,7 +221,8 @@ class TypeMeta { * A placeholder function for types that do not allow assignment. */ template - static void _CopyNotAllowed(const void* src, void* dst, size_t n) { + static void + _CopyNotAllowed(const void* /*src*/, void* /*dst*/, size_t /*n*/) { std::cerr << "Type " << Name() << " does not allow assignment."; // This is an error by design, so we will quit loud. abort(); diff --git a/caffe2/core/workspace.h b/caffe2/core/workspace.h index ade4e63436e..baa68b4bd86 100644 --- a/caffe2/core/workspace.h +++ b/caffe2/core/workspace.h @@ -37,7 +37,7 @@ struct StopOnSignal { StopOnSignal(const StopOnSignal& other) : handler_(other.handler_) {} - bool operator()(int iter) { + bool operator()(int /*iter*/) { return handler_->CheckForSignals() != SignalHandler::Action::STOP; } diff --git a/caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc b/caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc index 4d11218560b..6b3b62d770f 100644 --- a/caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc +++ b/caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc @@ -11,7 +11,9 @@ class ElementwiseRTCFunction ElementwiseRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {} template - string KernelName(Args... args) { return name_; } + string KernelName(Args... /*args*/) { + return name_; + } template string GetSource(Args... args); diff --git a/caffe2/cuda_rtc/pool_op_rtc_gpu.cc b/caffe2/cuda_rtc/pool_op_rtc_gpu.cc index 542b891155d..4dc8d598044 100644 --- a/caffe2/cuda_rtc/pool_op_rtc_gpu.cc +++ b/caffe2/cuda_rtc/pool_op_rtc_gpu.cc @@ -104,7 +104,9 @@ class MaxPoolRTCFunction : public CudaRTCFunction { MaxPoolRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {} template - string KernelName(Args... args) { return name_; } + string KernelName(Args... /*args*/) { + return name_; + } template string GetSource(Args... args); @@ -119,7 +121,9 @@ class MaxPoolGradientRTCFunction MaxPoolGradientRTCFunction() : CudaRTCFunction(), name_(GetUniqueName()) {} template - string KernelName(Args... args) { return name_; } + string KernelName(Args... /*args*/) { + return name_; + } template string GetSource(Args... args); diff --git a/caffe2/db/protodb.cc b/caffe2/db/protodb.cc index 03df308d769..64d5e952f2e 100644 --- a/caffe2/db/protodb.cc +++ b/caffe2/db/protodb.cc @@ -13,7 +13,7 @@ class ProtoDBCursor : public Cursor { : proto_(proto), iter_(0) {} ~ProtoDBCursor() {} - void Seek(const string& str) override { + void Seek(const string& /*str*/) override { CAFFE_THROW("ProtoDB is not designed to support seeking."); } diff --git a/caffe2/db/zmqdb.cc b/caffe2/db/zmqdb.cc index e55fdf11aa0..e5947eb6175 100644 --- a/caffe2/db/zmqdb.cc +++ b/caffe2/db/zmqdb.cc @@ -32,7 +32,8 @@ class ZmqDBCursor : public Cursor { socket_.Disconnect(source_); } - void Seek(const string& key) override { /* do nothing */ } + void Seek(const string& /*key*/) override { /* do nothing */ + } void SeekToFirst() override { /* do nothing */ } diff --git a/caffe2/experiments/operators/fully_connected_op_prune.h b/caffe2/experiments/operators/fully_connected_op_prune.h index aa3e3eb7dea..bbc13bd96db 100644 --- a/caffe2/experiments/operators/fully_connected_op_prune.h +++ b/caffe2/experiments/operators/fully_connected_op_prune.h @@ -66,8 +66,8 @@ namespace caffe2 { void MaskMatrix_Inc( float* mask_seq, float* mat, - int M, - int N, + int /*M*/, + int /*N*/, int seq_len, float target) { for (int i = 0; i < seq_len; ++i) { diff --git a/caffe2/experiments/operators/fully_connected_op_sparse.h b/caffe2/experiments/operators/fully_connected_op_sparse.h index 21619e4e49c..3025298eace 100644 --- a/caffe2/experiments/operators/fully_connected_op_sparse.h +++ b/caffe2/experiments/operators/fully_connected_op_sparse.h @@ -40,9 +40,13 @@ void Sparse_mm(const T* acsr, const int* ia, const int* ja, template void trans_mat(const T* o, T* t, int m, int n, Context* context); -template<> -void trans_mat(const float* o, float* t, - int m, int n, CPUContext* context){ +template <> +void trans_mat( + const float* o, + float* t, + int m, + int n, + CPUContext* /*context*/) { for(int i = 0; i < m; ++i){ for(int j = 0; j < n; ++j){ t[j*m+i]=o[i*n+j]; @@ -53,9 +57,16 @@ void trans_mat(const float* o, float* t, // C = A(sparse) * B // No transpose; template <> -void Sparse_mm(const float* acsr, - const int* ia, const int* ja, int m, int k, - int n, const float* b, float* c, CPUContext* context){ +void Sparse_mm( + const float* acsr, + const int* ia, + const int* ja, + int m, + int k, + int n, + const float* b, + float* c, + CPUContext* /*context*/) { float alpha = 1.0, beta = 0.; mkl_scsrmm("N", &m, &n, &k, &alpha, "GLNC", acsr, ja, ia, ia+1, b, &n, &beta, c, &n); diff --git a/caffe2/operators/conv_pool_op_base.h b/caffe2/operators/conv_pool_op_base.h index 7db69905c96..2e43b3e61f0 100644 --- a/caffe2/operators/conv_pool_op_base.h +++ b/caffe2/operators/conv_pool_op_base.h @@ -260,11 +260,11 @@ class ConvPoolOpBase : public Operator { // kernel parameters and output output_dims and channel_first. static inline void InferOutputSize( vector input_dims, - int output_channel, + int /*output_channel*/, StorageOrder order, bool global_pooling, LegacyPadding legacy_pad, - int N, + int /*N*/, vector& kernel, vector& output_dims, vector dilation, diff --git a/caffe2/operators/conv_transpose_op_impl.h b/caffe2/operators/conv_transpose_op_impl.h index e4516758626..18f8b45d9cb 100644 --- a/caffe2/operators/conv_transpose_op_impl.h +++ b/caffe2/operators/conv_transpose_op_impl.h @@ -168,7 +168,7 @@ bool ConvTransposeOp::RunOnDeviceWithOrderNHWC() { const T* Xdata = X.template data(); T* Ydata = Y->template mutable_data(); - auto f = [&](Tensor* col_buffer) { + auto f = [&](Tensor* /*col_buffer*/) { col_buffer_.Resize(vector{H, W, kernel_h_, kernel_w_, C}); T* col_buffer_data = col_buffer_.template mutable_data(); for (auto image_id = 0; image_id < N; ++image_id) { diff --git a/caffe2/operators/elementwise_op.h b/caffe2/operators/elementwise_op.h index 97531cabbc5..2fd5595d78e 100644 --- a/caffe2/operators/elementwise_op.h +++ b/caffe2/operators/elementwise_op.h @@ -65,7 +65,7 @@ class UnaryElementwiseWithArgsOp : public Operator { */ template struct WithDefaultConstructor { - explicit WithDefaultConstructor(OperatorBase& op) {} + explicit WithDefaultConstructor(OperatorBase& /*op*/) {} template void operator()(int n, const In* in, Out* out, Context* c) { @@ -225,22 +225,22 @@ struct WithoutBroadcast { } template inline void RunWithBroadcast( - const T* a, - const T* b, - R* out, - size_t pre, - size_t n, + const T* /*a*/, + const T* /*b*/, + R* /*out*/, + size_t /*pre*/, + size_t /*n*/, Context*) { CAFFE_NOT_IMPLEMENTED; } template inline void RunWithBroadcast2( - const T* a, - const T* b, - R* out, - size_t pre, - size_t n, - size_t post, + const T* /*a*/, + const T* /*b*/, + R* /*out*/, + size_t /*pre*/, + size_t /*n*/, + size_t /*post*/, Context*) { CAFFE_NOT_IMPLEMENTED; } diff --git a/caffe2/operators/lstm_unit_op.h b/caffe2/operators/lstm_unit_op.h index 176875f011d..964d263320e 100644 --- a/caffe2/operators/lstm_unit_op.h +++ b/caffe2/operators/lstm_unit_op.h @@ -29,7 +29,7 @@ void LSTMUnit( T* C, T* H, const T forget_bias, - Context* context) { + Context* /*context*/) { for (int n = 0; n < N; ++n) { const bool valid = t < seqLengths[n]; @@ -79,7 +79,7 @@ void LSTMUnitGradient( T* C_prev_diff, T* X_diff, const T forget_bias, - Context* context) { + Context* /*context*/) { for (int n = 0; n < N; ++n) { const bool valid = t < seqLengths[n]; diff --git a/caffe2/operators/matmul_op.cc b/caffe2/operators/matmul_op.cc index c7390dcec6d..d12ad3707a8 100644 --- a/caffe2/operators/matmul_op.cc +++ b/caffe2/operators/matmul_op.cc @@ -8,19 +8,19 @@ REGISTER_CPU_OPERATOR(MatMul, MatMulOp); OPERATOR_SCHEMA(MatMul) .NumInputs(2) .NumOutputs(1) - .TensorInferenceFunction( - [](const OperatorDef& def, const vector& in) { - vector out(1); - out[0].set_data_type(in[0].data_type()); + .TensorInferenceFunction([](const OperatorDef& /*def*/, + const vector& in) { + vector out(1); + out[0].set_data_type(in[0].data_type()); - int M = in[0].dims().Get(0); - int N = in[1].dims().Get(1); + int M = in[0].dims().Get(0); + int N = in[1].dims().Get(1); - out[0].add_dims(M); - out[0].add_dims(N); + out[0].add_dims(M); + out[0].add_dims(N); - return out; - }) + return out; + }) .SetDoc(R"DOC( Matrix multiplication Y = A * B, where A has size (M x K), B has size (K x N), and Y will have a size (M x N). diff --git a/caffe2/operators/negative_op.cc b/caffe2/operators/negative_op.cc index ab52344e9b9..d169d7976ba 100644 --- a/caffe2/operators/negative_op.cc +++ b/caffe2/operators/negative_op.cc @@ -4,8 +4,8 @@ namespace caffe2 { struct NegativeCPUFunctor { template - inline void operator()(const int n, const T* x, - T* y, CPUContext* device_context) { + inline void + operator()(const int n, const T* x, T* y, CPUContext* /*device_context*/) { EigenVectorMap(y, n) = -ConstEigenVectorMap(x, n); // for (int i = 0; i < n; ++i) { // y[i] = -x[i]; diff --git a/caffe2/operators/order_switch_ops.cc b/caffe2/operators/order_switch_ops.cc index 74a205e9dd3..b37880d0b76 100644 --- a/caffe2/operators/order_switch_ops.cc +++ b/caffe2/operators/order_switch_ops.cc @@ -52,15 +52,15 @@ REGISTER_CPU_OPERATOR(NCHW2NHWC, NCHW2NHWCOp); OPERATOR_SCHEMA(NHWC2NCHW) .NumInputs(1) .NumOutputs(1) - .TensorInferenceFunction( - [](const OperatorDef& /*unused*/ def, const vector& in) { - vector out(1); - out[0].add_dims(in[0].dims(0)); - out[0].add_dims(in[0].dims(3)); - out[0].add_dims(in[0].dims(1)); - out[0].add_dims(in[0].dims(2)); - return out; - }) + .TensorInferenceFunction([](const OperatorDef& /*unused*/ /*def*/, + const vector& in) { + vector out(1); + out[0].add_dims(in[0].dims(0)); + out[0].add_dims(in[0].dims(3)); + out[0].add_dims(in[0].dims(1)); + out[0].add_dims(in[0].dims(2)); + return out; + }) .SetDoc(R"DOC( The operator switches the order of data in a tensor from NHWC- sample index N, height H, width H and channels C, to the NCHW order. diff --git a/caffe2/operators/pool_op.cc b/caffe2/operators/pool_op.cc index e9066a36faf..12f240e022d 100644 --- a/caffe2/operators/pool_op.cc +++ b/caffe2/operators/pool_op.cc @@ -336,24 +336,24 @@ class AveragePool { } static bool runSpecialized( - int N, - int C, - int inputH, - int inputW, - int outputH, - int outputW, - int kH, - int kW, - int strideH, - int strideW, - int padT, - int padL, - int padB, - int padR, - int dilationH, - int dilationW, - const float* input, - float* output) { + int /*N*/, + int /*C*/, + int /*inputH*/, + int /*inputW*/, + int /*outputH*/, + int /*outputW*/, + int /*kH*/, + int /*kW*/, + int /*strideH*/, + int /*strideW*/, + int /*padT*/, + int /*padL*/, + int /*padB*/, + int /*padR*/, + int /*dilationH*/, + int /*dilationW*/, + const float* /*input*/, + float* /*output*/) { #ifdef __ARM_NEON__ if (isNeon4x4p0s0Eligible( inputH, @@ -405,28 +405,28 @@ class MaxPool { static void finalize( const int /*size*/, - const int col, + const int /*col*/, EigenMatrixMap& /*y_mat*/) {} static bool runSpecialized( - int N, - int C, - int inputH, - int inputW, - int outputH, - int outputW, - int kH, - int kW, - int strideH, - int strideW, - int padT, - int padL, - int padB, - int padR, - int dilationH, - int dilationW, - const float* input, - float* output) { + int /*N*/, + int /*C*/, + int /*inputH*/, + int /*inputW*/, + int /*outputH*/, + int /*outputW*/, + int /*kH*/, + int /*kW*/, + int /*strideH*/, + int /*strideW*/, + int /*padT*/, + int /*padL*/, + int /*padB*/, + int /*padR*/, + int /*dilationH*/, + int /*dilationW*/, + const float* /*input*/, + float* /*output*/) { #ifdef __ARM_NEON__ if (isNeon2x2p0s0Eligible( inputH, diff --git a/caffe2/operators/prefetch_op.h b/caffe2/operators/prefetch_op.h index c81af17cbd0..e760b075a16 100644 --- a/caffe2/operators/prefetch_op.h +++ b/caffe2/operators/prefetch_op.h @@ -60,7 +60,7 @@ class PrefetchOperator : public OperatorBase { } } - bool Run(int /* unused */ stream_id) override { + bool Run(int /* unused */ /*stream_id*/) override { // Note(jiayq): We only start the prefetch_thread at the Run() function // instead of in the constructor, because the prefetch_thread needs to start // after all derived classes' constructors finish. diff --git a/caffe2/operators/recurrent_network_op.h b/caffe2/operators/recurrent_network_op.h index 96e70849e21..55328e55b59 100644 --- a/caffe2/operators/recurrent_network_op.h +++ b/caffe2/operators/recurrent_network_op.h @@ -57,7 +57,10 @@ inline void UpdateTimestepBlob(Workspace* ws, std::string blob_name, int t) { } template -void applyOffsetAlias(const OffsetAlias& oc, Workspace* ws, Context* context) { +void applyOffsetAlias( + const OffsetAlias& oc, + Workspace* ws, + Context* /*context*/) { VLOG(1) << "Aliasing: " << oc.src << " to: " << oc.dst << " at offset: " << oc.offset; auto srcBlob = ws->GetBlob(oc.src); diff --git a/caffe2/operators/reducer_functors.h b/caffe2/operators/reducer_functors.h index 3a1643b78f0..3220a895d5c 100644 --- a/caffe2/operators/reducer_functors.h +++ b/caffe2/operators/reducer_functors.h @@ -27,7 +27,7 @@ class SumRangeReducer { const TIndex blocks, const T* in, T* out, - CPUContext* context) { + CPUContext* /*context*/) { // do we need to go through wrapper in math.h? EigenVectorMap out_vec(out, block_size); out_vec = ConstEigenMatrixMap(in, block_size, blocks).rowwise().sum(); @@ -42,8 +42,8 @@ class SumRangeReducerGradient { const TIndex blocks, const T* segment_grad, T* data_grad, - const T* data_in, // unused - const T* data_out, // unused + const T* /*data_in*/, // unused + const T* /*data_out*/, // unused Context* context) { // do we have some op that does it smartly with minimum number of memcpy? for (TIndex i = 0; i < blocks; ++i) { @@ -78,7 +78,7 @@ class LogSumExpRangeReducer { const TIndex blocks, const T* in, T* out, - CPUContext* context) { + CPUContext* /*context*/) { for (int j = 0; j < block_size; ++j) { T max_value = std::numeric_limits::lowest(); for (int i = 0; i < blocks; ++i) { @@ -104,7 +104,7 @@ class LogSumExpRangeReducerGradient { T* data_grad, // GI const T* data_in, // I const T* data_out, // O - Context* context) { + Context* /*context*/) { for (int j = 0; j < block_size; ++j) { const T out_grad = *(segment_grad++); const T offset = *(data_out++); @@ -140,7 +140,7 @@ class LogMeanExpRangeReducer { const TIndex blocks, const T* in, T* out, - CPUContext* context) { + CPUContext* /*context*/) { for (int j = 0; j < block_size; ++j) { T max_value = std::numeric_limits::lowest(); for (int i = 0; i < blocks; ++i) { @@ -166,7 +166,7 @@ class LogMeanExpRangeReducerGradient { T* data_grad, // GI const T* data_in, // I const T* data_out, // O - Context* context) { + Context* /*context*/) { for (int j = 0; j < block_size; ++j) { const T out_grad = *(segment_grad++); const T offset = *(data_out++); @@ -202,7 +202,7 @@ class MeanRangeReducer { const TIndex blocks, const T* in, T* out, - CPUContext* context) { + CPUContext* /*context*/) { for (int j = 0; j < block_size; ++j) { T avg_value = 0; for (int i = 0; i < blocks; ++i) { @@ -221,9 +221,9 @@ class MeanRangeReducerGradient { const TIndex blocks, const T* segment_grad, // GO T* data_grad, // GI - const T* data_in, // I - const T* data_out, // O - Context* context) { + const T* /*data_in*/, // I + const T* /*data_out*/, // O + Context* /*context*/) { const auto in_grad = 1.0 / blocks; for (int j = 0; j < block_size; ++j) { const T out_grad = *(segment_grad++); @@ -261,7 +261,7 @@ class MaxRangeReducer { const TIndex blocks, const T* in, T* out, - CPUContext* context) { + CPUContext* /*context*/) { for (int j = 0; j < block_size; ++j) { T max_value = std::numeric_limits::lowest(); for (int i = 0; i < blocks; ++i) { @@ -282,7 +282,7 @@ class MaxRangeReducerGradient { T* data_grad, // GI const T* data_in, // I const T* data_out, // O - Context* context) { + Context* /*context*/) { std::memset( static_cast(data_grad), 0, blocks * block_size * sizeof(T)); for (int j = 0; j < block_size; ++j) { @@ -349,7 +349,7 @@ class BaseReducer { }; template - void finish(const Meta& meta, CPUContext* context) {} + void finish(const Meta& /*meta*/, CPUContext* /*context*/) {} }; class BaseReducerGradient { @@ -363,11 +363,11 @@ class BaseReducerGradient { return false; } - static int numAuxInputsWithGrads(const OperatorDef& def) { + static int numAuxInputsWithGrads(const OperatorDef& /*def*/) { return 0; } - static bool requiresDataInput(const OperatorDef& def) { + static bool requiresDataInput(const OperatorDef& /*def*/) { return false; } @@ -390,10 +390,10 @@ class BaseReducerGradient { } void observeOriginalInput( - int original_input, - const Tensor& value, - Tensor* input_grad, // optional grad to populate - int skip_dims) {} + int /*original_input*/, + const Tensor& /*value*/, + Tensor* /*input_grad*/, // optional grad to populate + int /*skip_dims*/) {} void appendGradShape(vector* output_shape) { output_shape->insert( @@ -413,7 +413,7 @@ class SumReducer : public BaseReducer { public: using FixedDispatch = FixedValues<1>; - SumReducer(const Meta& meta, T* out, CPUContext* context) + SumReducer(const Meta& meta, T* out, CPUContext* /*context*/) : current_size_(0), out_(out) { // add a wrapper in Context for it if (meta.first_dim) { @@ -421,8 +421,11 @@ class SumReducer : public BaseReducer { } } template - void - process(const Meta& meta, const T* in, TIndex offset, CPUContext* context) { + void process( + const Meta& meta, + const T* in, + TIndex /*offset*/, + CPUContext* context) { if (meta.first_dim) { math::AxpyFixedSize( meta.block_size, 1, in, out_, context); @@ -442,7 +445,10 @@ class SumReducerGradient : public BaseReducerGradient { public: using FixedDispatch = FixedValues<1>; - SumReducerGradient(const Meta& meta, const T* s_grad, CPUContext* context) + SumReducerGradient( + const Meta& /*meta*/, + const T* s_grad, + CPUContext* /*context*/) : s_grad_(s_grad) {} template @@ -475,7 +481,7 @@ struct SumReducerDef { static constexpr const char* doc = "Summation is done element-wise across slices of the input tensor and " "doesn't change the shape of the individual blocks."; - static void PopulateSchema(OpSchema& schema) {} + static void PopulateSchema(OpSchema& /*schema*/) {} }; // Put forward and backward in the same template? @@ -510,7 +516,7 @@ class WeightedSumReducer : public BaseReducer { } }; - WeightedSumReducer(const Meta& meta, T* out, CPUContext* context) + WeightedSumReducer(const Meta& meta, T* out, CPUContext* /*context*/) : out_(out) { // do we have a wrapper for it? memset(out, 0, sizeof(T) * meta.block_size); @@ -558,7 +564,7 @@ class WeightedSumReducerGradient : public BaseReducerGradient { int original_input, const Tensor& value, Tensor* input_grad, // optional grad to populate - int skip_dims) { + int /*skip_dims*/) { CAFFE_ENFORCE_EQ(1, original_input); scalars = value.data(); if (input_grad) { @@ -569,9 +575,9 @@ class WeightedSumReducerGradient : public BaseReducerGradient { }; WeightedSumReducerGradient( - const Meta& meta, + const Meta& /*meta*/, const T* s_grad, - CPUContext* context) + CPUContext* /*context*/) : s_grad_(s_grad) {} template @@ -580,7 +586,7 @@ class WeightedSumReducerGradient : public BaseReducerGradient { T* data_grad, TIndex offset, Context* context, - const int length) { + const int /*length*/) { math::ScaleFixedSize( meta.block_size, meta.scalars[offset], s_grad_, data_grad, context); } @@ -594,7 +600,7 @@ class WeightedSumReducerGradient : public BaseReducerGradient { T* data_grad, TIndex offset, Context* context, - const int length) { + const int /*length*/) { math::ScaleFixedSize( meta.block_size, meta.scalars[offset], s_grad_, data_grad, context); math::Dot( @@ -638,7 +644,7 @@ class MeanReducer : public BaseReducer { public: using FixedDispatch = FixedValues<1>; - MeanReducer(const Meta& meta, T* out, CPUContext* context) + MeanReducer(const Meta& meta, T* out, CPUContext* /*context*/) : out_(out), current_size_(0) { if (meta.first_dim) { memset(out, 0, sizeof(T) * meta.block_size); @@ -646,8 +652,11 @@ class MeanReducer : public BaseReducer { } template - void - process(const Meta& meta, const T* in, TIndex offset, CPUContext* context) { + void process( + const Meta& meta, + const T* in, + TIndex /*offset*/, + CPUContext* context) { if (meta.first_dim) { math::AxpyFixedSize( meta.block_size, 1, in, out_, context); @@ -685,7 +694,10 @@ class MeanReducerGradient : public BaseReducerGradient { using FixedDispatch = FixedValues<1>; - MeanReducerGradient(const Meta& meta, const T* s_grad, CPUContext* context) + MeanReducerGradient( + const Meta& /*meta*/, + const T* s_grad, + CPUContext* /*context*/) : s_grad_(s_grad) {} template @@ -718,7 +730,7 @@ struct MeanReducerDef { static constexpr const char* doc = "Mean computes the element-wise mean of the input slices. " "Operation doesn't change the shape of the individual blocks."; - static void PopulateSchema(OpSchema& schema) {} + static void PopulateSchema(OpSchema& /*schema*/) {} }; } // namespace caffe2 diff --git a/caffe2/operators/sigmoid_op.cc b/caffe2/operators/sigmoid_op.cc index 2734f003f96..e410ded122b 100644 --- a/caffe2/operators/sigmoid_op.cc +++ b/caffe2/operators/sigmoid_op.cc @@ -5,8 +5,8 @@ namespace caffe2 { struct SigmoidCPUFunctor { template - inline void operator()(const int n, const T* x, - T* y, CPUContext* device_context) { + inline void + operator()(const int n, const T* x, T* y, CPUContext* /*device_context*/) { ConstEigenVectorArrayMap xM(x, n); EigenVectorArrayMap(y, n) = 1. / (1. + (-xM).exp()); } @@ -14,8 +14,12 @@ struct SigmoidCPUFunctor { struct SigmoidGradientCPUFunctor { template - inline void - Run(const int n, const T* y, const T* dy, T* dx, CPUContext* device_context) { + inline void Run( + const int n, + const T* y, + const T* dy, + T* dx, + CPUContext* /*device_context*/) { ConstEigenVectorArrayMap yM(y, n), dyM(dy, n); EigenVectorArrayMap(dx, n) = dyM * yM * (1. - yM); } diff --git a/caffe2/operators/softsign_op.cc b/caffe2/operators/softsign_op.cc index 1f0adb2c7d0..908a5e990af 100644 --- a/caffe2/operators/softsign_op.cc +++ b/caffe2/operators/softsign_op.cc @@ -6,7 +6,7 @@ namespace caffe2 { struct SoftsignCPUFunctor { template inline void - operator()(const int n, const T* x, T* y, CPUContext* device_context) { + operator()(const int n, const T* x, T* y, CPUContext* /*device_context*/) { ConstEigenVectorArrayMap x_arr(x, n); EigenVectorMap(y, n) = (1 + x_arr.abs()).inverse() * x_arr; } @@ -14,8 +14,12 @@ struct SoftsignCPUFunctor { struct SoftsignGradientCPUFunctor { template - inline void - Run(const int n, const T* x, const T* dy, T* dx, CPUContext* device_context) { + inline void Run( + const int n, + const T* x, + const T* dy, + T* dx, + CPUContext* /*device_context*/) { ConstEigenVectorArrayMap dy_arr(dy, n); ConstEigenVectorArrayMap x_arr(x, n); EigenVectorMap(dx, n) = dy_arr * (1 + x_arr.abs()).pow(2).inverse(); diff --git a/caffe2/operators/space_batch_op.h b/caffe2/operators/space_batch_op.h index 3cc5385d56a..4f42dc0e948 100644 --- a/caffe2/operators/space_batch_op.h +++ b/caffe2/operators/space_batch_op.h @@ -15,7 +15,7 @@ void spaceToBatch( int pad_l, int block_size, Tensor* output, - Context* context) { + Context* /*context*/) { CAFFE_ENFORCE(input.ndim() == 4); CAFFE_ENFORCE(output->ndim() == 4); @@ -65,7 +65,7 @@ void batchToSpace( int pad_l, int block_size, Tensor* output, - Context* context) { + Context* /*context*/) { CAFFE_ENFORCE(input.ndim() == 4); CAFFE_ENFORCE(output->ndim() == 4); diff --git a/caffe2/operators/string_ops.h b/caffe2/operators/string_ops.h index 1e0f6fd209d..2308a805631 100644 --- a/caffe2/operators/string_ops.h +++ b/caffe2/operators/string_ops.h @@ -19,7 +19,7 @@ struct ForEach { explicit ForEach(OperatorBase& op) : functor(op) {} template - void operator()(int n, const In* in, Out* out, Context* c) { + void operator()(int n, const In* in, Out* out, Context* /*c*/) { for (int i = 0; i < n; ++i) { out[i] = functor(in[i]); } diff --git a/caffe2/operators/tanh_op.cc b/caffe2/operators/tanh_op.cc index 17fa249692d..8da838c2166 100644 --- a/caffe2/operators/tanh_op.cc +++ b/caffe2/operators/tanh_op.cc @@ -7,8 +7,8 @@ namespace caffe2 { struct TanhCPUFunctor { template - inline void operator()(const int n, const T* x, - T* y, CPUContext* device_context) { + inline void + operator()(const int n, const T* x, T* y, CPUContext* /*device_context*/) { #ifdef CAFFE2_USE_ACCELERATE vvtanhf(y, x, &n); #else @@ -20,8 +20,12 @@ struct TanhCPUFunctor { struct TanhGradientCPUFunctor { template - inline void - Run(const int n, const T* y, const T* dy, T* dx, CPUContext* device_context) { + inline void Run( + const int n, + const T* y, + const T* dy, + T* dx, + CPUContext* /*device_context*/) { ConstEigenVectorArrayMap dy_arr(dy, n); ConstEigenVectorArrayMap y_arr(y, n); EigenVectorMap(dx, n) = dy_arr * (1 - y_arr * y_arr); diff --git a/caffe2/operators/utility_ops.cc b/caffe2/operators/utility_ops.cc index aee32546c17..75757387b5c 100644 --- a/caffe2/operators/utility_ops.cc +++ b/caffe2/operators/utility_ops.cc @@ -158,17 +158,17 @@ unchanged. OPERATOR_SCHEMA(FlattenToVec) .NumInputs(1) .NumOutputs(1) - .TensorInferenceFunction( - [](const OperatorDef& def, const vector& in) { - vector out(1); - int total = 1; - for (auto d : in[0].dims()) { - total *= d; - } - out[0].set_data_type(in[0].data_type()); - out[0].add_dims(total); - return out; - }) + .TensorInferenceFunction([](const OperatorDef& /*def*/, + const vector& in) { + vector out(1); + int total = 1; + for (auto d : in[0].dims()) { + total *= d; + } + out[0].set_data_type(in[0].data_type()); + out[0].add_dims(total); + return out; + }) .SetDoc(R"DOC( Flattens the input tensor into a 1D vector. )DOC") @@ -201,13 +201,13 @@ similar to multi-thread computation before you use it explicitly. OPERATOR_SCHEMA(ResizeLike) .NumInputs(2) .NumOutputs(1) - .TensorInferenceFunction( - [](const OperatorDef& def, const vector& in) { - vector out(1); - out.push_back(in[1]); - out[0].set_data_type(in[0].data_type()); - return out; - }) + .TensorInferenceFunction([](const OperatorDef& /*def*/, + const vector& in) { + vector out(1); + out.push_back(in[1]); + out[0].set_data_type(in[0].data_type()); + return out; + }) .SetDoc(R"DOC( Produces tensor containing data of first input and shape of second input. )DOC") @@ -219,7 +219,7 @@ OPERATOR_SCHEMA(SumInt) .NumInputs(1, INT_MAX) .NumOutputs(1) .InputsCanCrossDevices() - .TensorInferenceFunction([](const OperatorDef& def, + .TensorInferenceFunction([](const OperatorDef& /*def*/, const vector& in) { vector out(1); out.push_back(in[0]); @@ -436,13 +436,13 @@ OPERATOR_SCHEMA(CopyOnDeviceLike) OPERATOR_SCHEMA(Shape) .NumInputs(1) .NumOutputs(1) - .TensorInferenceFunction( - [](const OperatorDef& def, const vector& in) { - vector out(1); - out[0].add_dims(in[0].dims().size()); - out[0].set_data_type(TensorProto::INT32); - return out; - }) + .TensorInferenceFunction([](const OperatorDef& /*def*/, + const vector& in) { + vector out(1); + out[0].add_dims(in[0].dims().size()); + out[0].set_data_type(TensorProto::INT32); + return out; + }) .SetDoc("Produce a 1D int64 tensor with the shape of the input tensor."); OPERATOR_SCHEMA(HasElements) diff --git a/caffe2/operators/utility_ops.h b/caffe2/operators/utility_ops.h index 2fe8055261a..d3406dc8c8e 100644 --- a/caffe2/operators/utility_ops.h +++ b/caffe2/operators/utility_ops.h @@ -825,11 +825,11 @@ class LengthsToWeightsOp : public Operator { std::function getWeight; if (power_ == 0.5) { - getWeight = [](const int64_t& length, const float& power) { + getWeight = [](const int64_t& length, const float& /*power*/) { return 1.0 / std::sqrt(length); }; } else if (power_ == 1) { - getWeight = [](const int64_t& length, const float& power) { + getWeight = [](const int64_t& length, const float& /*power*/) { return 1.0 / length; }; } else { diff --git a/caffe2/queue/rebatching_queue.cc b/caffe2/queue/rebatching_queue.cc index 07a5d1536f4..3389cfe6308 100644 --- a/caffe2/queue/rebatching_queue.cc +++ b/caffe2/queue/rebatching_queue.cc @@ -156,7 +156,7 @@ bool RebatchingQueue::canWrite() const { } bool RebatchingQueue::enqueueOne( - CPUContext& context, + CPUContext& /*context*/, const std::vector& inputs) { std::vector> splittedInputs; splittedInputs.emplace_back(); diff --git a/caffe2/sgd/adagrad_op.h b/caffe2/sgd/adagrad_op.h index 25a7280fdd0..c2cb71a475a 100644 --- a/caffe2/sgd/adagrad_op.h +++ b/caffe2/sgd/adagrad_op.h @@ -13,8 +13,8 @@ void adagrad_update( float* nw, float* nh, float epsilon, - const float *lr, - Context* context) { + const float* lr, + Context* /*context*/) { for (auto i = 0; i < N; ++i) { float gi = g[i]; float hi = nh[i] = h[i] + gi * gi; diff --git a/caffe2/sgd/adam_op.h b/caffe2/sgd/adam_op.h index 2dc1d54307a..22e46c61a67 100644 --- a/caffe2/sgd/adam_op.h +++ b/caffe2/sgd/adam_op.h @@ -18,7 +18,7 @@ void adam_update( float eps_hat, float correction, const float* lr, - Context* context) { + Context* /*context*/) { for (auto i = 0; i < N; ++i) { float gi = g[i]; float mi = nm[i] = m[i] * beta1 + gi * (1 - beta1); @@ -42,7 +42,7 @@ void adam_compute( float eps_hat, float correction, const float* lr, - Context* context) { + Context* /*context*/) { for (auto i = 0; i < N; ++i) { float gi = g[i]; float mi = nm[i] = m[i] * beta1 + gi * (1 - beta1); diff --git a/caffe2/sgd/ftrl_op.cc b/caffe2/sgd/ftrl_op.cc index 677ebae6e15..26340611467 100644 --- a/caffe2/sgd/ftrl_op.cc +++ b/caffe2/sgd/ftrl_op.cc @@ -40,7 +40,7 @@ void ftrl_update( T* new_w, T* new_nz, const FtrlParams& params, - Context* context) { + Context* /*context*/) { // TODO(cxj): use OMP when it is reliable // #pragma omp parallel for for (auto i = 0; i < N; ++i) { diff --git a/caffe2/sgd/learning_rate_functors.h b/caffe2/sgd/learning_rate_functors.h index 5957dcad208..db004803430 100644 --- a/caffe2/sgd/learning_rate_functors.h +++ b/caffe2/sgd/learning_rate_functors.h @@ -19,7 +19,7 @@ class LearningRateFunctor { template class FixedLearningRate : public LearningRateFunctor { public: - T operator()(const int64_t iter) const override { + T operator()(const int64_t /*iter*/) const override { return 1.; } }; diff --git a/caffe2/sgd/momentum_sgd_op.h b/caffe2/sgd/momentum_sgd_op.h index 9c664448593..28ec7df2503 100644 --- a/caffe2/sgd/momentum_sgd_op.h +++ b/caffe2/sgd/momentum_sgd_op.h @@ -15,7 +15,7 @@ void momentum_sgd_update( float momentum, bool nesterov, float* param, - Context* context) { + Context* /*context*/) { const float LR = lr[0]; for (auto i = 0; i < N; ++i) { if (!nesterov) { diff --git a/caffe2/sgd/rmsprop_op.cc b/caffe2/sgd/rmsprop_op.cc index eb8f0531dca..2b15d981ff2 100644 --- a/caffe2/sgd/rmsprop_op.cc +++ b/caffe2/sgd/rmsprop_op.cc @@ -15,7 +15,7 @@ void rmsprop_update( float momentum, float epsilon, const float* lr, - CPUContext* context) { + CPUContext* /*context*/) { ConstEigenVectorArrayMap gVec(g, N); ConstEigenVectorArrayMap msVec(ms, N); ConstEigenVectorArrayMap momVec(mom, N); diff --git a/caffe2/utils/math-detail.h b/caffe2/utils/math-detail.h index 07a1f997d66..5630729d1a5 100644 --- a/caffe2/utils/math-detail.h +++ b/caffe2/utils/math-detail.h @@ -29,7 +29,7 @@ struct ScaleImpl { const float alpha, const T* x, T* y, - CPUContext* context) { + CPUContext* /*context*/) { DCHECK_EQ(N, 1); *y = *x * alpha; } @@ -55,7 +55,7 @@ struct AxpyImpl { const float alpha, const T* x, T* y, - CPUContext* context) { + CPUContext* /*context*/) { DCHECK_EQ(N, 1); *y += *x * alpha; } diff --git a/caffe2/utils/math_cpu.cc b/caffe2/utils/math_cpu.cc index 6c014287064..91b3583a358 100644 --- a/caffe2/utils/math_cpu.cc +++ b/caffe2/utils/math_cpu.cc @@ -281,8 +281,8 @@ void Gemm( const float* B, const float beta, float* C, - CPUContext* context, - TensorProto::DataType math_type) { + CPUContext* /*context*/, + TensorProto::DataType /*math_type*/) { int lda = (TransA == CblasNoTrans) ? K : M; int ldb = (TransB == CblasNoTrans) ? N : K; cblas_sgemm(CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, @@ -304,7 +304,7 @@ void GemmEx( const float beta, float* C, const int ldc, - CPUContext* context) { + CPUContext* /*context*/) { cblas_sgemm(CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); } @@ -319,8 +319,8 @@ void Gemv( const float* x, const float beta, float* y, - CPUContext* context, - TensorProto::DataType math_type) { + CPUContext* /*context*/, + TensorProto::DataType /*math_type*/) { cblas_sgemv(CblasRowMajor, TransA, M, N, alpha, A, N, x, 1, beta, y, 1); } @@ -665,7 +665,7 @@ void Not( const int n, const bool* x, bool* y, - CPUContext* context) { + CPUContext* /*context*/) { for (int i = 0; i < n; ++i) { y[i] = !x[i]; } @@ -775,15 +775,19 @@ void SumSqr( const int N, const float* x, float* y, - CPUContext* context /* unused */, - Tensor* scratch_ptr /* unused */) { + CPUContext* /*context*/ /* unused */, + Tensor* /*scratch_ptr*/ /* unused */) { *y = ConstEigenVectorMap(x, N).squaredNorm(); } template <> void Select( - const int N, const int D, const float* x, const int* idx, float* y, - CPUContext* context) { + const int N, + const int D, + const float* x, + const int* idx, + float* y, + CPUContext* /*context*/) { for (int i = 0; i < N; ++i) { DCHECK_LT(idx[i], D); y[i] = x[i * D + idx[i]]; @@ -912,7 +916,7 @@ void Im2col( const int stride_h, const int stride_w, float* data_col, - CPUContext* context) { + CPUContext* /*context*/) { const int output_h = (height + pad_b + pad_t - (dilation_h * (kernel_h - 1) + 1)) / stride_h + 1; @@ -1030,7 +1034,7 @@ void Im2col( const int stride_h, const int stride_w, float* data_col, - CPUContext* context) { + CPUContext* /*context*/) { const int dkernel_h = dilation_h * (kernel_h - 1) + 1; const int dkernel_w = dilation_w * (kernel_w - 1) + 1; @@ -1221,11 +1225,11 @@ void Col2im( template <> void BiasCHW( - const float* bias, - const int bias_channels, - const int image_size, - float* image, - CPUContext* context) { + const float* bias, + const int bias_channels, + const int image_size, + float* image, + CPUContext* /*context*/) { // Sum the per-channel bias into every image plane for (int c = 0; c < bias_channels; ++c) { float b = bias[c]; @@ -1305,8 +1309,14 @@ void BiasCHW( template <> void CopyMatrix( - const size_t itemsize, const int M, const int N, const void* A, - const int lda, void* B, const int ldb, CPUContext* context) { + const size_t itemsize, + const int M, + const int N, + const void* A, + const int lda, + void* B, + const int ldb, + CPUContext* /*context*/) { if (lda == N && ldb == N) { // can coalese to a single memcpy of size M * N memcpy( diff --git a/caffe2/utils/mkl/mkl_context.h b/caffe2/utils/mkl/mkl_context.h index ff0ab821b02..cf8c77f77f1 100644 --- a/caffe2/utils/mkl/mkl_context.h +++ b/caffe2/utils/mkl/mkl_context.h @@ -29,7 +29,7 @@ class MKLContext final { ~MKLContext() {} - inline void SwitchToDevice(int stream_id = 0) {} + inline void SwitchToDevice(int /*stream_id*/ = 0) {} inline bool FinishDeviceComputation() { return true; } diff --git a/caffe2/utils/mkl/mkl_operator.h b/caffe2/utils/mkl/mkl_operator.h index e56e02e3f4a..e9bfb3f2c88 100644 --- a/caffe2/utils/mkl/mkl_operator.h +++ b/caffe2/utils/mkl/mkl_operator.h @@ -43,7 +43,7 @@ class MKLOperator : public OperatorBase { // The run function of Operator switches to the device, and then carries out // the actual computation with RunOnDevice(). You should implement RunOnDevice // instead of Run(). - bool Run(int /* unused */ stream_id) final { + bool Run(int /* unused */ /*stream_id*/) final { // Since MKLDNN does not need to do SwithToDevice and // FinishDeviceComputation, // it is always just a re-route to RunOnDevice(). diff --git a/caffe2/utils/proto_utils.cc b/caffe2/utils/proto_utils.cc index 46cf399901d..7da36f9884d 100644 --- a/caffe2/utils/proto_utils.cc +++ b/caffe2/utils/proto_utils.cc @@ -103,7 +103,9 @@ bool ReadProtoFromBinaryFile(const char* filename, MessageLite* proto) { return proto->ParseFromCodedStream(&coded_stream); } -void WriteProtoToBinaryFile(const MessageLite& proto, const char* filename) { +void WriteProtoToBinaryFile( + const MessageLite& /*proto*/, + const char* /*filename*/) { LOG(FATAL) << "Not implemented yet."; } diff --git a/caffe2/utils/proto_utils.h b/caffe2/utils/proto_utils.h index 9487ccd00f9..68c60509045 100644 --- a/caffe2/utils/proto_utils.h +++ b/caffe2/utils/proto_utils.h @@ -49,7 +49,9 @@ inline string ProtoDebugString(const MessageLite& proto) { // Text format MessageLite wrappers: these functions do nothing but just // allowing things to compile. It will produce a runtime error if you are using // MessageLite but still want text support. -inline bool ReadProtoFromTextFile(const char* filename, MessageLite* proto) { +inline bool ReadProtoFromTextFile( + const char* /*filename*/, + MessageLite* /*proto*/) { LOG(FATAL) << "If you are running lite version, you should not be " << "calling any text-format protobuffers."; return false; // Just to suppress compiler warning. @@ -58,8 +60,9 @@ inline bool ReadProtoFromTextFile(const string filename, MessageLite* proto) { return ReadProtoFromTextFile(filename.c_str(), proto); } -inline void WriteProtoToTextFile(const MessageLite& proto, - const char* filename) { +inline void WriteProtoToTextFile( + const MessageLite& /*proto*/, + const char* /*filename*/) { LOG(FATAL) << "If you are running lite version, you should not be " << "calling any text-format protobuffers."; } diff --git a/caffe2/utils/simple_queue.h b/caffe2/utils/simple_queue.h index d9ce5758d5a..5adedf1dad4 100644 --- a/caffe2/utils/simple_queue.h +++ b/caffe2/utils/simple_queue.h @@ -71,7 +71,7 @@ class SimpleQueue { std::queue queue_; bool no_more_jobs_; // We do not allow copy constructors. - SimpleQueue(const SimpleQueue& src) {} + SimpleQueue(const SimpleQueue& /*src*/) {} }; } // namespace caffe2 diff --git a/caffe2/video/video_input_op.cc b/caffe2/video/video_input_op.cc index dabf250a2dc..88ef409e1dc 100644 --- a/caffe2/video/video_input_op.cc +++ b/caffe2/video/video_input_op.cc @@ -7,9 +7,9 @@ REGISTER_CPU_OPERATOR(VideoInput, VideoInputOp); OPERATOR_SCHEMA(VideoInput) .NumInputs(0, 1) .NumOutputs(2) - .TensorInferenceFunction([]( - const OperatorDef& def, - const vector& /* unused */ in) { + .TensorInferenceFunction([](const OperatorDef& def, + const vector< + TensorShape>& /* unused */ /*in*/) { vector out(2); ArgumentHelper helper(def); int batch_size = helper.GetSingleArgument("batch_size", 0);