diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..ebda1b7bb864e3cd7b6c6be8b53546806743767f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libcaffe.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libcaffe.so.1.0.0 filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libcaffeproto.a filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose.so.1.7.0 filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_core.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_face.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_gpu.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_hand.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_net.so filter=lfs diff=lfs merge=lfs -text +usr/local/lib/libopenpose_pose.so filter=lfs diff=lfs merge=lfs -text diff --git a/usr/local/include/caffe/blob.hpp b/usr/local/include/caffe/blob.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a87b2058c1d16bab607c602b7afc5d4c77ad7097 --- /dev/null +++ b/usr/local/include/caffe/blob.hpp @@ -0,0 +1,282 @@ +#ifndef CAFFE_BLOB_HPP_ +#define CAFFE_BLOB_HPP_ + +#include +#include +#include + +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/syncedmem.hpp" + +const int kMaxBlobAxes = 32; + +namespace caffe { + +/** + * @brief A wrapper around SyncedMemory holders serving as the basic + * computational unit through which Layer%s, Net%s, and Solver%s + * interact. + * + * TODO(dox): more thorough description. + */ +template +class Blob { + public: + Blob() + : data_(), diff_(), count_(0), capacity_(0) {} + + /// @brief Deprecated; use Blob(const vector& shape). + explicit Blob(const int num, const int channels, const int height, + const int width); + explicit Blob(const vector& shape); + + /// @brief Deprecated; use Reshape(const vector& shape). + void Reshape(const int num, const int channels, const int height, + const int width); + /** + * @brief Change the dimensions of the blob, allocating new memory if + * necessary. + * + * This function can be called both to create an initial allocation + * of memory, and to adjust the dimensions of a top blob during Layer::Reshape + * or Layer::Forward. When changing the size of blob, memory will only be + * reallocated if sufficient memory does not already exist, and excess memory + * will never be freed. + * + * Note that reshaping an input blob and immediately calling Net::Backward is + * an error; either Net::Forward or Net::Reshape need to be called to + * propagate the new input shape to higher layers. + */ + void Reshape(const vector& shape); + void Reshape(const BlobShape& shape); + void ReshapeLike(const Blob& other); + inline string shape_string() const { + ostringstream stream; + for (unsigned int i = 0u; i < shape_.size(); ++i) { + stream << shape_[i] << " "; + } + stream << "(" << count_ << ")"; + return stream.str(); + } + inline const vector& shape() const { return shape_; } + /** + * @brief Returns the dimension of the index-th axis (or the negative index-th + * axis from the end, if index is negative). + * + * @param index the axis index, which may be negative as it will be + * "canonicalized" using CanonicalAxisIndex. + * Dies on out of range index. + */ + inline int shape(int index) const { + return shape_[CanonicalAxisIndex(index)]; + } + inline int num_axes() const { return shape_.size(); } + inline int count() const { return count_; } + + /** + * @brief Compute the volume of a slice; i.e., the product of dimensions + * among a range of axes. + * + * @param start_axis The first axis to include in the slice. + * + * @param end_axis The first axis to exclude from the slice. + */ + inline int count(int start_axis, int end_axis) const { + CHECK_LE(start_axis, end_axis); + CHECK_GE(start_axis, 0); + CHECK_GE(end_axis, 0); + CHECK_LE(start_axis, num_axes()); + CHECK_LE(end_axis, num_axes()); + int count = 1; + for (int i = start_axis; i < end_axis; ++i) { + count *= shape(i); + } + return count; + } + /** + * @brief Compute the volume of a slice spanning from a particular first + * axis to the final axis. + * + * @param start_axis The first axis to include in the slice. + */ + inline int count(int start_axis) const { + return count(start_axis, num_axes()); + } + + /** + * @brief Returns the 'canonical' version of a (usually) user-specified axis, + * allowing for negative indexing (e.g., -1 for the last axis). + * + * @param axis_index the axis index. + * If 0 <= index < num_axes(), return index. + * If -num_axes <= index <= -1, return (num_axes() - (-index)), + * e.g., the last axis index (num_axes() - 1) if index == -1, + * the second to last if index == -2, etc. + * Dies on out of range index. + */ + inline int CanonicalAxisIndex(int axis_index) const { + CHECK_GE(axis_index, -num_axes()) + << "axis " << axis_index << " out of range for " << num_axes() + << "-D Blob with shape " << shape_string(); + CHECK_LT(axis_index, num_axes()) + << "axis " << axis_index << " out of range for " << num_axes() + << "-D Blob with shape " << shape_string(); + if (axis_index < 0) { + return axis_index + num_axes(); + } + return axis_index; + } + + /// @brief Deprecated legacy shape accessor num: use shape(0) instead. + inline int num() const { return LegacyShape(0); } + /// @brief Deprecated legacy shape accessor channels: use shape(1) instead. + inline int channels() const { return LegacyShape(1); } + /// @brief Deprecated legacy shape accessor height: use shape(2) instead. + inline int height() const { return LegacyShape(2); } + /// @brief Deprecated legacy shape accessor width: use shape(3) instead. + inline int width() const { return LegacyShape(3); } + inline int LegacyShape(int index) const { + CHECK_LE(num_axes(), 4) + << "Cannot use legacy accessors on Blobs with > 4 axes."; + CHECK_LT(index, 4); + CHECK_GE(index, -4); + if (index >= num_axes() || index < -num_axes()) { + // Axis is out of range, but still in [0, 3] (or [-4, -1] for reverse + // indexing) -- this special case simulates the one-padding used to fill + // extraneous axes of legacy blobs. + return 1; + } + return shape(index); + } + + inline int offset(const int n, const int c = 0, const int h = 0, + const int w = 0) const { + CHECK_GE(n, 0); + CHECK_LE(n, num()); + CHECK_GE(channels(), 0); + CHECK_LE(c, channels()); + CHECK_GE(height(), 0); + CHECK_LE(h, height()); + CHECK_GE(width(), 0); + CHECK_LE(w, width()); + return ((n * channels() + c) * height() + h) * width() + w; + } + + inline int offset(const vector& indices) const { + CHECK_LE(indices.size(), num_axes()); + int offset = 0; + for (int i = 0; i < num_axes(); ++i) { + offset *= shape(i); + if (indices.size() > i) { + CHECK_GE(indices[i], 0); + CHECK_LT(indices[i], shape(i)); + offset += indices[i]; + } + } + return offset; + } + /** + * @brief Copy from a source Blob. + * + * @param source the Blob to copy from + * @param copy_diff if false, copy the data; if true, copy the diff + * @param reshape if false, require this Blob to be pre-shaped to the shape + * of other (and die otherwise); if true, Reshape this Blob to other's + * shape if necessary + */ + void CopyFrom(const Blob& source, bool copy_diff = false, + bool reshape = false); + + inline Dtype data_at(const int n, const int c, const int h, + const int w) const { + return cpu_data()[offset(n, c, h, w)]; + } + + inline Dtype diff_at(const int n, const int c, const int h, + const int w) const { + return cpu_diff()[offset(n, c, h, w)]; + } + + inline Dtype data_at(const vector& index) const { + return cpu_data()[offset(index)]; + } + + inline Dtype diff_at(const vector& index) const { + return cpu_diff()[offset(index)]; + } + + inline const shared_ptr& data() const { + CHECK(data_); + return data_; + } + + inline const shared_ptr& diff() const { + CHECK(diff_); + return diff_; + } + + const Dtype* cpu_data() const; + void set_cpu_data(Dtype* data); + const int* gpu_shape() const; + const Dtype* gpu_data() const; + void set_gpu_data(Dtype* data); + const Dtype* cpu_diff() const; + const Dtype* gpu_diff() const; + Dtype* mutable_cpu_data(); + Dtype* mutable_gpu_data(); + Dtype* mutable_cpu_diff(); + Dtype* mutable_gpu_diff(); + void Update(); + void FromProto(const BlobProto& proto, bool reshape = true); + void ToProto(BlobProto* proto, bool write_diff = false) const; + + /// @brief Compute the sum of absolute values (L1 norm) of the data. + Dtype asum_data() const; + /// @brief Compute the sum of absolute values (L1 norm) of the diff. + Dtype asum_diff() const; + /// @brief Compute the sum of squares (L2 norm squared) of the data. + Dtype sumsq_data() const; + /// @brief Compute the sum of squares (L2 norm squared) of the diff. + Dtype sumsq_diff() const; + + /// @brief Scale the blob data by a constant factor. + void scale_data(Dtype scale_factor); + /// @brief Scale the blob diff by a constant factor. + void scale_diff(Dtype scale_factor); + + /** + * @brief Set the data_ shared_ptr to point to the SyncedMemory holding the + * data_ of Blob other -- useful in Layer%s which simply perform a copy + * in their Forward pass. + * + * This deallocates the SyncedMemory holding this Blob's data_, as + * shared_ptr calls its destructor when reset with the "=" operator. + */ + void ShareData(const Blob& other); + /** + * @brief Set the diff_ shared_ptr to point to the SyncedMemory holding the + * diff_ of Blob other -- useful in Layer%s which simply perform a copy + * in their Forward pass. + * + * This deallocates the SyncedMemory holding this Blob's diff_, as + * shared_ptr calls its destructor when reset with the "=" operator. + */ + void ShareDiff(const Blob& other); + + bool ShapeEquals(const BlobProto& other); + + protected: + shared_ptr data_; + shared_ptr diff_; + shared_ptr shape_data_; + vector shape_; + int count_; + int capacity_; + + DISABLE_COPY_AND_ASSIGN(Blob); +}; // class Blob + +} // namespace caffe + +#endif // CAFFE_BLOB_HPP_ diff --git a/usr/local/include/caffe/caffe.hpp b/usr/local/include/caffe/caffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..06882096c55cdc31a7ea9f01fba93a4fa0c6cd65 --- /dev/null +++ b/usr/local/include/caffe/caffe.hpp @@ -0,0 +1,21 @@ +// caffe.hpp is the header file that you need to include in your code. It wraps +// all the internal caffe header files into one for simpler inclusion. + +#ifndef CAFFE_CAFFE_HPP_ +#define CAFFE_CAFFE_HPP_ + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/filler.hpp" +#include "caffe/layer.hpp" +#include "caffe/layer_factory.hpp" +#include "caffe/net.hpp" +#include "caffe/parallel.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/solver.hpp" +#include "caffe/solver_factory.hpp" +#include "caffe/util/benchmark.hpp" +#include "caffe/util/io.hpp" +#include "caffe/util/upgrade_proto.hpp" + +#endif // CAFFE_CAFFE_HPP_ diff --git a/usr/local/include/caffe/common.hpp b/usr/local/include/caffe/common.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4904d1d8661c27c1ca59cf42a0a7f877c8835876 --- /dev/null +++ b/usr/local/include/caffe/common.hpp @@ -0,0 +1,193 @@ +#ifndef CAFFE_COMMON_HPP_ +#define CAFFE_COMMON_HPP_ + +#include +#include +#include + +#include +#include +#include // NOLINT(readability/streams) +#include // NOLINT(readability/streams) +#include +#include +#include +#include +#include // pair +#include + +#include "caffe/util/device_alternate.hpp" + +// Convert macro to string +#define STRINGIFY(m) #m +#define AS_STRING(m) STRINGIFY(m) + +// gflags 2.1 issue: namespace google was changed to gflags without warning. +// Luckily we will be able to use GFLAGS_GFLAGS_H_ to detect if it is version +// 2.1. If yes, we will add a temporary solution to redirect the namespace. +// TODO(Yangqing): Once gflags solves the problem in a more elegant way, let's +// remove the following hack. +#ifndef GFLAGS_GFLAGS_H_ +namespace gflags = google; +#endif // GFLAGS_GFLAGS_H_ + +// Disable the copy and assignment operator for a class. +#define DISABLE_COPY_AND_ASSIGN(classname) \ +private:\ + classname(const classname&);\ + classname& operator=(const classname&) + +// Instantiate a class with float and double specifications. +#define INSTANTIATE_CLASS(classname) \ + char gInstantiationGuard##classname; \ + template class classname; \ + template class classname + +#define INSTANTIATE_LAYER_GPU_FORWARD(classname) \ + template void classname::Forward_gpu( \ + const std::vector*>& bottom, \ + const std::vector*>& top); \ + template void classname::Forward_gpu( \ + const std::vector*>& bottom, \ + const std::vector*>& top); + +#define INSTANTIATE_LAYER_GPU_BACKWARD(classname) \ + template void classname::Backward_gpu( \ + const std::vector*>& top, \ + const std::vector& propagate_down, \ + const std::vector*>& bottom); \ + template void classname::Backward_gpu( \ + const std::vector*>& top, \ + const std::vector& propagate_down, \ + const std::vector*>& bottom) + +#define INSTANTIATE_LAYER_GPU_FUNCS(classname) \ + INSTANTIATE_LAYER_GPU_FORWARD(classname); \ + INSTANTIATE_LAYER_GPU_BACKWARD(classname) + +// A simple macro to mark codes that are not implemented, so that when the code +// is executed we will see a fatal log. +#define NOT_IMPLEMENTED LOG(FATAL) << "Not Implemented Yet" + +// See PR #1236 +namespace cv { class Mat; } + +namespace caffe { + +// We will use the boost shared_ptr instead of the new C++11 one mainly +// because cuda does not work (at least now) well with C++11 features. +using boost::shared_ptr; + +// Common functions and classes from std that caffe often uses. +using std::fstream; +using std::ios; +using std::isnan; +using std::isinf; +using std::iterator; +using std::make_pair; +using std::map; +using std::ostringstream; +using std::pair; +using std::set; +using std::string; +using std::stringstream; +using std::vector; + +// A global initialization function that you should call in your main function. +// Currently it initializes google flags and google logging. +void GlobalInit(int* pargc, char*** pargv); + +// A singleton class to hold common caffe stuff, such as the handler that +// caffe is going to use for cublas, curand, etc. +class Caffe { + public: + ~Caffe(); + + // Thread local context for Caffe. Moved to common.cpp instead of + // including boost/thread.hpp to avoid a boost/NVCC issues (#1009, #1010) + // on OSX. Also fails on Linux with CUDA 7.0.18. + static Caffe& Get(); + + enum Brew { CPU, GPU }; + + // This random number generator facade hides boost and CUDA rng + // implementation from one another (for cross-platform compatibility). + class RNG { + public: + RNG(); + explicit RNG(unsigned int seed); + explicit RNG(const RNG&); + RNG& operator=(const RNG&); + void* generator(); + private: + class Generator; + shared_ptr generator_; + }; + + // Getters for boost rng, curand, and cublas handles + inline static RNG& rng_stream() { + if (!Get().random_generator_) { + Get().random_generator_.reset(new RNG()); + } + return *(Get().random_generator_); + } +#ifndef CPU_ONLY + inline static cublasHandle_t cublas_handle() { return Get().cublas_handle_; } + inline static curandGenerator_t curand_generator() { + return Get().curand_generator_; + } +#endif + + // Returns the mode: running on CPU or GPU. + inline static Brew mode() { return Get().mode_; } + // The setters for the variables + // Sets the mode. It is recommended that you don't change the mode halfway + // into the program since that may cause allocation of pinned memory being + // freed in a non-pinned way, which may cause problems - I haven't verified + // it personally but better to note it here in the header file. + inline static void set_mode(Brew mode) { Get().mode_ = mode; } + // Sets the random seed of both boost and curand + static void set_random_seed(const unsigned int seed); + // Sets the device. Since we have cublas and curand stuff, set device also + // requires us to reset those values. + static void SetDevice(const int device_id); + // Prints the current GPU status. + static void DeviceQuery(); + // Check if specified device is available + static bool CheckDevice(const int device_id); + // Search from start_id to the highest possible device ordinal, + // return the ordinal of the first available device. + static int FindDevice(const int start_id = 0); + // Parallel training + inline static int solver_count() { return Get().solver_count_; } + inline static void set_solver_count(int val) { Get().solver_count_ = val; } + inline static int solver_rank() { return Get().solver_rank_; } + inline static void set_solver_rank(int val) { Get().solver_rank_ = val; } + inline static bool multiprocess() { return Get().multiprocess_; } + inline static void set_multiprocess(bool val) { Get().multiprocess_ = val; } + inline static bool root_solver() { return Get().solver_rank_ == 0; } + + protected: +#ifndef CPU_ONLY + cublasHandle_t cublas_handle_; + curandGenerator_t curand_generator_; +#endif + shared_ptr random_generator_; + + Brew mode_; + + // Parallel training + int solver_count_; + int solver_rank_; + bool multiprocess_; + + private: + // The private constructor to avoid duplicate instantiation. + Caffe(); + + DISABLE_COPY_AND_ASSIGN(Caffe); +}; + +} // namespace caffe + +#endif // CAFFE_COMMON_HPP_ diff --git a/usr/local/include/caffe/data_transformer.hpp b/usr/local/include/caffe/data_transformer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..97b4ee6a8c4332773c1a0cde4e4a552f919e7790 --- /dev/null +++ b/usr/local/include/caffe/data_transformer.hpp @@ -0,0 +1,154 @@ +#ifndef CAFFE_DATA_TRANSFORMER_HPP +#define CAFFE_DATA_TRANSFORMER_HPP + +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Applies common transformations to the input data, such as + * scaling, mirroring, substracting the image mean... + */ +template +class DataTransformer { + public: + explicit DataTransformer(const TransformationParameter& param, Phase phase); + virtual ~DataTransformer() {} + + /** + * @brief Initialize the Random number generations if needed by the + * transformation. + */ + void InitRand(); + + /** + * @brief Applies the transformation defined in the data layer's + * transform_param block to the data. + * + * @param datum + * Datum containing the data to be transformed. + * @param transformed_blob + * This is destination blob. It can be part of top blob's data if + * set_cpu_data() is used. See data_layer.cpp for an example. + */ + void Transform(const Datum& datum, Blob* transformed_blob); + + /** + * @brief Applies the transformation defined in the data layer's + * transform_param block to a vector of Datum. + * + * @param datum_vector + * A vector of Datum containing the data to be transformed. + * @param transformed_blob + * This is destination blob. It can be part of top blob's data if + * set_cpu_data() is used. See memory_layer.cpp for an example. + */ + void Transform(const vector & datum_vector, + Blob* transformed_blob); + +#ifdef USE_OPENCV + /** + * @brief Applies the transformation defined in the data layer's + * transform_param block to a vector of Mat. + * + * @param mat_vector + * A vector of Mat containing the data to be transformed. + * @param transformed_blob + * This is destination blob. It can be part of top blob's data if + * set_cpu_data() is used. See memory_layer.cpp for an example. + */ + void Transform(const vector & mat_vector, + Blob* transformed_blob); + + /** + * @brief Applies the transformation defined in the data layer's + * transform_param block to a cv::Mat + * + * @param cv_img + * cv::Mat containing the data to be transformed. + * @param transformed_blob + * This is destination blob. It can be part of top blob's data if + * set_cpu_data() is used. See image_data_layer.cpp for an example. + */ + void Transform(const cv::Mat& cv_img, Blob* transformed_blob); +#endif // USE_OPENCV + + /** + * @brief Applies the same transformation defined in the data layer's + * transform_param block to all the num images in a input_blob. + * + * @param input_blob + * A Blob containing the data to be transformed. It applies the same + * transformation to all the num images in the blob. + * @param transformed_blob + * This is destination blob, it will contain as many images as the + * input blob. It can be part of top blob's data. + */ + void Transform(Blob* input_blob, Blob* transformed_blob); + + /** + * @brief Infers the shape of transformed_blob will have when + * the transformation is applied to the data. + * + * @param datum + * Datum containing the data to be transformed. + */ + vector InferBlobShape(const Datum& datum); + /** + * @brief Infers the shape of transformed_blob will have when + * the transformation is applied to the data. + * It uses the first element to infer the shape of the blob. + * + * @param datum_vector + * A vector of Datum containing the data to be transformed. + */ + vector InferBlobShape(const vector & datum_vector); + /** + * @brief Infers the shape of transformed_blob will have when + * the transformation is applied to the data. + * It uses the first element to infer the shape of the blob. + * + * @param mat_vector + * A vector of Mat containing the data to be transformed. + */ +#ifdef USE_OPENCV + vector InferBlobShape(const vector & mat_vector); + /** + * @brief Infers the shape of transformed_blob will have when + * the transformation is applied to the data. + * + * @param cv_img + * cv::Mat containing the data to be transformed. + */ + vector InferBlobShape(const cv::Mat& cv_img); +#endif // USE_OPENCV + + protected: + /** + * @brief Generates a random integer from Uniform({0, 1, ..., n-1}). + * + * @param n + * The upperbound (exclusive) value of the random number. + * @return + * A uniformly random integer value from ({0, 1, ..., n-1}). + */ + virtual int Rand(int n); + + void Transform(const Datum& datum, Dtype* transformed_data); + // Tranformation parameters + TransformationParameter param_; + + + shared_ptr rng_; + Phase phase_; + Blob data_mean_; + vector mean_values_; +}; + +} // namespace caffe + +#endif // CAFFE_DATA_TRANSFORMER_HPP_ diff --git a/usr/local/include/caffe/filler.hpp b/usr/local/include/caffe/filler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a44773619dc2bdfa9687acfc0d3b2c61efff0b0a --- /dev/null +++ b/usr/local/include/caffe/filler.hpp @@ -0,0 +1,301 @@ +// Fillers are random number generators that fills a blob using the specified +// algorithm. The expectation is that they are only going to be used during +// initialization time and will not involve any GPUs. + +#ifndef CAFFE_FILLER_HPP +#define CAFFE_FILLER_HPP + +#include + +#include "caffe/blob.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/syncedmem.hpp" +#include "caffe/util/math_functions.hpp" + +namespace caffe { + +/// @brief Fills a Blob with constant or randomly-generated data. +template +class Filler { + public: + explicit Filler(const FillerParameter& param) : filler_param_(param) {} + virtual ~Filler() {} + virtual void Fill(Blob* blob) = 0; + protected: + FillerParameter filler_param_; +}; // class Filler + + +/// @brief Fills a Blob with constant values @f$ x = 0 @f$. +template +class ConstantFiller : public Filler { + public: + explicit ConstantFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + Dtype* data = blob->mutable_cpu_data(); + const int count = blob->count(); + const Dtype value = this->filler_param_.value(); + CHECK(count); + for (int i = 0; i < count; ++i) { + data[i] = value; + } + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/// @brief Fills a Blob with uniformly distributed values @f$ x\sim U(a, b) @f$. +template +class UniformFiller : public Filler { + public: + explicit UniformFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + CHECK(blob->count()); + caffe_rng_uniform(blob->count(), Dtype(this->filler_param_.min()), + Dtype(this->filler_param_.max()), blob->mutable_cpu_data()); + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/// @brief Fills a Blob with Gaussian-distributed values @f$ x = a @f$. +template +class GaussianFiller : public Filler { + public: + explicit GaussianFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + Dtype* data = blob->mutable_cpu_data(); + CHECK(blob->count()); + caffe_rng_gaussian(blob->count(), Dtype(this->filler_param_.mean()), + Dtype(this->filler_param_.std()), blob->mutable_cpu_data()); + int sparse = this->filler_param_.sparse(); + CHECK_GE(sparse, -1); + if (sparse >= 0) { + // Sparse initialization is implemented for "weight" blobs; i.e. matrices. + // These have num == channels == 1; width is number of inputs; height is + // number of outputs. The 'sparse' variable specifies the mean number + // of non-zero input weights for a given output. + CHECK_GE(blob->num_axes(), 1); + const int num_outputs = blob->shape(0); + Dtype non_zero_probability = Dtype(sparse) / Dtype(num_outputs); + rand_vec_.reset(new SyncedMemory(blob->count() * sizeof(int))); + int* mask = reinterpret_cast(rand_vec_->mutable_cpu_data()); + caffe_rng_bernoulli(blob->count(), non_zero_probability, mask); + for (int i = 0; i < blob->count(); ++i) { + data[i] *= mask[i]; + } + } + } + + protected: + shared_ptr rand_vec_; +}; + +/** @brief Fills a Blob with values @f$ x \in [0, 1] @f$ + * such that @f$ \forall i \sum_j x_{ij} = 1 @f$. + */ +template +class PositiveUnitballFiller : public Filler { + public: + explicit PositiveUnitballFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + Dtype* data = blob->mutable_cpu_data(); + DCHECK(blob->count()); + caffe_rng_uniform(blob->count(), 0, 1, blob->mutable_cpu_data()); + // We expect the filler to not be called very frequently, so we will + // just use a simple implementation + int dim = blob->count() / blob->shape(0); + CHECK(dim); + for (int i = 0; i < blob->shape(0); ++i) { + Dtype sum = 0; + for (int j = 0; j < dim; ++j) { + sum += data[i * dim + j]; + } + for (int j = 0; j < dim; ++j) { + data[i * dim + j] /= sum; + } + } + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/** + * @brief Fills a Blob with values @f$ x \sim U(-a, +a) @f$ where @f$ a @f$ is + * set inversely proportional to number of incoming nodes, outgoing + * nodes, or their average. + * + * A Filler based on the paper [Bengio and Glorot 2010]: Understanding + * the difficulty of training deep feedforward neuralnetworks. + * + * It fills the incoming matrix by randomly sampling uniform data from [-scale, + * scale] where scale = sqrt(3 / n) where n is the fan_in, fan_out, or their + * average, depending on the variance_norm option. You should make sure the + * input blob has shape (num, a, b, c) where a * b * c = fan_in and num * b * c + * = fan_out. Note that this is currently not the case for inner product layers. + * + * TODO(dox): make notation in above comment consistent with rest & use LaTeX. + */ +template +class XavierFiller : public Filler { + public: + explicit XavierFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + CHECK(blob->count()); + int fan_in = blob->count() / blob->shape(0); + // Compatibility with ND blobs + int fan_out = blob->num_axes() > 1 ? + blob->count() / blob->shape(1) : + blob->count(); + Dtype n = fan_in; // default to fan_in + if (this->filler_param_.variance_norm() == + FillerParameter_VarianceNorm_AVERAGE) { + n = (fan_in + fan_out) / Dtype(2); + } else if (this->filler_param_.variance_norm() == + FillerParameter_VarianceNorm_FAN_OUT) { + n = fan_out; + } + Dtype scale = sqrt(Dtype(3) / n); + caffe_rng_uniform(blob->count(), -scale, scale, + blob->mutable_cpu_data()); + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/** + * @brief Fills a Blob with values @f$ x \sim N(0, \sigma^2) @f$ where + * @f$ \sigma^2 @f$ is set inversely proportional to number of incoming + * nodes, outgoing nodes, or their average. + * + * A Filler based on the paper [He, Zhang, Ren and Sun 2015]: Specifically + * accounts for ReLU nonlinearities. + * + * Aside: for another perspective on the scaling factor, see the derivation of + * [Saxe, McClelland, and Ganguli 2013 (v3)]. + * + * It fills the incoming matrix by randomly sampling Gaussian data with std = + * sqrt(2 / n) where n is the fan_in, fan_out, or their average, depending on + * the variance_norm option. You should make sure the input blob has shape (num, + * a, b, c) where a * b * c = fan_in and num * b * c = fan_out. Note that this + * is currently not the case for inner product layers. + */ +template +class MSRAFiller : public Filler { + public: + explicit MSRAFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + CHECK(blob->count()); + int fan_in = blob->count() / blob->shape(0); + // Compatibility with ND blobs + int fan_out = blob->num_axes() > 1 ? + blob->count() / blob->shape(1) : + blob->count(); + Dtype n = fan_in; // default to fan_in + if (this->filler_param_.variance_norm() == + FillerParameter_VarianceNorm_AVERAGE) { + n = (fan_in + fan_out) / Dtype(2); + } else if (this->filler_param_.variance_norm() == + FillerParameter_VarianceNorm_FAN_OUT) { + n = fan_out; + } + Dtype std = sqrt(Dtype(2) / n); + caffe_rng_gaussian(blob->count(), Dtype(0), std, + blob->mutable_cpu_data()); + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/*! +@brief Fills a Blob with coefficients for bilinear interpolation. + +A common use case is with the DeconvolutionLayer acting as upsampling. +You can upsample a feature map with shape of (B, C, H, W) by any integer factor +using the following proto. +\code +layer { + name: "upsample", type: "Deconvolution" + bottom: "{{bottom_name}}" top: "{{top_name}}" + convolution_param { + kernel_size: {{2 * factor - factor % 2}} stride: {{factor}} + num_output: {{C}} group: {{C}} + pad: {{ceil((factor - 1) / 2.)}} + weight_filler: { type: "bilinear" } bias_term: false + } + param { lr_mult: 0 decay_mult: 0 } +} +\endcode +Please use this by replacing `{{}}` with your values. By specifying +`num_output: {{C}} group: {{C}}`, it behaves as +channel-wise convolution. The filter shape of this deconvolution layer will be +(C, 1, K, K) where K is `kernel_size`, and this filler will set a (K, K) +interpolation kernel for every channel of the filter identically. The resulting +shape of the top feature map will be (B, C, factor * H, factor * W). +Note that the learning rate and the +weight decay are set to 0 in order to keep coefficient values of bilinear +interpolation unchanged during training. If you apply this to an image, this +operation is equivalent to the following call in Python with Scikit.Image. +\code{.py} +out = skimage.transform.rescale(img, factor, mode='constant', cval=0) +\endcode + */ +template +class BilinearFiller : public Filler { + public: + explicit BilinearFiller(const FillerParameter& param) + : Filler(param) {} + virtual void Fill(Blob* blob) { + CHECK_EQ(blob->num_axes(), 4) << "Blob must be 4 dim."; + CHECK_EQ(blob->width(), blob->height()) << "Filter must be square"; + Dtype* data = blob->mutable_cpu_data(); + int f = ceil(blob->width() / 2.); + Dtype c = (blob->width() - 1) / (2. * f); + for (int i = 0; i < blob->count(); ++i) { + Dtype x = i % blob->width(); + Dtype y = (i / blob->width()) % blob->height(); + data[i] = (1 - fabs(x / f - c)) * (1 - fabs(y / f - c)); + } + CHECK_EQ(this->filler_param_.sparse(), -1) + << "Sparsity not supported by this Filler."; + } +}; + +/** + * @brief Get a specific filler from the specification given in FillerParameter. + * + * Ideally this would be replaced by a factory pattern, but we will leave it + * this way for now. + */ +template +Filler* GetFiller(const FillerParameter& param) { + const std::string& type = param.type(); + if (type == "constant") { + return new ConstantFiller(param); + } else if (type == "gaussian") { + return new GaussianFiller(param); + } else if (type == "positive_unitball") { + return new PositiveUnitballFiller(param); + } else if (type == "uniform") { + return new UniformFiller(param); + } else if (type == "xavier") { + return new XavierFiller(param); + } else if (type == "msra") { + return new MSRAFiller(param); + } else if (type == "bilinear") { + return new BilinearFiller(param); + } else { + CHECK(false) << "Unknown filler name: " << param.type(); + } + return (Filler*)(NULL); +} + +} // namespace caffe + +#endif // CAFFE_FILLER_HPP_ diff --git a/usr/local/include/caffe/internal_thread.hpp b/usr/local/include/caffe/internal_thread.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0ba6766503523658fecf2784c13666533bf420ef --- /dev/null +++ b/usr/local/include/caffe/internal_thread.hpp @@ -0,0 +1,53 @@ +#ifndef CAFFE_INTERNAL_THREAD_HPP_ +#define CAFFE_INTERNAL_THREAD_HPP_ + +#include "caffe/common.hpp" + +/** + Forward declare boost::thread instead of including boost/thread.hpp + to avoid a boost/NVCC issues (#1009, #1010) on OSX. + */ +namespace boost { class thread; } + +namespace caffe { + +/** + * Virtual class encapsulate boost::thread for use in base class + * The child class will acquire the ability to run a single thread, + * by reimplementing the virtual function InternalThreadEntry. + */ +class InternalThread { + public: + InternalThread() : thread_() {} + virtual ~InternalThread(); + + /** + * Caffe's thread local state will be initialized using the current + * thread values, e.g. device id, solver index etc. The random seed + * is initialized using caffe_rng_rand. + */ + void StartInternalThread(); + + /** Will not return until the internal thread has exited. */ + void StopInternalThread(); + + bool is_started() const; + + protected: + /* Implement this method in your subclass + with the code you want your thread to run. */ + virtual void InternalThreadEntry() {} + + /* Should be tested when running loops to exit when requested. */ + bool must_stop(); + + private: + void entry(int device, Caffe::Brew mode, int rand_seed, + int solver_count, int solver_rank, bool multiprocess); + + shared_ptr thread_; +}; + +} // namespace caffe + +#endif // CAFFE_INTERNAL_THREAD_HPP_ diff --git a/usr/local/include/caffe/layer.hpp b/usr/local/include/caffe/layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..30dbfd53758d686b4b739ddaaf8bf5892e8700fd --- /dev/null +++ b/usr/local/include/caffe/layer.hpp @@ -0,0 +1,477 @@ +#ifndef CAFFE_LAYER_H_ +#define CAFFE_LAYER_H_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/layer_factory.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/math_functions.hpp" + +/** + Forward declare boost::thread instead of including boost/thread.hpp + to avoid a boost/NVCC issues (#1009, #1010) on OSX. + */ +namespace boost { class mutex; } + +namespace caffe { + +/** + * @brief An interface for the units of computation which can be composed into a + * Net. + * + * Layer%s must implement a Forward function, in which they take their input + * (bottom) Blob%s (if any) and compute their output Blob%s (if any). + * They may also implement a Backward function, in which they compute the error + * gradients with respect to their input Blob%s, given the error gradients with + * their output Blob%s. + */ +template +class Layer { + public: + /** + * You should not implement your own constructor. Any set up code should go + * to SetUp(), where the dimensions of the bottom blobs are provided to the + * layer. + */ + explicit Layer(const LayerParameter& param) + : layer_param_(param) { + // Set phase and copy blobs (if there are any). + phase_ = param.phase(); + if (layer_param_.blobs_size() > 0) { + blobs_.resize(layer_param_.blobs_size()); + for (int i = 0; i < layer_param_.blobs_size(); ++i) { + blobs_[i].reset(new Blob()); + blobs_[i]->FromProto(layer_param_.blobs(i)); + } + } + } + virtual ~Layer() {} + + /** + * @brief Implements common layer setup functionality. + * + * @param bottom the preshaped input blobs + * @param top + * the allocated but unshaped output blobs, to be shaped by Reshape + * + * Checks that the number of bottom and top blobs is correct. + * Calls LayerSetUp to do special layer setup for individual layer types, + * followed by Reshape to set up sizes of top blobs and internal buffers. + * Sets up the loss weight multiplier blobs for any non-zero loss weights. + * This method may not be overridden. + */ + void SetUp(const vector*>& bottom, + const vector*>& top) { + CheckBlobCounts(bottom, top); + LayerSetUp(bottom, top); + Reshape(bottom, top); + SetLossWeights(top); + } + + /** + * @brief Does layer-specific setup: your layer should implement this function + * as well as Reshape. + * + * @param bottom + * the preshaped input blobs, whose data fields store the input data for + * this layer + * @param top + * the allocated but unshaped output blobs + * + * This method should do one-time layer specific setup. This includes reading + * and processing relevent parameters from the layer_param_. + * Setting up the shapes of top blobs and internal buffers should be done in + * Reshape, which will be called before the forward pass to + * adjust the top blob sizes. + */ + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top) {} + + /** + * @brief Adjust the shapes of top blobs and internal buffers to accommodate + * the shapes of the bottom blobs. + * + * @param bottom the input blobs, with the requested input shapes + * @param top the top blobs, which should be reshaped as needed + * + * This method should reshape top blobs as needed according to the shapes + * of the bottom (input) blobs, as well as reshaping any internal buffers + * and making any other necessary adjustments so that the layer can + * accommodate the bottom blobs. + */ + virtual void Reshape(const vector*>& bottom, + const vector*>& top) = 0; + + /** + * @brief Given the bottom blobs, compute the top blobs and the loss. + * + * @param bottom + * the input blobs, whose data fields store the input data for this layer + * @param top + * the preshaped output blobs, whose data fields will store this layers' + * outputs + * \return The total loss from the layer. + * + * The Forward wrapper calls the relevant device wrapper function + * (Forward_cpu or Forward_gpu) to compute the top blob values given the + * bottom blobs. If the layer has any non-zero loss_weights, the wrapper + * then computes and returns the loss. + * + * Your layer should implement Forward_cpu and (optionally) Forward_gpu. + */ + inline Dtype Forward(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Given the top blob error gradients, compute the bottom blob error + * gradients. + * + * @param top + * the output blobs, whose diff fields store the gradient of the error + * with respect to themselves + * @param propagate_down + * a vector with equal length to bottom, with each index indicating + * whether to propagate the error gradients down to the bottom blob at + * the corresponding index + * @param bottom + * the input blobs, whose diff fields will store the gradient of the error + * with respect to themselves after Backward is run + * + * The Backward wrapper calls the relevant device wrapper function + * (Backward_cpu or Backward_gpu) to compute the bottom blob diffs given the + * top blob diffs. + * + * Your layer should implement Backward_cpu and (optionally) Backward_gpu. + */ + inline void Backward(const vector*>& top, + const vector& propagate_down, + const vector*>& bottom); + + /** + * @brief Returns the vector of learnable parameter blobs. + */ + vector > >& blobs() { + return blobs_; + } + + /** + * @brief Returns the layer parameter. + */ + const LayerParameter& layer_param() const { return layer_param_; } + + /** + * @brief Writes the layer parameter to a protocol buffer + */ + virtual void ToProto(LayerParameter* param, bool write_diff = false); + + /** + * @brief Returns the scalar loss associated with a top blob at a given index. + */ + inline Dtype loss(const int top_index) const { + return (loss_.size() > top_index) ? loss_[top_index] : Dtype(0); + } + + /** + * @brief Sets the loss associated with a top blob at a given index. + */ + inline void set_loss(const int top_index, const Dtype value) { + if (loss_.size() <= top_index) { + loss_.resize(top_index + 1, Dtype(0)); + } + loss_[top_index] = value; + } + + /** + * @brief Returns the layer type. + */ + virtual inline const char* type() const { return ""; } + + /** + * @brief Returns the exact number of bottom blobs required by the layer, + * or -1 if no exact number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some exact number of bottom blobs. + */ + virtual inline int ExactNumBottomBlobs() const { return -1; } + /** + * @brief Returns the minimum number of bottom blobs required by the layer, + * or -1 if no minimum number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some minimum number of bottom blobs. + */ + virtual inline int MinBottomBlobs() const { return -1; } + /** + * @brief Returns the maximum number of bottom blobs required by the layer, + * or -1 if no maximum number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some maximum number of bottom blobs. + */ + virtual inline int MaxBottomBlobs() const { return -1; } + /** + * @brief Returns the exact number of top blobs required by the layer, + * or -1 if no exact number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some exact number of top blobs. + */ + virtual inline int ExactNumTopBlobs() const { return -1; } + /** + * @brief Returns the minimum number of top blobs required by the layer, + * or -1 if no minimum number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some minimum number of top blobs. + */ + virtual inline int MinTopBlobs() const { return -1; } + /** + * @brief Returns the maximum number of top blobs required by the layer, + * or -1 if no maximum number is required. + * + * This method should be overridden to return a non-negative value if your + * layer expects some maximum number of top blobs. + */ + virtual inline int MaxTopBlobs() const { return -1; } + /** + * @brief Returns true if the layer requires an equal number of bottom and + * top blobs. + * + * This method should be overridden to return true if your layer expects an + * equal number of bottom and top blobs. + */ + virtual inline bool EqualNumBottomTopBlobs() const { return false; } + + /** + * @brief Return whether "anonymous" top blobs are created automatically + * by the layer. + * + * If this method returns true, Net::Init will create enough "anonymous" top + * blobs to fulfill the requirement specified by ExactNumTopBlobs() or + * MinTopBlobs(). + */ + virtual inline bool AutoTopBlobs() const { return false; } + + /** + * @brief Return whether to allow force_backward for a given bottom blob + * index. + * + * If AllowForceBackward(i) == false, we will ignore the force_backward + * setting and backpropagate to blob i only if it needs gradient information + * (as is done when force_backward == false). + */ + virtual inline bool AllowForceBackward(const int bottom_index) const { + return true; + } + + /** + * @brief Specifies whether the layer should compute gradients w.r.t. a + * parameter at a particular index given by param_id. + * + * You can safely ignore false values and always compute gradients + * for all parameters, but possibly with wasteful computation. + */ + inline bool param_propagate_down(const int param_id) { + return (param_propagate_down_.size() > param_id) ? + param_propagate_down_[param_id] : false; + } + /** + * @brief Sets whether the layer should compute gradients w.r.t. a + * parameter at a particular index given by param_id. + */ + inline void set_param_propagate_down(const int param_id, const bool value) { + if (param_propagate_down_.size() <= param_id) { + param_propagate_down_.resize(param_id + 1, true); + } + param_propagate_down_[param_id] = value; + } + + + protected: + /** The protobuf that stores the layer parameters */ + LayerParameter layer_param_; + /** The phase: TRAIN or TEST */ + Phase phase_; + /** The vector that stores the learnable parameters as a set of blobs. */ + vector > > blobs_; + /** Vector indicating whether to compute the diff of each param blob. */ + vector param_propagate_down_; + + /** The vector that indicates whether each top blob has a non-zero weight in + * the objective function. */ + vector loss_; + + /** @brief Using the CPU device, compute the layer output. */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) = 0; + /** + * @brief Using the GPU device, compute the layer output. + * Fall back to Forward_cpu() if unavailable. + */ + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top) { + // LOG(WARNING) << "Using CPU code as backup."; + return Forward_cpu(bottom, top); + } + + /** + * @brief Using the CPU device, compute the gradients for any parameters and + * for the bottom blobs if propagate_down is true. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, + const vector*>& bottom) = 0; + /** + * @brief Using the GPU device, compute the gradients for any parameters and + * for the bottom blobs if propagate_down is true. + * Fall back to Backward_cpu() if unavailable. + */ + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, + const vector*>& bottom) { + // LOG(WARNING) << "Using CPU code as backup."; + Backward_cpu(top, propagate_down, bottom); + } + + /** + * Called by the parent Layer's SetUp to check that the number of bottom + * and top Blobs provided as input match the expected numbers specified by + * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions. + */ + virtual void CheckBlobCounts(const vector*>& bottom, + const vector*>& top) { + if (ExactNumBottomBlobs() >= 0) { + CHECK_EQ(ExactNumBottomBlobs(), bottom.size()) + << type() << " Layer takes " << ExactNumBottomBlobs() + << " bottom blob(s) as input."; + } + if (MinBottomBlobs() >= 0) { + CHECK_LE(MinBottomBlobs(), bottom.size()) + << type() << " Layer takes at least " << MinBottomBlobs() + << " bottom blob(s) as input."; + } + if (MaxBottomBlobs() >= 0) { + CHECK_GE(MaxBottomBlobs(), bottom.size()) + << type() << " Layer takes at most " << MaxBottomBlobs() + << " bottom blob(s) as input."; + } + if (ExactNumTopBlobs() >= 0) { + CHECK_EQ(ExactNumTopBlobs(), top.size()) + << type() << " Layer produces " << ExactNumTopBlobs() + << " top blob(s) as output."; + } + if (MinTopBlobs() >= 0) { + CHECK_LE(MinTopBlobs(), top.size()) + << type() << " Layer produces at least " << MinTopBlobs() + << " top blob(s) as output."; + } + if (MaxTopBlobs() >= 0) { + CHECK_GE(MaxTopBlobs(), top.size()) + << type() << " Layer produces at most " << MaxTopBlobs() + << " top blob(s) as output."; + } + if (EqualNumBottomTopBlobs()) { + CHECK_EQ(bottom.size(), top.size()) + << type() << " Layer produces one top blob as output for each " + << "bottom blob input."; + } + } + + /** + * Called by SetUp to initialize the weights associated with any top blobs in + * the loss function. Store non-zero loss weights in the diff blob. + */ + inline void SetLossWeights(const vector*>& top) { + const int num_loss_weights = layer_param_.loss_weight_size(); + if (num_loss_weights) { + CHECK_EQ(top.size(), num_loss_weights) << "loss_weight must be " + "unspecified or specified once per top blob."; + for (int top_id = 0; top_id < top.size(); ++top_id) { + const Dtype loss_weight = layer_param_.loss_weight(top_id); + if (loss_weight == Dtype(0)) { continue; } + this->set_loss(top_id, loss_weight); + const int count = top[top_id]->count(); + Dtype* loss_multiplier = top[top_id]->mutable_cpu_diff(); + caffe_set(count, loss_weight, loss_multiplier); + } + } + } + + private: + DISABLE_COPY_AND_ASSIGN(Layer); +}; // class Layer + +// Forward and backward wrappers. You should implement the cpu and +// gpu specific implementations instead, and should not change these +// functions. +template +inline Dtype Layer::Forward(const vector*>& bottom, + const vector*>& top) { + Dtype loss = 0; + Reshape(bottom, top); + switch (Caffe::mode()) { + case Caffe::CPU: + Forward_cpu(bottom, top); + for (int top_id = 0; top_id < top.size(); ++top_id) { + if (!this->loss(top_id)) { continue; } + const int count = top[top_id]->count(); + const Dtype* data = top[top_id]->cpu_data(); + const Dtype* loss_weights = top[top_id]->cpu_diff(); + loss += caffe_cpu_dot(count, data, loss_weights); + } + break; + case Caffe::GPU: + Forward_gpu(bottom, top); +#ifndef CPU_ONLY + for (int top_id = 0; top_id < top.size(); ++top_id) { + if (!this->loss(top_id)) { continue; } + const int count = top[top_id]->count(); + const Dtype* data = top[top_id]->gpu_data(); + const Dtype* loss_weights = top[top_id]->gpu_diff(); + Dtype blob_loss = 0; + caffe_gpu_dot(count, data, loss_weights, &blob_loss); + loss += blob_loss; + } +#endif + break; + default: + LOG(FATAL) << "Unknown caffe mode."; + } + return loss; +} + +template +inline void Layer::Backward(const vector*>& top, + const vector& propagate_down, + const vector*>& bottom) { + switch (Caffe::mode()) { + case Caffe::CPU: + Backward_cpu(top, propagate_down, bottom); + break; + case Caffe::GPU: + Backward_gpu(top, propagate_down, bottom); + break; + default: + LOG(FATAL) << "Unknown caffe mode."; + } +} + +// Serialize LayerParameter to protocol buffer +template +void Layer::ToProto(LayerParameter* param, bool write_diff) { + param->Clear(); + param->CopyFrom(layer_param_); + param->clear_blobs(); + for (int i = 0; i < blobs_.size(); ++i) { + blobs_[i]->ToProto(param->add_blobs(), write_diff); + } +} + +} // namespace caffe + +#endif // CAFFE_LAYER_H_ diff --git a/usr/local/include/caffe/layer_factory.hpp b/usr/local/include/caffe/layer_factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2369c132911861fcb6b4aad6096994c561a7e5c4 --- /dev/null +++ b/usr/local/include/caffe/layer_factory.hpp @@ -0,0 +1,141 @@ +/** + * @brief A layer factory that allows one to register layers. + * During runtime, registered layers can be called by passing a LayerParameter + * protobuffer to the CreateLayer function: + * + * LayerRegistry::CreateLayer(param); + * + * There are two ways to register a layer. Assuming that we have a layer like: + * + * template + * class MyAwesomeLayer : public Layer { + * // your implementations + * }; + * + * and its type is its C++ class name, but without the "Layer" at the end + * ("MyAwesomeLayer" -> "MyAwesome"). + * + * If the layer is going to be created simply by its constructor, in your c++ + * file, add the following line: + * + * REGISTER_LAYER_CLASS(MyAwesome); + * + * Or, if the layer is going to be created by another creator function, in the + * format of: + * + * template + * Layer GetMyAwesomeLayer(const LayerParameter& param) { + * // your implementation + * } + * + * (for example, when your layer has multiple backends, see GetConvolutionLayer + * for a use case), then you can register the creator function instead, like + * + * REGISTER_LAYER_CREATOR(MyAwesome, GetMyAwesomeLayer) + * + * Note that each layer type should only be registered once. + */ + +#ifndef CAFFE_LAYER_FACTORY_H_ +#define CAFFE_LAYER_FACTORY_H_ + +#include +#include +#include + +#include "caffe/common.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +template +class Layer; + +template +class LayerRegistry { + public: + typedef shared_ptr > (*Creator)(const LayerParameter&); + typedef std::map CreatorRegistry; + + static CreatorRegistry& Registry() { + static CreatorRegistry* g_registry_ = new CreatorRegistry(); + return *g_registry_; + } + + // Adds a creator. + static void AddCreator(const string& type, Creator creator) { + CreatorRegistry& registry = Registry(); + CHECK_EQ(registry.count(type), 0) + << "Layer type " << type << " already registered."; + registry[type] = creator; + } + + // Get a layer using a LayerParameter. + static shared_ptr > CreateLayer(const LayerParameter& param) { + if (Caffe::root_solver()) { + LOG(INFO) << "Creating layer " << param.name(); + } + const string& type = param.type(); + CreatorRegistry& registry = Registry(); + CHECK_EQ(registry.count(type), 1) << "Unknown layer type: " << type + << " (known types: " << LayerTypeListString() << ")"; + return registry[type](param); + } + + static vector LayerTypeList() { + CreatorRegistry& registry = Registry(); + vector layer_types; + for (typename CreatorRegistry::iterator iter = registry.begin(); + iter != registry.end(); ++iter) { + layer_types.push_back(iter->first); + } + return layer_types; + } + + private: + // Layer registry should never be instantiated - everything is done with its + // static variables. + LayerRegistry() {} + + static string LayerTypeListString() { + vector layer_types = LayerTypeList(); + string layer_types_str; + for (vector::iterator iter = layer_types.begin(); + iter != layer_types.end(); ++iter) { + if (iter != layer_types.begin()) { + layer_types_str += ", "; + } + layer_types_str += *iter; + } + return layer_types_str; + } +}; + + +template +class LayerRegisterer { + public: + LayerRegisterer(const string& type, + shared_ptr > (*creator)(const LayerParameter&)) { + // LOG(INFO) << "Registering layer type: " << type; + LayerRegistry::AddCreator(type, creator); + } +}; + + +#define REGISTER_LAYER_CREATOR(type, creator) \ + static LayerRegisterer g_creator_f_##type(#type, creator); \ + static LayerRegisterer g_creator_d_##type(#type, creator) \ + +#define REGISTER_LAYER_CLASS(type) \ + template \ + shared_ptr > Creator_##type##Layer(const LayerParameter& param) \ + { \ + return shared_ptr >(new type##Layer(param)); \ + } \ + REGISTER_LAYER_CREATOR(type, Creator_##type##Layer) + +} // namespace caffe + +#endif // CAFFE_LAYER_FACTORY_H_ diff --git a/usr/local/include/caffe/layers/absval_layer.hpp b/usr/local/include/caffe/layers/absval_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b5305dceb4d7057fb6ac457275a5013927bf7dd --- /dev/null +++ b/usr/local/include/caffe/layers/absval_layer.hpp @@ -0,0 +1,68 @@ +#ifndef CAFFE_ABSVAL_LAYER_HPP_ +#define CAFFE_ABSVAL_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Computes @f$ y = |x| @f$ + * + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ y = |x| @f$ + */ +template +class AbsValLayer : public NeuronLayer { + public: + explicit AbsValLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "AbsVal"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /// @copydoc AbsValLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the absolute value inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = + * \mathrm{sign}(x) \frac{\partial E}{\partial y} + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_ABSVAL_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/accuracy_layer.hpp b/usr/local/include/caffe/layers/accuracy_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dd2247b9e4d3fb71d8f619ef03aa53059ceb79dd --- /dev/null +++ b/usr/local/include/caffe/layers/accuracy_layer.hpp @@ -0,0 +1,99 @@ +#ifndef CAFFE_ACCURACY_LAYER_HPP_ +#define CAFFE_ACCURACY_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the classification accuracy for a one-of-many + * classification task. + */ +template +class AccuracyLayer : public Layer { + public: + /** + * @param param provides AccuracyParameter accuracy_param, + * with AccuracyLayer options: + * - top_k (\b optional, default 1). + * Sets the maximum rank @f$ k @f$ at which a prediction is considered + * correct. For example, if @f$ k = 5 @f$, a prediction is counted + * correct if the correct label is among the top 5 predicted labels. + */ + explicit AccuracyLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Accuracy"; } + virtual inline int ExactNumBottomBlobs() const { return 2; } + + // If there are two top blobs, then the second blob will contain + // accuracies per class. + virtual inline int MinTopBlobs() const { return 1; } + virtual inline int MaxTopBlobs() const { return 2; } + + protected: + /** + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ x @f$, a Blob with values in + * @f$ [-\infty, +\infty] @f$ indicating the predicted score for each of + * the @f$ K = CHW @f$ classes. Each @f$ x_n @f$ is mapped to a predicted + * label @f$ \hat{l}_n @f$ given by its maximal index: + * @f$ \hat{l}_n = \arg\max\limits_k x_{nk} @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels @f$ l @f$, an integer-valued Blob with values + * @f$ l_n \in [0, 1, 2, ..., K - 1] @f$ + * indicating the correct class label among the @f$ K @f$ classes + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed accuracy: @f$ + * \frac{1}{N} \sum\limits_{n=1}^N \delta\{ \hat{l}_n = l_n \} + * @f$, where @f$ + * \delta\{\mathrm{condition}\} = \left\{ + * \begin{array}{lr} + * 1 & \mbox{if condition} \\ + * 0 & \mbox{otherwise} + * \end{array} \right. + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + + /// @brief Not implemented -- AccuracyLayer cannot be used as a loss. + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) { + for (int i = 0; i < propagate_down.size(); ++i) { + if (propagate_down[i]) { NOT_IMPLEMENTED; } + } + } + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int label_axis_, outer_num_, inner_num_; + + int top_k_; + + /// Whether to ignore instances with a certain label. + bool has_ignore_label_; + /// The label indicating that an instance should be ignored. + int ignore_label_; + /// Keeps counts of the number of samples per class. + Blob nums_buffer_; +}; + +} // namespace caffe + +#endif // CAFFE_ACCURACY_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/argmax_layer.hpp b/usr/local/include/caffe/layers/argmax_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4fef363e85040fbd6052af6712469a2bb00f1fc7 --- /dev/null +++ b/usr/local/include/caffe/layers/argmax_layer.hpp @@ -0,0 +1,77 @@ +#ifndef CAFFE_ARGMAX_LAYER_HPP_ +#define CAFFE_ARGMAX_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Compute the index of the @f$ K @f$ max values for each datum across + * all dimensions @f$ (C \times H \times W) @f$. + * + * Intended for use after a classification layer to produce a prediction. + * If parameter out_max_val is set to true, output is a vector of pairs + * (max_ind, max_val) for each image. The axis parameter specifies an axis + * along which to maximise. + * + * NOTE: does not implement Backwards operation. + */ +template +class ArgMaxLayer : public Layer { + public: + /** + * @param param provides ArgMaxParameter argmax_param, + * with ArgMaxLayer options: + * - top_k (\b optional uint, default 1). + * the number @f$ K @f$ of maximal items to output. + * - out_max_val (\b optional bool, default false). + * if set, output a vector of pairs (max_ind, max_val) unless axis is set then + * output max_val along the specified axis. + * - axis (\b optional int). + * if set, maximise along the specified axis else maximise the flattened + * trailing dimensions for each index of the first / num dimension. + */ + explicit ArgMaxLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "ArgMax"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times 1 \times K) @f$ or, if out_max_val + * @f$ (N \times 2 \times K) @f$ unless axis set than e.g. + * @f$ (N \times K \times H \times W) @f$ if axis == 1 + * the computed outputs @f$ + * y_n = \arg\max\limits_i x_{ni} + * @f$ (for @f$ K = 1 @f$). + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + /// @brief Not implemented (non-differentiable function) + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) { + NOT_IMPLEMENTED; + } + bool out_max_val_; + size_t top_k_; + bool has_axis_; + int axis_; +}; + +} // namespace caffe + +#endif // CAFFE_ARGMAX_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/base_conv_layer.hpp b/usr/local/include/caffe/layers/base_conv_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0160a833dd2da637088fa383fe06f6f95e70048e --- /dev/null +++ b/usr/local/include/caffe/layers/base_conv_layer.hpp @@ -0,0 +1,174 @@ +#ifndef CAFFE_BASE_CONVOLUTION_LAYER_HPP_ +#define CAFFE_BASE_CONVOLUTION_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/im2col.hpp" + +namespace caffe { + +/** + * @brief Abstract base class that factors out the BLAS code common to + * ConvolutionLayer and DeconvolutionLayer. + */ +template +class BaseConvolutionLayer : public Layer { + public: + explicit BaseConvolutionLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline int MinBottomBlobs() const { return 1; } + virtual inline int MinTopBlobs() const { return 1; } + virtual inline bool EqualNumBottomTopBlobs() const { return true; } + + protected: + // Helper functions that abstract away the column buffer and gemm arguments. + // The last argument in forward_cpu_gemm is so that we can skip the im2col if + // we just called weight_cpu_gemm with the same input. + void forward_cpu_gemm(const Dtype* input, const Dtype* weights, + Dtype* output, bool skip_im2col = false); + void forward_cpu_bias(Dtype* output, const Dtype* bias); + void backward_cpu_gemm(const Dtype* input, const Dtype* weights, + Dtype* output); + void weight_cpu_gemm(const Dtype* input, const Dtype* output, Dtype* + weights); + void backward_cpu_bias(Dtype* bias, const Dtype* input); + +#ifndef CPU_ONLY + void forward_gpu_gemm(const Dtype* col_input, const Dtype* weights, + Dtype* output, bool skip_im2col = false); + void forward_gpu_bias(Dtype* output, const Dtype* bias); + void backward_gpu_gemm(const Dtype* input, const Dtype* weights, + Dtype* col_output); + void weight_gpu_gemm(const Dtype* col_input, const Dtype* output, Dtype* + weights); + void backward_gpu_bias(Dtype* bias, const Dtype* input); +#endif + + /// @brief The spatial dimensions of the input. + inline int input_shape(int i) { + return (*bottom_shape_)[channel_axis_ + i]; + } + // reverse_dimensions should return true iff we are implementing deconv, so + // that conv helpers know which dimensions are which. + virtual bool reverse_dimensions() = 0; + // Compute height_out_ and width_out_ from other parameters. + virtual void compute_output_shape() = 0; + + /// @brief The spatial dimensions of a filter kernel. + Blob kernel_shape_; + /// @brief The spatial dimensions of the stride. + Blob stride_; + /// @brief The spatial dimensions of the padding. + Blob pad_; + /// @brief The spatial dimensions of the dilation. + Blob dilation_; + /// @brief The spatial dimensions of the convolution input. + Blob conv_input_shape_; + /// @brief The spatial dimensions of the col_buffer. + vector col_buffer_shape_; + /// @brief The spatial dimensions of the output. + vector output_shape_; + const vector* bottom_shape_; + + int num_spatial_axes_; + int bottom_dim_; + int top_dim_; + + int channel_axis_; + int num_; + int channels_; + int group_; + int out_spatial_dim_; + int weight_offset_; + int num_output_; + bool bias_term_; + bool is_1x1_; + bool force_nd_im2col_; + + private: + // wrap im2col/col2im so we don't have to remember the (long) argument lists + inline void conv_im2col_cpu(const Dtype* data, Dtype* col_buff) { + if (!force_nd_im2col_ && num_spatial_axes_ == 2) { + im2col_cpu(data, conv_in_channels_, + conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], + kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], + pad_.cpu_data()[0], pad_.cpu_data()[1], + stride_.cpu_data()[0], stride_.cpu_data()[1], + dilation_.cpu_data()[0], dilation_.cpu_data()[1], col_buff); + } else { + im2col_nd_cpu(data, num_spatial_axes_, conv_input_shape_.cpu_data(), + col_buffer_shape_.data(), kernel_shape_.cpu_data(), + pad_.cpu_data(), stride_.cpu_data(), dilation_.cpu_data(), col_buff); + } + } + inline void conv_col2im_cpu(const Dtype* col_buff, Dtype* data) { + if (!force_nd_im2col_ && num_spatial_axes_ == 2) { + col2im_cpu(col_buff, conv_in_channels_, + conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], + kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], + pad_.cpu_data()[0], pad_.cpu_data()[1], + stride_.cpu_data()[0], stride_.cpu_data()[1], + dilation_.cpu_data()[0], dilation_.cpu_data()[1], data); + } else { + col2im_nd_cpu(col_buff, num_spatial_axes_, conv_input_shape_.cpu_data(), + col_buffer_shape_.data(), kernel_shape_.cpu_data(), + pad_.cpu_data(), stride_.cpu_data(), dilation_.cpu_data(), data); + } + } +#ifndef CPU_ONLY + inline void conv_im2col_gpu(const Dtype* data, Dtype* col_buff) { + if (!force_nd_im2col_ && num_spatial_axes_ == 2) { + im2col_gpu(data, conv_in_channels_, + conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], + kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], + pad_.cpu_data()[0], pad_.cpu_data()[1], + stride_.cpu_data()[0], stride_.cpu_data()[1], + dilation_.cpu_data()[0], dilation_.cpu_data()[1], col_buff); + } else { + im2col_nd_gpu(data, num_spatial_axes_, num_kernels_im2col_, + conv_input_shape_.gpu_data(), col_buffer_.gpu_shape(), + kernel_shape_.gpu_data(), pad_.gpu_data(), + stride_.gpu_data(), dilation_.gpu_data(), col_buff); + } + } + inline void conv_col2im_gpu(const Dtype* col_buff, Dtype* data) { + if (!force_nd_im2col_ && num_spatial_axes_ == 2) { + col2im_gpu(col_buff, conv_in_channels_, + conv_input_shape_.cpu_data()[1], conv_input_shape_.cpu_data()[2], + kernel_shape_.cpu_data()[0], kernel_shape_.cpu_data()[1], + pad_.cpu_data()[0], pad_.cpu_data()[1], + stride_.cpu_data()[0], stride_.cpu_data()[1], + dilation_.cpu_data()[0], dilation_.cpu_data()[1], data); + } else { + col2im_nd_gpu(col_buff, num_spatial_axes_, num_kernels_col2im_, + conv_input_shape_.gpu_data(), col_buffer_.gpu_shape(), + kernel_shape_.gpu_data(), pad_.gpu_data(), stride_.gpu_data(), + dilation_.gpu_data(), data); + } + } +#endif + + int num_kernels_im2col_; + int num_kernels_col2im_; + int conv_out_channels_; + int conv_in_channels_; + int conv_out_spatial_dim_; + int kernel_dim_; + int col_offset_; + int output_offset_; + + Blob col_buffer_; + Blob bias_multiplier_; +}; + +} // namespace caffe + +#endif // CAFFE_BASE_CONVOLUTION_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/base_data_layer.hpp b/usr/local/include/caffe/layers/base_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c8b6998c8f20aacd8ae9777dc9182bf14bcbaa1d --- /dev/null +++ b/usr/local/include/caffe/layers/base_data_layer.hpp @@ -0,0 +1,82 @@ +#ifndef CAFFE_DATA_LAYERS_HPP_ +#define CAFFE_DATA_LAYERS_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/data_transformer.hpp" +#include "caffe/internal_thread.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/blocking_queue.hpp" + +namespace caffe { + +/** + * @brief Provides base for data layers that feed blobs to the Net. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class BaseDataLayer : public Layer { + public: + explicit BaseDataLayer(const LayerParameter& param); + // LayerSetUp: implements common data layer setup functionality, and calls + // DataLayerSetUp to do special data layer setup for individual layer types. + // This method may not be overridden except by the BasePrefetchingDataLayer. + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void DataLayerSetUp(const vector*>& bottom, + const vector*>& top) {} + // Data layers have no bottoms, so reshaping is trivial. + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + + protected: + TransformationParameter transform_param_; + shared_ptr > data_transformer_; + bool output_labels_; +}; + +template +class Batch { + public: + Blob data_, label_; +}; + +template +class BasePrefetchingDataLayer : + public BaseDataLayer, public InternalThread { + public: + explicit BasePrefetchingDataLayer(const LayerParameter& param); + // LayerSetUp: implements common data layer setup functionality, and calls + // DataLayerSetUp to do special data layer setup for individual layer types. + // This method may not be overridden. + void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + protected: + virtual void InternalThreadEntry(); + virtual void load_batch(Batch* batch) = 0; + + vector > > prefetch_; + BlockingQueue*> prefetch_free_; + BlockingQueue*> prefetch_full_; + Batch* prefetch_current_; + + Blob transformed_data_; +}; + +} // namespace caffe + +#endif // CAFFE_DATA_LAYERS_HPP_ diff --git a/usr/local/include/caffe/layers/batch_norm_layer.hpp b/usr/local/include/caffe/layers/batch_norm_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..43f7b28be9513e0282edbac167ecb56d36485728 --- /dev/null +++ b/usr/local/include/caffe/layers/batch_norm_layer.hpp @@ -0,0 +1,78 @@ +#ifndef CAFFE_BATCHNORM_LAYER_HPP_ +#define CAFFE_BATCHNORM_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Normalizes the input to have 0-mean and/or unit (1) variance across + * the batch. + * + * This layer computes Batch Normalization as described in [1]. For each channel + * in the data (i.e. axis 1), it subtracts the mean and divides by the variance, + * where both statistics are computed across both spatial dimensions and across + * the different examples in the batch. + * + * By default, during training time, the network is computing global + * mean/variance statistics via a running average, which is then used at test + * time to allow deterministic outputs for each input. You can manually toggle + * whether the network is accumulating or using the statistics via the + * use_global_stats option. For reference, these statistics are kept in the + * layer's three blobs: (0) mean, (1) variance, and (2) moving average factor. + * + * Note that the original paper also included a per-channel learned bias and + * scaling factor. To implement this in Caffe, define a `ScaleLayer` configured + * with `bias_term: true` after each `BatchNormLayer` to handle both the bias + * and scaling factor. + * + * [1] S. Ioffe and C. Szegedy, "Batch Normalization: Accelerating Deep Network + * Training by Reducing Internal Covariate Shift." arXiv preprint + * arXiv:1502.03167 (2015). + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class BatchNormLayer : public Layer { + public: + explicit BatchNormLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "BatchNorm"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Blob mean_, variance_, temp_, x_norm_; + bool use_global_stats_; + Dtype moving_average_fraction_; + int channels_; + Dtype eps_; + + // extra temporarary variables is used to carry out sums/broadcasting + // using BLAS + Blob batch_sum_multiplier_; + Blob num_by_chans_; + Blob spatial_sum_multiplier_; +}; + +} // namespace caffe + +#endif // CAFFE_BATCHNORM_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/batch_reindex_layer.hpp b/usr/local/include/caffe/layers/batch_reindex_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ebb3a567bc4e56be6d6c8eba781e518e317dbfc0 --- /dev/null +++ b/usr/local/include/caffe/layers/batch_reindex_layer.hpp @@ -0,0 +1,83 @@ +#ifndef CAFFE_BATCHREINDEX_LAYER_HPP_ +#define CAFFE_BATCHREINDEX_LAYER_HPP_ + +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Index into the input blob along its first axis. + * + * This layer can be used to select, reorder, and even replicate examples in a + * batch. The second blob is cast to int and treated as an index into the + * first axis of the first blob. + */ +template +class BatchReindexLayer : public Layer { + public: + explicit BatchReindexLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "BatchReindex"; } + virtual inline int ExactNumBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /** + * @param bottom input Blob vector (length 2+) + * -# @f$ (N \times ...) @f$ + * the inputs @f$ x_1 @f$ + * -# @f$ (M) @f$ + * the inputs @f$ x_2 @f$ + * @param top output Blob vector (length 1) + * -# @f$ (M \times ...) @f$: + * the reindexed array @f$ + * y = x_1[x_2] + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the reordered input. + * + * @param top output Blob vector (length 1), providing the error gradient + * with respect to the outputs + * -# @f$ (M \times ...) @f$: + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to concatenated outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2): + * - @f$ \frac{\partial E}{\partial y} @f$ is de-indexed (summing where + * required) back to the input x_1 + * - This layer cannot backprop to x_2, i.e. propagate_down[1] must be + * false. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + private: + struct pair_sort_first { + bool operator()(const std::pair &left, + const std::pair &right) { + return left.first < right.first; + } + }; + void check_batch_reindex(int initial_num, int final_num, + const Dtype* ridx_data); +}; + +} // namespace caffe + +#endif // CAFFE_BATCHREINDEX_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/bias_layer.hpp b/usr/local/include/caffe/layers/bias_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9639c9cdc8a9e61b01cd8bf8f5de9b144c6ebafe --- /dev/null +++ b/usr/local/include/caffe/layers/bias_layer.hpp @@ -0,0 +1,54 @@ +#ifndef CAFFE_BIAS_LAYER_HPP_ +#define CAFFE_BIAS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Computes a sum of two input Blobs, with the shape of the latter Blob + * "broadcast" to match the shape of the former. Equivalent to tiling + * the latter Blob, then computing the elementwise sum. + * + * The second input may be omitted, in which case it's learned as a parameter + * of the layer. Note: in case bias and scaling are desired, both operations can + * be handled by `ScaleLayer` configured with `bias_term: true`. + */ +template +class BiasLayer : public Layer { + public: + explicit BiasLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Bias"; } + virtual inline int MinBottomBlobs() const { return 1; } + virtual inline int MaxBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + private: + Blob bias_multiplier_; + int outer_dim_, bias_dim_, inner_dim_, dim_; +}; + + + +} // namespace caffe + +#endif // CAFFE_BIAS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/bnll_layer.hpp b/usr/local/include/caffe/layers/bnll_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..be07c748364d26e8385a90cf3fa93cacb9c3a67e --- /dev/null +++ b/usr/local/include/caffe/layers/bnll_layer.hpp @@ -0,0 +1,70 @@ +#ifndef CAFFE_BNLL_LAYER_HPP_ +#define CAFFE_BNLL_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Computes @f$ y = x + \log(1 + \exp(-x)) @f$ if @f$ x > 0 @f$; + * @f$ y = \log(1 + \exp(x)) @f$ otherwise. + * + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \left\{ + * \begin{array}{ll} + * x + \log(1 + \exp(-x)) & \mbox{if } x > 0 \\ + * \log(1 + \exp(x)) & \mbox{otherwise} + * \end{array} \right. + * @f$ + */ +template +class BNLLLayer : public NeuronLayer { + public: + explicit BNLLLayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "BNLL"; } + + protected: + /// @copydoc BNLLLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the BNLL inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_BNLL_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/clip_layer.hpp b/usr/local/include/caffe/layers/clip_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2788193e3ecde59154adf544ff5b60e2300e6dd9 --- /dev/null +++ b/usr/local/include/caffe/layers/clip_layer.hpp @@ -0,0 +1,75 @@ +#ifndef CAFFE_CLIP_LAYER_HPP_ +#define CAFFE_CLIP_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Clip: @f$ y = \max(min, \min(max, x)) @f$. + */ +template +class ClipLayer : public NeuronLayer { + public: + /** + * @param param provides ClipParameter clip_param, + * with ClipLayer options: + * - min + * - max + */ + explicit ClipLayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "Clip"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \max(min, \min(max, x)) + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the clipped inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = \left\{ + * \begin{array}{lr} + * 0 & \mathrm{if} \; x < min \vee x > max \\ + * \frac{\partial E}{\partial y} & \mathrm{if} \; x \ge min \wedge x \le max + * \end{array} \right. + * @f$ + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_CLIP_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/concat_layer.hpp b/usr/local/include/caffe/layers/concat_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a157024919720d3d615cad4efda025d49ddd35c0 --- /dev/null +++ b/usr/local/include/caffe/layers/concat_layer.hpp @@ -0,0 +1,87 @@ +#ifndef CAFFE_CONCAT_LAYER_HPP_ +#define CAFFE_CONCAT_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Takes at least two Blob%s and concatenates them along either the num + * or channel dimension, outputting the result. + */ +template +class ConcatLayer : public Layer { + public: + explicit ConcatLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Concat"; } + virtual inline int MinBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /** + * @param bottom input Blob vector (length 2+) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x_1 @f$ + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x_2 @f$ + * -# ... + * - K @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x_K @f$ + * @param top output Blob vector (length 1) + * -# @f$ (KN \times C \times H \times W) @f$ if axis == 0, or + * @f$ (N \times KC \times H \times W) @f$ if axis == 1: + * the concatenated output @f$ + * y = [\begin{array}{cccc} x_1 & x_2 & ... & x_K \end{array}] + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the concatenate inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (KN \times C \times H \times W) @f$ if axis == 0, or + * @f$ (N \times KC \times H \times W) @f$ if axis == 1: + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to concatenated outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length K), into which the top gradient + * @f$ \frac{\partial E}{\partial y} @f$ is deconcatenated back to the + * inputs @f$ + * \left[ \begin{array}{cccc} + * \frac{\partial E}{\partial x_1} & + * \frac{\partial E}{\partial x_2} & + * ... & + * \frac{\partial E}{\partial x_K} + * \end{array} \right] = + * \frac{\partial E}{\partial y} + * @f$ + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int count_; + int num_concats_; + int concat_input_size_; + int concat_axis_; +}; + +} // namespace caffe + +#endif // CAFFE_CONCAT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/contrastive_loss_layer.hpp b/usr/local/include/caffe/layers/contrastive_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e890afb82075c232b7feedea37a4b724196e2bed --- /dev/null +++ b/usr/local/include/caffe/layers/contrastive_loss_layer.hpp @@ -0,0 +1,101 @@ +#ifndef CAFFE_CONTRASTIVE_LOSS_LAYER_HPP_ +#define CAFFE_CONTRASTIVE_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the contrastive loss @f$ + * E = \frac{1}{2N} \sum\limits_{n=1}^N \left(y\right) d^2 + + * \left(1-y\right) \max \left(margin-d, 0\right)^2 + * @f$ where @f$ + * d = \left| \left| a_n - b_n \right| \right|_2 @f$. This can be + * used to train siamese networks. + * + * @param bottom input Blob vector (length 3) + * -# @f$ (N \times C \times 1 \times 1) @f$ + * the features @f$ a \in [-\infty, +\infty]@f$ + * -# @f$ (N \times C \times 1 \times 1) @f$ + * the features @f$ b \in [-\infty, +\infty]@f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the binary similarity @f$ s \in [0, 1]@f$ + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed contrastive loss: @f$ E = + * \frac{1}{2N} \sum\limits_{n=1}^N \left(y\right) d^2 + + * \left(1-y\right) \max \left(margin-d, 0\right)^2 + * @f$ where @f$ + * d = \left| \left| a_n - b_n \right| \right|_2 @f$. + * This can be used to train siamese networks. + */ +template +class ContrastiveLossLayer : public LossLayer { + public: + explicit ContrastiveLossLayer(const LayerParameter& param) + : LossLayer(param), diff_() {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline int ExactNumBottomBlobs() const { return 3; } + virtual inline const char* type() const { return "ContrastiveLoss"; } + /** + * Unlike most loss layers, in the ContrastiveLossLayer we can backpropagate + * to the first two inputs. + */ + virtual inline bool AllowForceBackward(const int bottom_index) const { + return bottom_index != 2; + } + + protected: + /// @copydoc ContrastiveLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the Contrastive error gradient w.r.t. the inputs. + * + * Computes the gradients with respect to the two input vectors (bottom[0] and + * bottom[1]), but not the similarity label (bottom[2]). + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times 1 \times 1) @f$ + * the features @f$a@f$; Backward fills their diff with + * gradients if propagate_down[0] + * -# @f$ (N \times C \times 1 \times 1) @f$ + * the features @f$b@f$; Backward fills their diff with gradients if + * propagate_down[1] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Blob diff_; // cached for backward pass + Blob dist_sq_; // cached for backward pass + Blob diff_sq_; // tmp storage for gpu forward pass + Blob summer_vec_; // tmp storage for gpu forward pass +}; + +} // namespace caffe + +#endif // CAFFE_CONTRASTIVE_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/conv_layer.hpp b/usr/local/include/caffe/layers/conv_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..93a618ddd72a1167d8b4d54a775aa0e4e8f01165 --- /dev/null +++ b/usr/local/include/caffe/layers/conv_layer.hpp @@ -0,0 +1,84 @@ +#ifndef CAFFE_CONV_LAYER_HPP_ +#define CAFFE_CONV_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/base_conv_layer.hpp" + +namespace caffe { + +/** + * @brief Convolves the input image with a bank of learned filters, + * and (optionally) adds biases. + * + * Caffe convolves by reduction to matrix multiplication. This achieves + * high-throughput and generality of input and filter dimensions but comes at + * the cost of memory for matrices. This makes use of efficiency in BLAS. + * + * The input is "im2col" transformed to a channel K' x H x W data matrix + * for multiplication with the N x K' x H x W filter matrix to yield a + * N' x H x W output matrix that is then "col2im" restored. K' is the + * input channel * kernel height * kernel width dimension of the unrolled + * inputs so that the im2col matrix has a column for each input region to + * be filtered. col2im restores the output spatial structure by rolling up + * the output channel N' columns of the output matrix. + */ +template +class ConvolutionLayer : public BaseConvolutionLayer { + public: + /** + * @param param provides ConvolutionParameter convolution_param, + * with ConvolutionLayer options: + * - num_output. The number of filters. + * - kernel_size / kernel_h / kernel_w. The filter dimensions, given by + * kernel_size for square filters or kernel_h and kernel_w for rectangular + * filters. + * - stride / stride_h / stride_w (\b optional, default 1). The filter + * stride, given by stride_size for equal dimensions or stride_h and stride_w + * for different strides. By default the convolution is dense with stride 1. + * - pad / pad_h / pad_w (\b optional, default 0). The zero-padding for + * convolution, given by pad for equal dimensions or pad_h and pad_w for + * different padding. Input padding is computed implicitly instead of + * actually padding. + * - dilation (\b optional, default 1). The filter + * dilation, given by dilation_size for equal dimensions for different + * dilation. By default the convolution has dilation 1. + * - group (\b optional, default 1). The number of filter groups. Group + * convolution is a method for reducing parameterization by selectively + * connecting input and output channels. The input and output channel dimensions must be divisible + * by the number of groups. For group @f$ \geq 1 @f$, the + * convolutional filters' input and output channels are separated s.t. each + * group takes 1 / group of the input channels and makes 1 / group of the + * output channels. Concretely 4 input channels, 8 output channels, and + * 2 groups separate input channels 1-2 and output channels 1-4 into the + * first group and input channels 3-4 and output channels 5-8 into the second + * group. + * - bias_term (\b optional, default true). Whether to have a bias. + * - engine: convolution has CAFFE (matrix multiplication) and CUDNN (library + * kernels + stream parallelism) engines. + */ + explicit ConvolutionLayer(const LayerParameter& param) + : BaseConvolutionLayer(param) {} + + virtual inline const char* type() const { return "Convolution"; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual inline bool reverse_dimensions() { return false; } + virtual void compute_output_shape(); +}; + +} // namespace caffe + +#endif // CAFFE_CONV_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/crop_layer.hpp b/usr/local/include/caffe/layers/crop_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5219fa5cb5f89d81485f99c15f968c90d291313a --- /dev/null +++ b/usr/local/include/caffe/layers/crop_layer.hpp @@ -0,0 +1,78 @@ +#ifndef CAFFE_CROP_LAYER_HPP_ +#define CAFFE_CROP_LAYER_HPP_ + +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Takes a Blob and crop it, to the shape specified by the second input + * Blob, across all dimensions after the specified axis. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ + +template +class CropLayer : public Layer { + public: + explicit CropLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Crop"; } + virtual inline int ExactNumBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Blob offsets; + Blob src_strides_; + Blob dest_strides_; + + private: + // Recursive copy function. + void crop_copy(const vector*>& bottom, + const vector*>& top, + const int* offsets, + vector indices, + int cur_dim, + const Dtype* src_data, + Dtype* dest_data, + bool is_forward); + + // Recursive copy function: this is similar to crop_copy() but loops over all + // but the last two dimensions to allow for ND cropping while still relying on + // a CUDA kernel for the innermost two dimensions for performance reasons. An + // alterantive implementation could rely on the kernel more by passing + // offsets, but this is problematic because of its variable length. + // Since in the standard (N,C,W,H) case N,C are usually not cropped a speedup + // could be achieved by not looping the application of the copy_kernel around + // these dimensions. + void crop_copy_gpu(const vector*>& bottom, + const vector*>& top, + const vector& offsets, + vector indices, + int cur_dim, + const Dtype* src_data, + Dtype* dest_data, + bool is_forward); +}; +} // namespace caffe + +#endif // CAFFE_CROP_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_conv_layer.hpp b/usr/local/include/caffe/layers/cudnn_conv_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..31fe49a71fa1120ac69ed80bd956d73234bec52e --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_conv_layer.hpp @@ -0,0 +1,72 @@ +#ifndef CAFFE_CUDNN_CONV_LAYER_HPP_ +#define CAFFE_CUDNN_CONV_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/conv_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/* + * @brief cuDNN implementation of ConvolutionLayer. + * Fallback to ConvolutionLayer for CPU mode. + * + * cuDNN accelerates convolution through forward kernels for filtering and bias + * plus backward kernels for the gradient w.r.t. the filters, biases, and + * inputs. Caffe + cuDNN further speeds up the computation through forward + * parallelism across groups and backward parallelism across gradients. + * + * The CUDNN engine does not have memory overhead for matrix buffers. For many + * input and filter regimes the CUDNN engine is faster than the CAFFE engine, + * but for fully-convolutional models and large inputs the CAFFE engine can be + * faster as long as it fits in memory. +*/ +template +class CuDNNConvolutionLayer : public ConvolutionLayer { + public: + explicit CuDNNConvolutionLayer(const LayerParameter& param) + : ConvolutionLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNConvolutionLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t* handle_; + cudaStream_t* stream_; + + // algorithms for forward and backwards convolutions + cudnnConvolutionFwdAlgo_t *fwd_algo_; + cudnnConvolutionBwdFilterAlgo_t *bwd_filter_algo_; + cudnnConvolutionBwdDataAlgo_t *bwd_data_algo_; + + vector bottom_descs_, top_descs_; + cudnnTensorDescriptor_t bias_desc_; + cudnnFilterDescriptor_t filter_desc_; + vector conv_descs_; + int bottom_offset_, top_offset_, bias_offset_; + + size_t *workspace_fwd_sizes_; + size_t *workspace_bwd_data_sizes_; + size_t *workspace_bwd_filter_sizes_; + size_t workspaceSizeInBytes; // size of underlying storage + void *workspaceData; // underlying storage + void **workspace; // aliases into workspaceData +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_CONV_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_deconv_layer.hpp b/usr/local/include/caffe/layers/cudnn_deconv_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..12799e5b8ef4b0c22df8538bc6988ce45daefada --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_deconv_layer.hpp @@ -0,0 +1,68 @@ +#ifndef CAFFE_CUDNN_DECONV_LAYER_HPP_ +#define CAFFE_CUDNN_DECONV_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/deconv_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/* + * @brief cuDNN implementation of DeConvolutionLayer. + * Fallback to DeConvolutionLayer for CPU mode. + * + * cuDNN accelerates deconvolution through forward kernels for filtering and + * bias plus backward kernels for the gradient w.r.t. the filters, biases, and + * inputs. Caffe + cuDNN further speeds up the computation through forward + * parallelism across groups and backward parallelism across gradients. +*/ +template +class CuDNNDeconvolutionLayer : public DeconvolutionLayer { + public: + explicit CuDNNDeconvolutionLayer(const LayerParameter& param) + : DeconvolutionLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNDeconvolutionLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, + const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t* handle_; + cudaStream_t* stream_; + + // algorithms for forward and backwards convolutions + cudnnConvolutionFwdAlgo_t *fwd_algo_; + cudnnConvolutionBwdFilterAlgo_t *bwd_filter_algo_; + cudnnConvolutionBwdDataAlgo_t *bwd_data_algo_; + + vector bottom_descs_, top_descs_; + cudnnTensorDescriptor_t bias_desc_; + cudnnFilterDescriptor_t filter_desc_; + vector conv_descs_; + int bottom_offset_, top_offset_, bias_offset_; + + size_t *workspace_fwd_sizes_; + size_t *workspace_bwd_data_sizes_; + size_t *workspace_bwd_filter_sizes_; + size_t workspaceSizeInBytes; // size of underlying storage + void *workspaceData; // underlying storage + void **workspace; // aliases into workspaceData +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_DECONV_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_lcn_layer.hpp b/usr/local/include/caffe/layers/cudnn_lcn_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..74cf4775e515c11c0a86b7ce2a76d0d43909874c --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_lcn_layer.hpp @@ -0,0 +1,49 @@ +#ifndef CAFFE_CUDNN_LCN_LAYER_HPP_ +#define CAFFE_CUDNN_LCN_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/lrn_layer.hpp" +#include "caffe/layers/power_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +template +class CuDNNLCNLayer : public LRNLayer { + public: + explicit CuDNNLCNLayer(const LayerParameter& param) + : LRNLayer(param), handles_setup_(false), tempDataSize(0), + tempData1(NULL), tempData2(NULL) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNLCNLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnLRNDescriptor_t norm_desc_; + cudnnTensorDescriptor_t bottom_desc_, top_desc_; + + int size_, pre_pad_; + Dtype alpha_, beta_, k_; + + size_t tempDataSize; + void *tempData1, *tempData2; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_LCN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_lrn_layer.hpp b/usr/local/include/caffe/layers/cudnn_lrn_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..000ccc3650799d8dc6b9f75852919400df80c4dc --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_lrn_layer.hpp @@ -0,0 +1,44 @@ +#ifndef CAFFE_CUDNN_LRN_LAYER_HPP_ +#define CAFFE_CUDNN_LRN_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/lrn_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +template +class CuDNNLRNLayer : public LRNLayer { + public: + explicit CuDNNLRNLayer(const LayerParameter& param) + : LRNLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNLRNLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnLRNDescriptor_t norm_desc_; + cudnnTensorDescriptor_t bottom_desc_, top_desc_; + + int size_; + Dtype alpha_, beta_, k_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_LRN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_pooling_layer.hpp b/usr/local/include/caffe/layers/cudnn_pooling_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6d0db47d6603faa49a696654060c8a18fb045599 --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_pooling_layer.hpp @@ -0,0 +1,49 @@ +#ifndef CAFFE_CUDNN_POOLING_LAYER_HPP_ +#define CAFFE_CUDNN_POOLING_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/pooling_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/* + * @brief cuDNN implementation of PoolingLayer. + * Fallback to PoolingLayer for CPU mode. +*/ +template +class CuDNNPoolingLayer : public PoolingLayer { + public: + explicit CuDNNPoolingLayer(const LayerParameter& param) + : PoolingLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNPoolingLayer(); + // Currently, cuDNN does not support the extra top blob. + virtual inline int MinTopBlobs() const { return -1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnTensorDescriptor_t bottom_desc_, top_desc_; + cudnnPoolingDescriptor_t pooling_desc_; + cudnnPoolingMode_t mode_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_POOLING_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_relu_layer.hpp b/usr/local/include/caffe/layers/cudnn_relu_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a1cb29e7c5fbd914040431830248402e37803a40 --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_relu_layer.hpp @@ -0,0 +1,46 @@ +#ifndef CAFFE_CUDNN_RELU_LAYER_HPP_ +#define CAFFE_CUDNN_RELU_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" +#include "caffe/layers/relu_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/** + * @brief CuDNN acceleration of ReLULayer. + */ +template +class CuDNNReLULayer : public ReLULayer { + public: + explicit CuDNNReLULayer(const LayerParameter& param) + : ReLULayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNReLULayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnTensorDescriptor_t bottom_desc_; + cudnnTensorDescriptor_t top_desc_; + cudnnActivationDescriptor_t activ_desc_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_RELU_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_sigmoid_layer.hpp b/usr/local/include/caffe/layers/cudnn_sigmoid_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b3486f8a7e3df9bfe55ab5601710bd963900275 --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_sigmoid_layer.hpp @@ -0,0 +1,46 @@ +#ifndef CAFFE_CUDNN_SIGMOID_LAYER_HPP_ +#define CAFFE_CUDNN_SIGMOID_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" +#include "caffe/layers/sigmoid_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/** + * @brief CuDNN acceleration of SigmoidLayer. + */ +template +class CuDNNSigmoidLayer : public SigmoidLayer { + public: + explicit CuDNNSigmoidLayer(const LayerParameter& param) + : SigmoidLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNSigmoidLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnTensorDescriptor_t bottom_desc_; + cudnnTensorDescriptor_t top_desc_; + cudnnActivationDescriptor_t activ_desc_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_SIGMOID_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_softmax_layer.hpp b/usr/local/include/caffe/layers/cudnn_softmax_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..174368e413dd197edcd4fa1416f3c61600b423a1 --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_softmax_layer.hpp @@ -0,0 +1,45 @@ +#ifndef CAFFE_CUDNN_SOFTMAX_LAYER_HPP_ +#define CAFFE_CUDNN_SOFTMAX_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/softmax_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/** + * @brief cuDNN implementation of SoftmaxLayer. + * Fallback to SoftmaxLayer for CPU mode. + */ +template +class CuDNNSoftmaxLayer : public SoftmaxLayer { + public: + explicit CuDNNSoftmaxLayer(const LayerParameter& param) + : SoftmaxLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNSoftmaxLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnTensorDescriptor_t bottom_desc_; + cudnnTensorDescriptor_t top_desc_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_SOFTMAX_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/cudnn_tanh_layer.hpp b/usr/local/include/caffe/layers/cudnn_tanh_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59e758d7031588b5605758bf8202a6082655a06f --- /dev/null +++ b/usr/local/include/caffe/layers/cudnn_tanh_layer.hpp @@ -0,0 +1,46 @@ +#ifndef CAFFE_CUDNN_TANH_LAYER_HPP_ +#define CAFFE_CUDNN_TANH_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" +#include "caffe/layers/tanh_layer.hpp" + +namespace caffe { + +#ifdef USE_CUDNN +/** + * @brief CuDNN acceleration of TanHLayer. + */ +template +class CuDNNTanHLayer : public TanHLayer { + public: + explicit CuDNNTanHLayer(const LayerParameter& param) + : TanHLayer(param), handles_setup_(false) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual ~CuDNNTanHLayer(); + + protected: + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool handles_setup_; + cudnnHandle_t handle_; + cudnnTensorDescriptor_t bottom_desc_; + cudnnTensorDescriptor_t top_desc_; + cudnnActivationDescriptor_t activ_desc_; +}; +#endif + +} // namespace caffe + +#endif // CAFFE_CUDNN_TANH_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/data_layer.hpp b/usr/local/include/caffe/layers/data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..667a4ae43a5c5625f0a6fc8819f5b3a363a0f2a9 --- /dev/null +++ b/usr/local/include/caffe/layers/data_layer.hpp @@ -0,0 +1,40 @@ +#ifndef CAFFE_DATA_LAYER_HPP_ +#define CAFFE_DATA_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/data_transformer.hpp" +#include "caffe/internal_thread.hpp" +#include "caffe/layer.hpp" +#include "caffe/layers/base_data_layer.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/db.hpp" + +namespace caffe { + +template +class DataLayer : public BasePrefetchingDataLayer { + public: + explicit DataLayer(const LayerParameter& param); + virtual ~DataLayer(); + virtual void DataLayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual inline const char* type() const { return "Data"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int MinTopBlobs() const { return 1; } + virtual inline int MaxTopBlobs() const { return 2; } + + protected: + void Next(); + bool Skip(); + virtual void load_batch(Batch* batch); + + shared_ptr db_; + shared_ptr cursor_; + uint64_t offset_; +}; + +} // namespace caffe + +#endif // CAFFE_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/deconv_layer.hpp b/usr/local/include/caffe/layers/deconv_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..23ae887e61ee5de707728e8bb4096f6f36dd3f92 --- /dev/null +++ b/usr/local/include/caffe/layers/deconv_layer.hpp @@ -0,0 +1,51 @@ +#ifndef CAFFE_DECONV_LAYER_HPP_ +#define CAFFE_DECONV_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/base_conv_layer.hpp" + +namespace caffe { + +/** + * @brief Convolve the input with a bank of learned filters, and (optionally) + * add biases, treating filters and convolution parameters in the + * opposite sense as ConvolutionLayer. + * + * ConvolutionLayer computes each output value by dotting an input window with + * a filter; DeconvolutionLayer multiplies each input value by a filter + * elementwise, and sums over the resulting output windows. In other words, + * DeconvolutionLayer is ConvolutionLayer with the forward and backward passes + * reversed. DeconvolutionLayer reuses ConvolutionParameter for its + * parameters, but they take the opposite sense as in ConvolutionLayer (so + * padding is removed from the output rather than added to the input, and + * stride results in upsampling rather than downsampling). + */ +template +class DeconvolutionLayer : public BaseConvolutionLayer { + public: + explicit DeconvolutionLayer(const LayerParameter& param) + : BaseConvolutionLayer(param) {} + + virtual inline const char* type() const { return "Deconvolution"; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual inline bool reverse_dimensions() { return true; } + virtual void compute_output_shape(); +}; + +} // namespace caffe + +#endif // CAFFE_DECONV_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/dropout_layer.hpp b/usr/local/include/caffe/layers/dropout_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e83143bc3cc0aa3d303a59a695ec76632fba0c2c --- /dev/null +++ b/usr/local/include/caffe/layers/dropout_layer.hpp @@ -0,0 +1,80 @@ +#ifndef CAFFE_DROPOUT_LAYER_HPP_ +#define CAFFE_DROPOUT_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief During training only, sets a random portion of @f$x@f$ to 0, adjusting + * the rest of the vector magnitude accordingly. + * + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ y = |x| @f$ + */ +template +class DropoutLayer : public NeuronLayer { + public: + /** + * @param param provides DropoutParameter dropout_param, + * with DropoutLayer options: + * - dropout_ratio (\b optional, default 0.5). + * Sets the probability @f$ p @f$ that any given unit is dropped. + */ + explicit DropoutLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Dropout"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs. At training time, we have @f$ + * y_{\mbox{train}} = \left\{ + * \begin{array}{ll} + * \frac{x}{1 - p} & \mbox{if } u > p \\ + * 0 & \mbox{otherwise} + * \end{array} \right. + * @f$, where @f$ u \sim U(0, 1)@f$ is generated independently for each + * input at each iteration. At test time, we simply have + * @f$ y_{\mbox{test}} = \mathbb{E}[y_{\mbox{train}}] = x @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// when divided by UINT_MAX, the randomly generated values @f$u\sim U(0,1)@f$ + Blob rand_vec_; + /// the probability @f$ p @f$ of dropping any input + Dtype threshold_; + /// the scale for undropped inputs at train time @f$ 1 / (1 - p) @f$ + Dtype scale_; + unsigned int uint_thres_; +}; + +} // namespace caffe + +#endif // CAFFE_DROPOUT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/dummy_data_layer.hpp b/usr/local/include/caffe/layers/dummy_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..13a63d47ec4c9cc060dd8300038de496c75eb281 --- /dev/null +++ b/usr/local/include/caffe/layers/dummy_data_layer.hpp @@ -0,0 +1,47 @@ +#ifndef CAFFE_DUMMY_DATA_LAYER_HPP_ +#define CAFFE_DUMMY_DATA_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/filler.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Provides data to the Net generated by a Filler. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class DummyDataLayer : public Layer { + public: + explicit DummyDataLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + // Data layers have no bottoms, so reshaping is trivial. + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual inline const char* type() const { return "DummyData"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + + vector > > fillers_; + vector refill_; +}; + +} // namespace caffe + +#endif // CAFFE_DUMMY_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/eltwise_layer.hpp b/usr/local/include/caffe/layers/eltwise_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..091de8343627ab1879d055524075a057f3c90f63 --- /dev/null +++ b/usr/local/include/caffe/layers/eltwise_layer.hpp @@ -0,0 +1,51 @@ +#ifndef CAFFE_ELTWISE_LAYER_HPP_ +#define CAFFE_ELTWISE_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Compute elementwise operations, such as product and sum, + * along multiple input Blobs. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class EltwiseLayer : public Layer { + public: + explicit EltwiseLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Eltwise"; } + virtual inline int MinBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + EltwiseParameter_EltwiseOp op_; + vector coeffs_; + Blob max_idx_; + + bool stable_prod_grad_; +}; + +} // namespace caffe + +#endif // CAFFE_ELTWISE_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/elu_layer.hpp b/usr/local/include/caffe/layers/elu_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0796e898007ea8e382b0055ba711ecc089de3804 --- /dev/null +++ b/usr/local/include/caffe/layers/elu_layer.hpp @@ -0,0 +1,86 @@ +#ifndef CAFFE_ELU_LAYER_HPP_ +#define CAFFE_ELU_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Exponential Linear Unit non-linearity @f$ + * y = \left\{ + * \begin{array}{lr} + * x & \mathrm{if} \; x > 0 \\ + * \alpha (\exp(x)-1) & \mathrm{if} \; x \le 0 + * \end{array} \right. + * @f$. + */ +template +class ELULayer : public NeuronLayer { + public: + /** + * @param param provides ELUParameter elu_param, + * with ELULayer options: + * - alpha (\b optional, default 1). + * the value @f$ \alpha @f$ by which controls saturation for negative inputs. + */ + explicit ELULayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "ELU"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \left\{ + * \begin{array}{lr} + * x & \mathrm{if} \; x > 0 \\ + * \alpha (\exp(x)-1) & \mathrm{if} \; x \le 0 + * \end{array} \right. + * @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the ELU inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = \left\{ + * \begin{array}{lr} + * 1 & \mathrm{if} \; x > 0 \\ + * y + \alpha & \mathrm{if} \; x \le 0 + * \end{array} \right. + * @f$ if propagate_down[0]. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + + +} // namespace caffe + +#endif // CAFFE_ELU_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/embed_layer.hpp b/usr/local/include/caffe/layers/embed_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..36137a625b682b39cc104615e80b2186afade6d0 --- /dev/null +++ b/usr/local/include/caffe/layers/embed_layer.hpp @@ -0,0 +1,52 @@ +#ifndef CAFFE_EMBED_LAYER_HPP_ +#define CAFFE_EMBED_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief A layer for learning "embeddings" of one-hot vector input. + * Equivalent to an InnerProductLayer with one-hot vectors as input, but + * for efficiency the input is the "hot" index of each column itself. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class EmbedLayer : public Layer { + public: + explicit EmbedLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Embed"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int M_; + int K_; + int N_; + bool bias_term_; + Blob bias_multiplier_; +}; + +} // namespace caffe + +#endif // CAFFE_EMBED_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/euclidean_loss_layer.hpp b/usr/local/include/caffe/layers/euclidean_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..24568c5496f404235e58f48c1790bb84fe08636e --- /dev/null +++ b/usr/local/include/caffe/layers/euclidean_loss_layer.hpp @@ -0,0 +1,107 @@ +#ifndef CAFFE_EUCLIDEAN_LOSS_LAYER_HPP_ +#define CAFFE_EUCLIDEAN_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the Euclidean (L2) loss @f$ + * E = \frac{1}{2N} \sum\limits_{n=1}^N \left| \left| \hat{y}_n - y_n + * \right| \right|_2^2 @f$ for real-valued regression tasks. + * + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ \hat{y} \in [-\infty, +\infty]@f$ + * -# @f$ (N \times C \times H \times W) @f$ + * the targets @f$ y \in [-\infty, +\infty]@f$ + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed Euclidean loss: @f$ E = + * \frac{1}{2n} \sum\limits_{n=1}^N \left| \left| \hat{y}_n - y_n + * \right| \right|_2^2 @f$ + * + * This can be used for least-squares regression tasks. An InnerProductLayer + * input to a EuclideanLossLayer exactly formulates a linear least squares + * regression problem. With non-zero weight decay the problem becomes one of + * ridge regression -- see src/caffe/test/test_gradient_based_solver.cpp for a concrete + * example wherein we check that the gradients computed for a Net with exactly + * this structure match hand-computed gradient formulas for ridge regression. + * + * (Note: Caffe, and SGD in general, is certainly \b not the best way to solve + * linear least squares problems! We use it only as an instructive example.) + */ +template +class EuclideanLossLayer : public LossLayer { + public: + explicit EuclideanLossLayer(const LayerParameter& param) + : LossLayer(param), diff_() {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "EuclideanLoss"; } + /** + * Unlike most loss layers, in the EuclideanLossLayer we can backpropagate + * to both inputs -- override to return true and always allow force_backward. + */ + virtual inline bool AllowForceBackward(const int bottom_index) const { + return true; + } + + protected: + /// @copydoc EuclideanLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the Euclidean error gradient w.r.t. the inputs. + * + * Unlike other children of LossLayer, EuclideanLossLayer \b can compute + * gradients with respect to the label inputs bottom[1] (but still only will + * if propagate_down[1] is set, due to being produced by learnable parameters + * or if force_backward is set). In fact, this layer is "commutative" -- the + * result is the same regardless of the order of the two bottoms. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$\hat{y}@f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial \hat{y}} = + * \frac{1}{n} \sum\limits_{n=1}^N (\hat{y}_n - y_n) + * @f$ if propagate_down[0] + * -# @f$ (N \times C \times H \times W) @f$ + * the targets @f$y@f$; Backward fills their diff with gradients + * @f$ \frac{\partial E}{\partial y} = + * \frac{1}{n} \sum\limits_{n=1}^N (y_n - \hat{y}_n) + * @f$ if propagate_down[1] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Blob diff_; +}; + +} // namespace caffe + +#endif // CAFFE_EUCLIDEAN_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/exp_layer.hpp b/usr/local/include/caffe/layers/exp_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9fc8c396a74e3cbcfa196d1cbd53d51e9effa86c --- /dev/null +++ b/usr/local/include/caffe/layers/exp_layer.hpp @@ -0,0 +1,80 @@ +#ifndef CAFFE_EXP_LAYER_HPP_ +#define CAFFE_EXP_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Computes @f$ y = \gamma ^ {\alpha x + \beta} @f$, + * as specified by the scale @f$ \alpha @f$, shift @f$ \beta @f$, + * and base @f$ \gamma @f$. + */ +template +class ExpLayer : public NeuronLayer { + public: + /** + * @param param provides ExpParameter exp_param, + * with ExpLayer options: + * - scale (\b optional, default 1) the scale @f$ \alpha @f$ + * - shift (\b optional, default 0) the shift @f$ \beta @f$ + * - base (\b optional, default -1 for a value of @f$ e \approx 2.718 @f$) + * the base @f$ \gamma @f$ + */ + explicit ExpLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Exp"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \gamma ^ {\alpha x + \beta} + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the exp inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = + * \frac{\partial E}{\partial y} y \alpha \log_e(gamma) + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Dtype inner_scale_, outer_scale_; +}; + +} // namespace caffe + +#endif // CAFFE_EXP_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/filter_layer.hpp b/usr/local/include/caffe/layers/filter_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e040e66612b79840e66a1e81e956b83cd5c00e35 --- /dev/null +++ b/usr/local/include/caffe/layers/filter_layer.hpp @@ -0,0 +1,77 @@ +#ifndef CAFFE_FILTER_LAYER_HPP_ +#define CAFFE_FILTER_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Takes two+ Blobs, interprets last Blob as a selector and + * filter remaining Blobs accordingly with selector data (0 means that + * the corresponding item has to be filtered, non-zero means that corresponding + * item needs to stay). + */ +template +class FilterLayer : public Layer { + public: + explicit FilterLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Filter"; } + virtual inline int MinBottomBlobs() const { return 2; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + /** + * @param bottom input Blob vector (length 2+) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs to be filtered @f$ x_1 @f$ + * -# ... + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs to be filtered @f$ x_K @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the selector blob + * @param top output Blob vector (length 1+) + * -# @f$ (S \times C \times H \times W) @f$ () + * the filtered output @f$ x_1 @f$ + * where S is the number of items + * that haven't been filtered + * @f$ (S \times C \times H \times W) @f$ + * the filtered output @f$ x_K @f$ + * where S is the number of items + * that haven't been filtered + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the forwarded inputs. + * + * @param top output Blob vector (length 1+), providing the error gradient with + * respect to the outputs + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 2+), into which the top error + * gradient is copied + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool first_reshape_; + vector indices_to_forward_; +}; + +} // namespace caffe + +#endif // CAFFE_FILTER_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/flatten_layer.hpp b/usr/local/include/caffe/layers/flatten_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e494bbb588f0524e025fafb81284e6cbbb9e65b2 --- /dev/null +++ b/usr/local/include/caffe/layers/flatten_layer.hpp @@ -0,0 +1,61 @@ +#ifndef CAFFE_FLATTEN_LAYER_HPP_ +#define CAFFE_FLATTEN_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Reshapes the input Blob into flat vectors. + * + * Note: because this layer does not change the input values -- merely the + * dimensions -- it can simply copy the input. The copy happens "virtually" + * (thus taking effectively 0 real time) by setting, in Forward, the data + * pointer of the top Blob to that of the bottom Blob (see Blob::ShareData), + * and in Backward, the diff pointer of the bottom Blob to that of the top Blob + * (see Blob::ShareDiff). + */ +template +class FlattenLayer : public Layer { + public: + explicit FlattenLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Flatten"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /** + * @param bottom input Blob vector (length 2+) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs + * @param top output Blob vector (length 1) + * -# @f$ (N \times CHW \times 1 \times 1) @f$ + * the outputs -- i.e., the (virtually) copied, flattened inputs + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the concatenate inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length K), into which the top error + * gradient is (virtually) copied + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_FLATTEN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/hdf5_data_layer.hpp b/usr/local/include/caffe/layers/hdf5_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..601b36c6b89f79ea74c87e8ffed4471cf3e3e440 --- /dev/null +++ b/usr/local/include/caffe/layers/hdf5_data_layer.hpp @@ -0,0 +1,64 @@ +#ifndef CAFFE_HDF5_DATA_LAYER_HPP_ +#define CAFFE_HDF5_DATA_LAYER_HPP_ + +#include "hdf5.h" + +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/base_data_layer.hpp" + +namespace caffe { + +/** + * @brief Provides data to the Net from HDF5 files. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class HDF5DataLayer : public Layer { + public: + explicit HDF5DataLayer(const LayerParameter& param) + : Layer(param), offset_() {} + virtual ~HDF5DataLayer(); + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + // Data layers have no bottoms, so reshaping is trivial. + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual inline const char* type() const { return "HDF5Data"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + void Next(); + bool Skip(); + + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + virtual void LoadHDF5FileData(const char* filename); + + std::vector hdf_filenames_; + unsigned int num_files_; + unsigned int current_file_; + hsize_t current_row_; + std::vector > > hdf_blobs_; + std::vector data_permutation_; + std::vector file_permutation_; + uint64_t offset_; +}; + +} // namespace caffe + +#endif // CAFFE_HDF5_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/hdf5_output_layer.hpp b/usr/local/include/caffe/layers/hdf5_output_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..061e279d7a044d91bb9a8ca25d65217e1802389a --- /dev/null +++ b/usr/local/include/caffe/layers/hdf5_output_layer.hpp @@ -0,0 +1,62 @@ +#ifndef CAFFE_HDF5_OUTPUT_LAYER_HPP_ +#define CAFFE_HDF5_OUTPUT_LAYER_HPP_ + +#include "hdf5.h" + +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +#define HDF5_DATA_DATASET_NAME "data" +#define HDF5_DATA_LABEL_NAME "label" + +/** + * @brief Write blobs to disk as HDF5 files. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class HDF5OutputLayer : public Layer { + public: + explicit HDF5OutputLayer(const LayerParameter& param) + : Layer(param), file_opened_(false) {} + virtual ~HDF5OutputLayer(); + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + // Data layers have no bottoms, so reshaping is trivial. + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual inline const char* type() const { return "HDF5Output"; } + // TODO: no limit on the number of blobs + virtual inline int ExactNumBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 0; } + + inline std::string file_name() const { return file_name_; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void SaveBlobs(); + + bool file_opened_; + std::string file_name_; + hid_t file_id_; + Blob data_blob_; + Blob label_blob_; +}; + +} // namespace caffe + +#endif // CAFFE_HDF5_OUTPUT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/hinge_loss_layer.hpp b/usr/local/include/caffe/layers/hinge_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..54e42bd44dafc01b5978b930ef7ca2f461cfa178 --- /dev/null +++ b/usr/local/include/caffe/layers/hinge_loss_layer.hpp @@ -0,0 +1,104 @@ +#ifndef CAFFE_HINGE_LOSS_LAYER_HPP_ +#define CAFFE_HINGE_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the hinge loss for a one-of-many classification task. + * + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ t @f$, a Blob with values in + * @f$ [-\infty, +\infty] @f$ indicating the predicted score for each of + * the @f$ K = CHW @f$ classes. In an SVM, @f$ t @f$ is the result of + * taking the inner product @f$ X^T W @f$ of the D-dimensional features + * @f$ X \in \mathcal{R}^{D \times N} @f$ and the learned hyperplane + * parameters @f$ W \in \mathcal{R}^{D \times K} @f$, so a Net with just + * an InnerProductLayer (with num_output = D) providing predictions to a + * HingeLossLayer and no other learnable parameters or losses is + * equivalent to an SVM. + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels @f$ l @f$, an integer-valued Blob with values + * @f$ l_n \in [0, 1, 2, ..., K - 1] @f$ + * indicating the correct class label among the @f$ K @f$ classes + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed hinge loss: @f$ E = + * \frac{1}{N} \sum\limits_{n=1}^N \sum\limits_{k=1}^K + * [\max(0, 1 - \delta\{l_n = k\} t_{nk})] ^ p + * @f$, for the @f$ L^p @f$ norm + * (defaults to @f$ p = 1 @f$, the L1 norm; L2 norm, as in L2-SVM, + * is also available), and @f$ + * \delta\{\mathrm{condition}\} = \left\{ + * \begin{array}{lr} + * 1 & \mbox{if condition} \\ + * -1 & \mbox{otherwise} + * \end{array} \right. + * @f$ + * + * In an SVM, @f$ t \in \mathcal{R}^{N \times K} @f$ is the result of taking + * the inner product @f$ X^T W @f$ of the features + * @f$ X \in \mathcal{R}^{D \times N} @f$ + * and the learned hyperplane parameters + * @f$ W \in \mathcal{R}^{D \times K} @f$. So, a Net with just an + * InnerProductLayer (with num_output = @f$k@f$) providing predictions to a + * HingeLossLayer is equivalent to an SVM (assuming it has no other learned + * outside the InnerProductLayer and no other losses outside the + * HingeLossLayer). + */ +template +class HingeLossLayer : public LossLayer { + public: + explicit HingeLossLayer(const LayerParameter& param) + : LossLayer(param) {} + + virtual inline const char* type() const { return "HingeLoss"; } + + protected: + /// @copydoc HingeLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the hinge loss error gradient w.r.t. the predictions. + * + * Gradients cannot be computed with respect to the label inputs (bottom[1]), + * so this method ignores bottom[1] and requires !propagate_down[1], crashing + * if propagate_down[1] is set. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * propagate_down[1] must be false as we can't compute gradients with + * respect to the labels. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$t@f$; Backward computes diff + * @f$ \frac{\partial E}{\partial t} @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels -- ignored as we can't compute their error gradients + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + + +} // namespace caffe + +#endif // CAFFE_HINGE_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/im2col_layer.hpp b/usr/local/include/caffe/layers/im2col_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..71e32f7427f659c3d3544b1cbae33c2a0e1ce4a2 --- /dev/null +++ b/usr/local/include/caffe/layers/im2col_layer.hpp @@ -0,0 +1,65 @@ +#ifndef CAFFE_IM2COL_LAYER_HPP_ +#define CAFFE_IM2COL_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief A helper for image operations that rearranges image regions into + * column vectors. Used by ConvolutionLayer to perform convolution + * by matrix multiplication. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class Im2colLayer : public Layer { + public: + explicit Im2colLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Im2col"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// @brief The spatial dimensions of a filter kernel. + Blob kernel_shape_; + /// @brief The spatial dimensions of the stride. + Blob stride_; + /// @brief The spatial dimensions of the padding. + Blob pad_; + /// @brief The spatial dimensions of the dilation. + Blob dilation_; + + int num_spatial_axes_; + int bottom_dim_; + int top_dim_; + + int channel_axis_; + int num_; + int channels_; + + bool force_nd_im2col_; +}; + +} // namespace caffe + +#endif // CAFFE_IM2COL_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/image_data_layer.hpp b/usr/local/include/caffe/layers/image_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a0d3384e4c9b904e9c1860f8918ffdc5c9311fd4 --- /dev/null +++ b/usr/local/include/caffe/layers/image_data_layer.hpp @@ -0,0 +1,47 @@ +#ifndef CAFFE_IMAGE_DATA_LAYER_HPP_ +#define CAFFE_IMAGE_DATA_LAYER_HPP_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/data_transformer.hpp" +#include "caffe/internal_thread.hpp" +#include "caffe/layer.hpp" +#include "caffe/layers/base_data_layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Provides data to the Net from image files. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class ImageDataLayer : public BasePrefetchingDataLayer { + public: + explicit ImageDataLayer(const LayerParameter& param) + : BasePrefetchingDataLayer(param) {} + virtual ~ImageDataLayer(); + virtual void DataLayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "ImageData"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int ExactNumTopBlobs() const { return 2; } + + protected: + shared_ptr prefetch_rng_; + virtual void ShuffleImages(); + virtual void load_batch(Batch* batch); + + vector > lines_; + int lines_id_; +}; + + +} // namespace caffe + +#endif // CAFFE_IMAGE_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/infogain_loss_layer.hpp b/usr/local/include/caffe/layers/infogain_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3b3caa27c383b6c66190662358175dddaec1be87 --- /dev/null +++ b/usr/local/include/caffe/layers/infogain_loss_layer.hpp @@ -0,0 +1,146 @@ +#ifndef CAFFE_INFOGAIN_LOSS_LAYER_HPP_ +#define CAFFE_INFOGAIN_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" +#include "caffe/layers/softmax_layer.hpp" + +namespace caffe { + +/** + * @brief A generalization of SoftmaxWithLossLayer that takes an + * "information gain" (infogain) matrix specifying the "value" of all label + * pairs. + * + * Equivalent to the SoftmaxWithLossLayer if the infogain matrix is the + * identity. + * + * @param bottom input Blob vector (length 2-3) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ x @f$, a Blob with values in + * @f$ [-\infty, +\infty] @f$ indicating the predicted score for each of + * the @f$ K = CHW @f$ classes. This layer maps these scores to a + * probability distribution over classes using the softmax function + * @f$ \hat{p}_{nk} = \exp(x_{nk}) / + * \left[\sum_{k'} \exp(x_{nk'})\right] @f$ (see SoftmaxLayer). + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels @f$ l @f$, an integer-valued Blob with values + * @f$ l_n \in [0, 1, 2, ..., K - 1] @f$ + * indicating the correct class label among the @f$ K @f$ classes + * -# @f$ (1 \times 1 \times K \times K) @f$ + * (\b optional) the infogain matrix @f$ H @f$. This must be provided as + * the third bottom blob input if not provided as the infogain_mat in the + * InfogainLossParameter. If @f$ H = I @f$, this layer is equivalent to the + * SoftmaxWithLossLayer. + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed infogain multinomial logistic loss: @f$ E = + * \frac{-1}{N} \sum\limits_{n=1}^N H_{l_n} \log(\hat{p}_n) = + * \frac{-1}{N} \sum\limits_{n=1}^N \sum\limits_{k=1}^{K} H_{l_n,k} + * \log(\hat{p}_{n,k}) + * @f$, where @f$ H_{l_n} @f$ denotes row @f$l_n@f$ of @f$H@f$. + */ +template +class InfogainLossLayer : public LossLayer { + public: + explicit InfogainLossLayer(const LayerParameter& param) + : LossLayer(param), infogain_() {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + // InfogainLossLayer takes 2-3 bottom Blobs; if there are 3 the third should + // be the infogain matrix. (Otherwise the infogain matrix is loaded from a + // file specified by LayerParameter.) + virtual inline int ExactNumBottomBlobs() const { return -1; } + virtual inline int MinBottomBlobs() const { return 2; } + virtual inline int MaxBottomBlobs() const { return 3; } + + // InfogainLossLayer computes softmax prob internally. + // optional second "top" outputs the softmax prob + virtual inline int ExactNumTopBlobs() const { return -1; } + virtual inline int MinTopBlobs() const { return 1; } + virtual inline int MaxTopBlobs() const { return 2; } + + virtual inline const char* type() const { return "InfogainLoss"; } + + protected: + /// @copydoc InfogainLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the infogain loss error gradient w.r.t. the predictions. + * + * Gradients cannot be computed with respect to the label inputs (bottom[1]), + * so this method ignores bottom[1] and requires !propagate_down[1], crashing + * if propagate_down[1] is set. (The same applies to the infogain matrix, if + * provided as bottom[2] rather than in the layer_param.) + * + * @param top output Blob vector (length 1), providing the error gradient + * with respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * propagate_down[1] must be false as we can't compute gradients with + * respect to the labels (similarly for propagate_down[2] and the + * infogain matrix, if provided as bottom[2]) + * @param bottom input Blob vector (length 2-3) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ x @f$; Backward computes diff + * @f$ \frac{\partial E}{\partial x} @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels -- ignored as we can't compute their error gradients + * -# @f$ (1 \times 1 \times K \times K) @f$ + * (\b optional) the information gain matrix -- ignored as its error + * gradient computation is not implemented. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// Read the normalization mode parameter and compute the normalizer based + /// on the blob size. If normalization_mode is VALID, the count of valid + /// outputs will be read from valid_count, unless it is -1 in which case + /// all outputs are assumed to be valid. + virtual Dtype get_normalizer( + LossParameter_NormalizationMode normalization_mode, int valid_count); + /// fill sum_rows_H_ according to matrix H + virtual void sum_rows_of_H(const Blob* H); + + /// The internal SoftmaxLayer used to map predictions to a distribution. + shared_ptr > softmax_layer_; + /// prob stores the output probability predictions from the SoftmaxLayer. + Blob prob_; + /// bottom vector holder used in call to the underlying SoftmaxLayer::Forward + vector*> softmax_bottom_vec_; + /// top vector holder used in call to the underlying SoftmaxLayer::Forward + vector*> softmax_top_vec_; + + Blob infogain_; + Blob sum_rows_H_; // cache the row sums of H. + + /// Whether to ignore instances with a certain label. + bool has_ignore_label_; + /// The label indicating that an instance should be ignored. + int ignore_label_; + /// How to normalize the output loss. + LossParameter_NormalizationMode normalization_; + + int infogain_axis_, outer_num_, inner_num_, num_labels_; +}; + +} // namespace caffe + +#endif // CAFFE_INFOGAIN_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/inner_product_layer.hpp b/usr/local/include/caffe/layers/inner_product_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..18d0d6192ebb14f5077c69c071c5cdcde25ea0fc --- /dev/null +++ b/usr/local/include/caffe/layers/inner_product_layer.hpp @@ -0,0 +1,52 @@ +#ifndef CAFFE_INNER_PRODUCT_LAYER_HPP_ +#define CAFFE_INNER_PRODUCT_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Also known as a "fully-connected" layer, computes an inner product + * with a set of learned weights, and (optionally) adds biases. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class InnerProductLayer : public Layer { + public: + explicit InnerProductLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "InnerProduct"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int M_; + int K_; + int N_; + bool bias_term_; + Blob bias_multiplier_; + bool transpose_; ///< if true, assume transposed weights +}; + +} // namespace caffe + +#endif // CAFFE_INNER_PRODUCT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/input_layer.hpp b/usr/local/include/caffe/layers/input_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0ffdc7248946c61b08c8c449a7e10ba9af608d5b --- /dev/null +++ b/usr/local/include/caffe/layers/input_layer.hpp @@ -0,0 +1,42 @@ +#ifndef CAFFE_INPUT_LAYER_HPP_ +#define CAFFE_INPUT_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Provides data to the Net by assigning tops directly. + * + * This data layer is a container that merely holds the data assigned to it; + * forward, backward, and reshape are all no-ops. + */ +template +class InputLayer : public Layer { + public: + explicit InputLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + // Data layers have no bottoms, so reshaping is trivial. + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual inline const char* type() const { return "Input"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) {} + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} +}; + +} // namespace caffe + +#endif // CAFFE_INPUT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/log_layer.hpp b/usr/local/include/caffe/layers/log_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7d037d2bdca3eaf10f8e8ca180519ef0b1724a69 --- /dev/null +++ b/usr/local/include/caffe/layers/log_layer.hpp @@ -0,0 +1,82 @@ +#ifndef CAFFE_LOG_LAYER_HPP_ +#define CAFFE_LOG_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Computes @f$ y = log_{\gamma}(\alpha x + \beta) @f$, + * as specified by the scale @f$ \alpha @f$, shift @f$ \beta @f$, + * and base @f$ \gamma @f$. + */ +template +class LogLayer : public NeuronLayer { + public: + /** + * @param param provides LogParameter log_param, + * with LogLayer options: + * - scale (\b optional, default 1) the scale @f$ \alpha @f$ + * - shift (\b optional, default 0) the shift @f$ \beta @f$ + * - base (\b optional, default -1 for a value of @f$ e \approx 2.718 @f$) + * the base @f$ \gamma @f$ + */ + explicit LogLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Log"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = log_{\gamma}(\alpha x + \beta) + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the exp inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = + * \frac{\partial E}{\partial y} y \alpha \log_e(gamma) + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Dtype base_scale_; + Dtype input_scale_, input_shift_; + Dtype backward_num_scale_; +}; + +} // namespace caffe + +#endif // CAFFE_LOG_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/loss_layer.hpp b/usr/local/include/caffe/layers/loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dbdf612c062d88debbe9fed531c0052eeefaf33e --- /dev/null +++ b/usr/local/include/caffe/layers/loss_layer.hpp @@ -0,0 +1,53 @@ +#ifndef CAFFE_LOSS_LAYER_HPP_ +#define CAFFE_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +const float kLOG_THRESHOLD = 1e-20; + +/** + * @brief An interface for Layer%s that take two Blob%s as input -- usually + * (1) predictions and (2) ground-truth labels -- and output a + * singleton Blob representing the loss. + * + * LossLayers are typically only capable of backpropagating to their first input + * -- the predictions. + */ +template +class LossLayer : public Layer { + public: + explicit LossLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp( + const vector*>& bottom, const vector*>& top); + virtual void Reshape( + const vector*>& bottom, const vector*>& top); + + virtual inline int ExactNumBottomBlobs() const { return 2; } + + /** + * @brief For convenience and backwards compatibility, instruct the Net to + * automatically allocate a single top Blob for LossLayers, into which + * they output their singleton loss, (even if the user didn't specify + * one in the prototxt, etc.). + */ + virtual inline bool AutoTopBlobs() const { return true; } + virtual inline int ExactNumTopBlobs() const { return 1; } + /** + * We usually cannot backpropagate to the labels; ignore force_backward for + * these inputs. + */ + virtual inline bool AllowForceBackward(const int bottom_index) const { + return bottom_index != 1; + } +}; + +} // namespace caffe + +#endif // CAFFE_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/lrn_layer.hpp b/usr/local/include/caffe/layers/lrn_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..06cf71a94cb6e65eebcae554bc0b195e2abc124e --- /dev/null +++ b/usr/local/include/caffe/layers/lrn_layer.hpp @@ -0,0 +1,94 @@ +#ifndef CAFFE_LRN_LAYER_HPP_ +#define CAFFE_LRN_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/eltwise_layer.hpp" +#include "caffe/layers/pooling_layer.hpp" +#include "caffe/layers/power_layer.hpp" +#include "caffe/layers/split_layer.hpp" + +namespace caffe { + +/** + * @brief Normalize the input in a local region across or within feature maps. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class LRNLayer : public Layer { + public: + explicit LRNLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "LRN"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + virtual void CrossChannelForward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void CrossChannelForward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void WithinChannelForward(const vector*>& bottom, + const vector*>& top); + virtual void CrossChannelBackward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void CrossChannelBackward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void WithinChannelBackward(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int size_; + int pre_pad_; + Dtype alpha_; + Dtype beta_; + Dtype k_; + int num_; + int channels_; + int height_; + int width_; + + // Fields used for normalization ACROSS_CHANNELS + // scale_ stores the intermediate summing results + Blob scale_; + + // Fields used for normalization WITHIN_CHANNEL + shared_ptr > split_layer_; + vector*> split_top_vec_; + shared_ptr > square_layer_; + Blob square_input_; + Blob square_output_; + vector*> square_bottom_vec_; + vector*> square_top_vec_; + shared_ptr > pool_layer_; + Blob pool_output_; + vector*> pool_top_vec_; + shared_ptr > power_layer_; + Blob power_output_; + vector*> power_top_vec_; + shared_ptr > product_layer_; + Blob product_input_; + vector*> product_bottom_vec_; +}; + +} // namespace caffe + +#endif // CAFFE_LRN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/lstm_layer.hpp b/usr/local/include/caffe/layers/lstm_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a0e67c9d432404ed46736cf680f9b46be9739ec2 --- /dev/null +++ b/usr/local/include/caffe/layers/lstm_layer.hpp @@ -0,0 +1,154 @@ +#ifndef CAFFE_LSTM_LAYER_HPP_ +#define CAFFE_LSTM_LAYER_HPP_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/layer.hpp" +#include "caffe/layers/recurrent_layer.hpp" +#include "caffe/net.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +template class RecurrentLayer; + +/** + * @brief Processes sequential inputs using a "Long Short-Term Memory" (LSTM) + * [1] style recurrent neural network (RNN). Implemented by unrolling + * the LSTM computation through time. + * + * The specific architecture used in this implementation is as described in + * "Learning to Execute" [2], reproduced below: + * i_t := \sigmoid[ W_{hi} * h_{t-1} + W_{xi} * x_t + b_i ] + * f_t := \sigmoid[ W_{hf} * h_{t-1} + W_{xf} * x_t + b_f ] + * o_t := \sigmoid[ W_{ho} * h_{t-1} + W_{xo} * x_t + b_o ] + * g_t := \tanh[ W_{hg} * h_{t-1} + W_{xg} * x_t + b_g ] + * c_t := (f_t .* c_{t-1}) + (i_t .* g_t) + * h_t := o_t .* \tanh[c_t] + * In the implementation, the i, f, o, and g computations are performed as a + * single inner product. + * + * Notably, this implementation lacks the "diagonal" gates, as used in the + * LSTM architectures described by Alex Graves [3] and others. + * + * [1] Hochreiter, Sepp, and Schmidhuber, Jürgen. "Long short-term memory." + * Neural Computation 9, no. 8 (1997): 1735-1780. + * + * [2] Zaremba, Wojciech, and Sutskever, Ilya. "Learning to execute." + * arXiv preprint arXiv:1410.4615 (2014). + * + * [3] Graves, Alex. "Generating sequences with recurrent neural networks." + * arXiv preprint arXiv:1308.0850 (2013). + */ +template +class LSTMLayer : public RecurrentLayer { + public: + explicit LSTMLayer(const LayerParameter& param) + : RecurrentLayer(param) {} + + virtual inline const char* type() const { return "LSTM"; } + + protected: + virtual void FillUnrolledNet(NetParameter* net_param) const; + virtual void RecurrentInputBlobNames(vector* names) const; + virtual void RecurrentOutputBlobNames(vector* names) const; + virtual void RecurrentInputShapes(vector* shapes) const; + virtual void OutputBlobNames(vector* names) const; +}; + +/** + * @brief A helper for LSTMLayer: computes a single timestep of the + * non-linearity of the LSTM, producing the updated cell and hidden + * states. + */ +template +class LSTMUnitLayer : public Layer { + public: + explicit LSTMUnitLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "LSTMUnit"; } + virtual inline int ExactNumBottomBlobs() const { return 3; } + virtual inline int ExactNumTopBlobs() const { return 2; } + + virtual inline bool AllowForceBackward(const int bottom_index) const { + // Can't propagate to sequence continuation indicators. + return bottom_index != 2; + } + + protected: + /** + * @param bottom input Blob vector (length 3) + * -# @f$ (1 \times N \times D) @f$ + * the previous timestep cell state @f$ c_{t-1} @f$ + * -# @f$ (1 \times N \times 4D) @f$ + * the "gate inputs" @f$ [i_t', f_t', o_t', g_t'] @f$ + * -# @f$ (1 \times N) @f$ + * the sequence continuation indicators @f$ \delta_t @f$ + * @param top output Blob vector (length 2) + * -# @f$ (1 \times N \times D) @f$ + * the updated cell state @f$ c_t @f$, computed as: + * i_t := \sigmoid[i_t'] + * f_t := \sigmoid[f_t'] + * o_t := \sigmoid[o_t'] + * g_t := \tanh[g_t'] + * c_t := cont_t * (f_t .* c_{t-1}) + (i_t .* g_t) + * -# @f$ (1 \times N \times D) @f$ + * the updated hidden state @f$ h_t @f$, computed as: + * h_t := o_t .* \tanh[c_t] + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the LSTMUnit inputs. + * + * @param top output Blob vector (length 2), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times N \times D) @f$: + * containing error gradients @f$ \frac{\partial E}{\partial c_t} @f$ + * with respect to the updated cell state @f$ c_t @f$ + * -# @f$ (1 \times N \times D) @f$: + * containing error gradients @f$ \frac{\partial E}{\partial h_t} @f$ + * with respect to the updated cell state @f$ h_t @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 3), into which the error gradients + * with respect to the LSTMUnit inputs @f$ c_{t-1} @f$ and the gate + * inputs are computed. Computatation of the error gradients w.r.t. + * the sequence indicators is not implemented. + * -# @f$ (1 \times N \times D) @f$ + * the error gradient w.r.t. the previous timestep cell state + * @f$ c_{t-1} @f$ + * -# @f$ (1 \times N \times 4D) @f$ + * the error gradient w.r.t. the "gate inputs" + * @f$ [ + * \frac{\partial E}{\partial i_t} + * \frac{\partial E}{\partial f_t} + * \frac{\partial E}{\partial o_t} + * \frac{\partial E}{\partial g_t} + * ] @f$ + * -# @f$ (1 \times 1 \times N) @f$ + * the gradient w.r.t. the sequence continuation indicators + * @f$ \delta_t @f$ is currently not computed. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// @brief The hidden and output dimension. + int hidden_dim_; + Blob X_acts_; +}; + +} // namespace caffe + +#endif // CAFFE_LSTM_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/memory_data_layer.hpp b/usr/local/include/caffe/layers/memory_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8abcc8c1b68fa9f1fb9e1349d633a0cd839cba94 --- /dev/null +++ b/usr/local/include/caffe/layers/memory_data_layer.hpp @@ -0,0 +1,63 @@ +#ifndef CAFFE_MEMORY_DATA_LAYER_HPP_ +#define CAFFE_MEMORY_DATA_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/base_data_layer.hpp" + +namespace caffe { + +/** + * @brief Provides data to the Net from memory. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class MemoryDataLayer : public BaseDataLayer { + public: + explicit MemoryDataLayer(const LayerParameter& param) + : BaseDataLayer(param), has_new_data_(false) {} + virtual void DataLayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "MemoryData"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int ExactNumTopBlobs() const { return 2; } + + virtual void AddDatumVector(const vector& datum_vector); +#ifdef USE_OPENCV + virtual void AddMatVector(const vector& mat_vector, + const vector& labels); +#endif // USE_OPENCV + + // Reset should accept const pointers, but can't, because the memory + // will be given to Blob, which is mutable + void Reset(Dtype* data, Dtype* label, int n); + void set_batch_size(int new_size); + + int batch_size() { return batch_size_; } + int channels() { return channels_; } + int height() { return height_; } + int width() { return width_; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + + int batch_size_, channels_, height_, width_, size_; + Dtype* data_; + Dtype* labels_; + int n_; + size_t pos_; + Blob added_data_; + Blob added_label_; + bool has_new_data_; +}; + +} // namespace caffe + +#endif // CAFFE_MEMORY_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/multinomial_logistic_loss_layer.hpp b/usr/local/include/caffe/layers/multinomial_logistic_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3977cf9ea57a54451af314a272e54a26675b7c5d --- /dev/null +++ b/usr/local/include/caffe/layers/multinomial_logistic_loss_layer.hpp @@ -0,0 +1,92 @@ +#ifndef CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_ +#define CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the multinomial logistic loss for a one-of-many + * classification task, directly taking a predicted probability + * distribution as input. + * + * When predictions are not already a probability distribution, you should + * instead use the SoftmaxWithLossLayer, which maps predictions to a + * distribution using the SoftmaxLayer, before computing the multinomial + * logistic loss. The SoftmaxWithLossLayer should be preferred over separate + * SoftmaxLayer + MultinomialLogisticLossLayer + * as its gradient computation is more numerically stable. + * + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ \hat{p} @f$, a Blob with values in + * @f$ [0, 1] @f$ indicating the predicted probability of each of the + * @f$ K = CHW @f$ classes. Each prediction vector @f$ \hat{p}_n @f$ + * should sum to 1 as in a probability distribution: @f$ + * \forall n \sum\limits_{k=1}^K \hat{p}_{nk} = 1 @f$. + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels @f$ l @f$, an integer-valued Blob with values + * @f$ l_n \in [0, 1, 2, ..., K - 1] @f$ + * indicating the correct class label among the @f$ K @f$ classes + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed multinomial logistic loss: @f$ E = + * \frac{-1}{N} \sum\limits_{n=1}^N \log(\hat{p}_{n,l_n}) + * @f$ + */ +template +class MultinomialLogisticLossLayer : public LossLayer { + public: + explicit MultinomialLogisticLossLayer(const LayerParameter& param) + : LossLayer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "MultinomialLogisticLoss"; } + + protected: + /// @copydoc MultinomialLogisticLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the multinomial logistic loss error gradient w.r.t. the + * predictions. + * + * Gradients cannot be computed with respect to the label inputs (bottom[1]), + * so this method ignores bottom[1] and requires !propagate_down[1], crashing + * if propagate_down[1] is set. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * propagate_down[1] must be false as we can't compute gradients with + * respect to the labels. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ \hat{p} @f$; Backward computes diff + * @f$ \frac{\partial E}{\partial \hat{p}} @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels -- ignored as we can't compute their error gradients + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_MULTINOMIAL_LOGISTIC_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/mvn_layer.hpp b/usr/local/include/caffe/layers/mvn_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3a235ceca648c716b6a35ce68fca2e688dfbd067 --- /dev/null +++ b/usr/local/include/caffe/layers/mvn_layer.hpp @@ -0,0 +1,48 @@ +#ifndef CAFFE_MVN_LAYER_HPP_ +#define CAFFE_MVN_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Normalizes the input to have 0-mean and/or unit (1) variance. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class MVNLayer : public Layer { + public: + explicit MVNLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "MVN"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + Blob mean_, variance_, temp_; + + /// sum_multiplier is used to carry out sum using BLAS + Blob sum_multiplier_; + Dtype eps_; +}; + +} // namespace caffe + +#endif // CAFFE_MVN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/neuron_layer.hpp b/usr/local/include/caffe/layers/neuron_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10c108ce682a59d356c7ed531d94897571505c38 --- /dev/null +++ b/usr/local/include/caffe/layers/neuron_layer.hpp @@ -0,0 +1,32 @@ +#ifndef CAFFE_NEURON_LAYER_HPP_ +#define CAFFE_NEURON_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief An interface for layers that take one blob as input (@f$ x @f$) + * and produce one equally-sized blob as output (@f$ y @f$), where + * each element of the output depends only on the corresponding input + * element. + */ +template +class NeuronLayer : public Layer { + public: + explicit NeuronLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } +}; + +} // namespace caffe + +#endif // CAFFE_NEURON_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/parameter_layer.hpp b/usr/local/include/caffe/layers/parameter_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..188b92acbe224571f470ba6bc438e17a89518313 --- /dev/null +++ b/usr/local/include/caffe/layers/parameter_layer.hpp @@ -0,0 +1,45 @@ +#ifndef CAFFE_PARAMETER_LAYER_HPP_ +#define CAFFE_PARAMETER_LAYER_HPP_ + +#include + +#include "caffe/layer.hpp" + +namespace caffe { + +template +class ParameterLayer : public Layer { + public: + explicit ParameterLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top) { + if (this->blobs_.size() > 0) { + LOG(INFO) << "Skipping parameter initialization"; + } else { + this->blobs_.resize(1); + this->blobs_[0].reset(new Blob()); + this->blobs_[0]->Reshape(this->layer_param_.parameter_param().shape()); + } + top[0]->Reshape(this->layer_param_.parameter_param().shape()); + } + virtual void Reshape(const vector*>& bottom, + const vector*>& top) { } + virtual inline const char* type() const { return "Parameter"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) { + top[0]->ShareData(*(this->blobs_[0])); + top[0]->ShareDiff(*(this->blobs_[0])); + } + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) + { } +}; + +} // namespace caffe + +#endif diff --git a/usr/local/include/caffe/layers/pooling_layer.hpp b/usr/local/include/caffe/layers/pooling_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..38a432832cf1870b7cebd4f04ab874fe35b17002 --- /dev/null +++ b/usr/local/include/caffe/layers/pooling_layer.hpp @@ -0,0 +1,61 @@ +#ifndef CAFFE_POOLING_LAYER_HPP_ +#define CAFFE_POOLING_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Pools the input image by taking the max, average, etc. within regions. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class PoolingLayer : public Layer { + public: + explicit PoolingLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Pooling"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int MinTopBlobs() const { return 1; } + // MAX POOL layers can output an extra top blob for the mask; + // others can only output the pooled inputs. + virtual inline int MaxTopBlobs() const { + return (this->layer_param_.pooling_param().pool() == + PoolingParameter_PoolMethod_MAX) ? 2 : 1; + } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int kernel_h_, kernel_w_; + int stride_h_, stride_w_; + int pad_h_, pad_w_; + int channels_; + int height_, width_; + int pooled_height_, pooled_width_; + bool global_pooling_; + PoolingParameter_RoundMode round_mode_; + Blob rand_idx_; + Blob max_idx_; +}; + +} // namespace caffe + +#endif // CAFFE_POOLING_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/power_layer.hpp b/usr/local/include/caffe/layers/power_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6ecbafcaca83784fdb36df36070595dd4eb5ab0d --- /dev/null +++ b/usr/local/include/caffe/layers/power_layer.hpp @@ -0,0 +1,89 @@ +#ifndef CAFFE_POWER_LAYER_HPP_ +#define CAFFE_POWER_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Computes @f$ y = (\alpha x + \beta) ^ \gamma @f$, + * as specified by the scale @f$ \alpha @f$, shift @f$ \beta @f$, + * and power @f$ \gamma @f$. + */ +template +class PowerLayer : public NeuronLayer { + public: + /** + * @param param provides PowerParameter power_param, + * with PowerLayer options: + * - scale (\b optional, default 1) the scale @f$ \alpha @f$ + * - shift (\b optional, default 0) the shift @f$ \beta @f$ + * - power (\b optional, default 1) the power @f$ \gamma @f$ + */ + explicit PowerLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Power"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = (\alpha x + \beta) ^ \gamma + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the power inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = + * \frac{\partial E}{\partial y} + * \alpha \gamma (\alpha x + \beta) ^ {\gamma - 1} = + * \frac{\partial E}{\partial y} + * \frac{\alpha \gamma y}{\alpha x + \beta} + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// @brief @f$ \gamma @f$ from layer_param_.power_param() + Dtype power_; + /// @brief @f$ \alpha @f$ from layer_param_.power_param() + Dtype scale_; + /// @brief @f$ \beta @f$ from layer_param_.power_param() + Dtype shift_; + /// @brief Result of @f$ \alpha \gamma @f$ + Dtype diff_scale_; +}; + +} // namespace caffe + +#endif // CAFFE_POWER_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/prelu_layer.hpp b/usr/local/include/caffe/layers/prelu_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ddfb484b66203258cd84677264b0497820256f1 --- /dev/null +++ b/usr/local/include/caffe/layers/prelu_layer.hpp @@ -0,0 +1,101 @@ +#ifndef CAFFE_PRELU_LAYER_HPP_ +#define CAFFE_PRELU_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Parameterized Rectified Linear Unit non-linearity @f$ + * y_i = \max(0, x_i) + a_i \min(0, x_i) + * @f$. The differences from ReLULayer are 1) negative slopes are + * learnable though backprop and 2) negative slopes can vary across + * channels. The number of axes of input blob should be greater than or + * equal to 2. The 1st axis (0-based) is seen as channels. + */ +template +class PReLULayer : public NeuronLayer { + public: + /** + * @param param provides PReLUParameter prelu_param, + * with PReLULayer options: + * - filler (\b optional, FillerParameter, + * default {'type': constant 'value':0.25}). + * - channel_shared (\b optional, default false). + * negative slopes are shared across channels. + */ + explicit PReLULayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "PReLU"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times ...) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times ...) @f$ + * the computed outputs for each channel @f$i@f$ @f$ + * y_i = \max(0, x_i) + a_i \min(0, x_i) + * @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the PReLU inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times ...) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times ...) @f$ + * the inputs @f$ x @f$; For each channel @f$i@f$, backward fills their + * diff with gradients @f$ + * \frac{\partial E}{\partial x_i} = \left\{ + * \begin{array}{lr} + * a_i \frac{\partial E}{\partial y_i} & \mathrm{if} \; x_i \le 0 \\ + * \frac{\partial E}{\partial y_i} & \mathrm{if} \; x_i > 0 + * \end{array} \right. + * @f$. + * If param_propagate_down_[0] is true, it fills the diff with gradients + * @f$ + * \frac{\partial E}{\partial a_i} = \left\{ + * \begin{array}{lr} + * \sum_{x_i} x_i \frac{\partial E}{\partial y_i} & \mathrm{if} \; x_i \le 0 \\ + * 0 & \mathrm{if} \; x_i > 0 + * \end{array} \right. + * @f$. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + bool channel_shared_; + Blob multiplier_; // dot multiplier for backward computation of params + Blob backward_buff_; // temporary buffer for backward computation + Blob bottom_memory_; // memory for in-place computation +}; + +} // namespace caffe + +#endif // CAFFE_PRELU_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/python_layer.hpp b/usr/local/include/caffe/layers/python_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1407d9217aab8552ed03efacd4d81c60bb8256e7 --- /dev/null +++ b/usr/local/include/caffe/layers/python_layer.hpp @@ -0,0 +1,55 @@ +#ifndef CAFFE_PYTHON_LAYER_HPP_ +#define CAFFE_PYTHON_LAYER_HPP_ + +#include +#include + +#include "caffe/layer.hpp" + +namespace bp = boost::python; + +namespace caffe { + +template +class PythonLayer : public Layer { + public: + PythonLayer(PyObject* self, const LayerParameter& param) + : Layer(param), self_(bp::handle<>(bp::borrowed(self))) { } + + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top) { + // Disallow PythonLayer in MultiGPU training stage, due to GIL issues + // Details: https://github.com/BVLC/caffe/issues/2936 + if (this->phase_ == TRAIN && Caffe::solver_count() > 1 + && !Caffe::multiprocess()) { + LOG(FATAL) << "PythonLayer does not support CLI Multi-GPU, use train.py"; + } + self_.attr("param_str") = bp::str( + this->layer_param_.python_param().param_str()); + self_.attr("phase") = static_cast(this->phase_); + self_.attr("setup")(bottom, top); + } + virtual void Reshape(const vector*>& bottom, + const vector*>& top) { + self_.attr("reshape")(bottom, top); + } + + virtual inline const char* type() const { return "Python"; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) { + self_.attr("forward")(bottom, top); + } + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) { + self_.attr("backward")(top, propagate_down, bottom); + } + + private: + bp::object self_; +}; + +} // namespace caffe + +#endif diff --git a/usr/local/include/caffe/layers/recurrent_layer.hpp b/usr/local/include/caffe/layers/recurrent_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca17371b994b887e5f23451c57be1027ca5103c0 --- /dev/null +++ b/usr/local/include/caffe/layers/recurrent_layer.hpp @@ -0,0 +1,187 @@ +#ifndef CAFFE_RECURRENT_LAYER_HPP_ +#define CAFFE_RECURRENT_LAYER_HPP_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/layer.hpp" +#include "caffe/net.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/format.hpp" + +namespace caffe { + +template class RecurrentLayer; + +/** + * @brief An abstract class for implementing recurrent behavior inside of an + * unrolled network. This Layer type cannot be instantiated -- instead, + * you should use one of its implementations which defines the recurrent + * architecture, such as RNNLayer or LSTMLayer. + */ +template +class RecurrentLayer : public Layer { + public: + explicit RecurrentLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + virtual void Reset(); + + virtual inline const char* type() const { return "Recurrent"; } + virtual inline int MinBottomBlobs() const { + int min_bottoms = 2; + if (this->layer_param_.recurrent_param().expose_hidden()) { + vector inputs; + this->RecurrentInputBlobNames(&inputs); + min_bottoms += inputs.size(); + } + return min_bottoms; + } + virtual inline int MaxBottomBlobs() const { return MinBottomBlobs() + 1; } + virtual inline int ExactNumTopBlobs() const { + int num_tops = 1; + if (this->layer_param_.recurrent_param().expose_hidden()) { + vector outputs; + this->RecurrentOutputBlobNames(&outputs); + num_tops += outputs.size(); + } + return num_tops; + } + + virtual inline bool AllowForceBackward(const int bottom_index) const { + // Can't propagate to sequence continuation indicators. + return bottom_index != 1; + } + + protected: + /** + * @brief Fills net_param with the recurrent network architecture. Subclasses + * should define this -- see RNNLayer and LSTMLayer for examples. + */ + virtual void FillUnrolledNet(NetParameter* net_param) const = 0; + + /** + * @brief Fills names with the names of the 0th timestep recurrent input + * Blob&s. Subclasses should define this -- see RNNLayer and LSTMLayer + * for examples. + */ + virtual void RecurrentInputBlobNames(vector* names) const = 0; + + /** + * @brief Fills shapes with the shapes of the recurrent input Blob&s. + * Subclasses should define this -- see RNNLayer and LSTMLayer + * for examples. + */ + virtual void RecurrentInputShapes(vector* shapes) const = 0; + + /** + * @brief Fills names with the names of the Tth timestep recurrent output + * Blob&s. Subclasses should define this -- see RNNLayer and LSTMLayer + * for examples. + */ + virtual void RecurrentOutputBlobNames(vector* names) const = 0; + + /** + * @brief Fills names with the names of the output blobs, concatenated across + * all timesteps. Should return a name for each top Blob. + * Subclasses should define this -- see RNNLayer and LSTMLayer for + * examples. + */ + virtual void OutputBlobNames(vector* names) const = 0; + + /** + * @param bottom input Blob vector (length 2-3) + * + * -# @f$ (T \times N \times ...) @f$ + * the time-varying input @f$ x @f$. After the first two axes, whose + * dimensions must correspond to the number of timesteps @f$ T @f$ and + * the number of independent streams @f$ N @f$, respectively, its + * dimensions may be arbitrary. Note that the ordering of dimensions -- + * @f$ (T \times N \times ...) @f$, rather than + * @f$ (N \times T \times ...) @f$ -- means that the @f$ N @f$ + * independent input streams must be "interleaved". + * + * -# @f$ (T \times N) @f$ + * the sequence continuation indicators @f$ \delta @f$. + * These inputs should be binary (0 or 1) indicators, where + * @f$ \delta_{t,n} = 0 @f$ means that timestep @f$ t @f$ of stream + * @f$ n @f$ is the beginning of a new sequence, and hence the previous + * hidden state @f$ h_{t-1} @f$ is multiplied by @f$ \delta_t = 0 @f$ + * and has no effect on the cell's output at timestep @f$ t @f$, and + * a value of @f$ \delta_{t,n} = 1 @f$ means that timestep @f$ t @f$ of + * stream @f$ n @f$ is a continuation from the previous timestep + * @f$ t-1 @f$, and the previous hidden state @f$ h_{t-1} @f$ affects the + * updated hidden state and output. + * + * -# @f$ (N \times ...) @f$ (optional) + * the static (non-time-varying) input @f$ x_{static} @f$. + * After the first axis, whose dimension must be the number of + * independent streams, its dimensions may be arbitrary. + * This is mathematically equivalent to using a time-varying input of + * @f$ x'_t = [x_t; x_{static}] @f$ -- i.e., tiling the static input + * across the @f$ T @f$ timesteps and concatenating with the time-varying + * input. Note that if this input is used, all timesteps in a single + * batch within a particular one of the @f$ N @f$ streams must share the + * same static input, even if the sequence continuation indicators + * suggest that difference sequences are ending and beginning within a + * single batch. This may require padding and/or truncation for uniform + * length. + * + * @param top output Blob vector (length 1) + * -# @f$ (T \times N \times D) @f$ + * the time-varying output @f$ y @f$, where @f$ D @f$ is + * recurrent_param.num_output(). + * Refer to documentation for particular RecurrentLayer implementations + * (such as RNNLayer and LSTMLayer) for the definition of @f$ y @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// @brief A Net to implement the Recurrent functionality. + shared_ptr > unrolled_net_; + + /// @brief The number of independent streams to process simultaneously. + int N_; + + /** + * @brief The number of timesteps in the layer's input, and the number of + * timesteps over which to backpropagate through time. + */ + int T_; + + /// @brief Whether the layer has a "static" input copied across all timesteps. + bool static_input_; + + /** + * @brief The last layer to run in the network. (Any later layers are losses + * added to force the recurrent net to do backprop.) + */ + int last_layer_index_; + + /** + * @brief Whether the layer's hidden state at the first and last timesteps + * are layer inputs and outputs, respectively. + */ + bool expose_hidden_; + + vector* > recur_input_blobs_; + vector* > recur_output_blobs_; + vector* > output_blobs_; + Blob* x_input_blob_; + Blob* x_static_input_blob_; + Blob* cont_input_blob_; +}; + +} // namespace caffe + +#endif // CAFFE_RECURRENT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/reduction_layer.hpp b/usr/local/include/caffe/layers/reduction_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..804a495b11cfd3932caf0073000a5dd28eda6e4e --- /dev/null +++ b/usr/local/include/caffe/layers/reduction_layer.hpp @@ -0,0 +1,59 @@ +#ifndef CAFFE_REDUCTION_LAYER_HPP_ +#define CAFFE_REDUCTION_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Compute "reductions" -- operations that return a scalar output Blob + * for an input Blob of arbitrary size, such as the sum, absolute sum, + * and sum of squares. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class ReductionLayer : public Layer { + public: + explicit ReductionLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Reduction"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// @brief the reduction operation performed by the layer + ReductionParameter_ReductionOp op_; + /// @brief a scalar coefficient applied to all outputs + Dtype coeff_; + /// @brief the index of the first input axis to reduce + int axis_; + /// @brief the number of reductions performed + int num_; + /// @brief the input size of each reduction + int dim_; + /// @brief a helper Blob used for summation (op_ == SUM) + Blob sum_multiplier_; +}; + +} // namespace caffe + +#endif // CAFFE_REDUCTION_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/relu_layer.hpp b/usr/local/include/caffe/layers/relu_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d7a73f7a8d178fad1cac4a6c5b0e6a3b41bf32ca --- /dev/null +++ b/usr/local/include/caffe/layers/relu_layer.hpp @@ -0,0 +1,85 @@ +#ifndef CAFFE_RELU_LAYER_HPP_ +#define CAFFE_RELU_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Rectified Linear Unit non-linearity @f$ y = \max(0, x) @f$. + * The simple max is fast to compute, and the function does not saturate. + */ +template +class ReLULayer : public NeuronLayer { + public: + /** + * @param param provides ReLUParameter relu_param, + * with ReLULayer options: + * - negative_slope (\b optional, default 0). + * the value @f$ \nu @f$ by which negative values are multiplied. + */ + explicit ReLULayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "ReLU"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \max(0, x) + * @f$ by default. If a non-zero negative_slope @f$ \nu @f$ is provided, + * the computed outputs are @f$ y = \max(0, x) + \nu \min(0, x) @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the ReLU inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} = \left\{ + * \begin{array}{lr} + * 0 & \mathrm{if} \; x \le 0 \\ + * \frac{\partial E}{\partial y} & \mathrm{if} \; x > 0 + * \end{array} \right. + * @f$ if propagate_down[0], by default. + * If a non-zero negative_slope @f$ \nu @f$ is provided, + * the computed gradients are @f$ + * \frac{\partial E}{\partial x} = \left\{ + * \begin{array}{lr} + * \nu \frac{\partial E}{\partial y} & \mathrm{if} \; x \le 0 \\ + * \frac{\partial E}{\partial y} & \mathrm{if} \; x > 0 + * \end{array} \right. + * @f$. + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_RELU_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/reshape_layer.hpp b/usr/local/include/caffe/layers/reshape_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d11e06384cea222ed10fbcc52a061413df1bdfaa --- /dev/null +++ b/usr/local/include/caffe/layers/reshape_layer.hpp @@ -0,0 +1,52 @@ +#ifndef CAFFE_XXX_LAYER_HPP_ +#define CAFFE_XXX_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/* + * @brief Reshapes the input Blob into an arbitrary-sized output Blob. + * + * Note: similarly to FlattenLayer, this layer does not change the input values + * (see FlattenLayer, Blob::ShareData and Blob::ShareDiff). + */ +template +class ReshapeLayer : public Layer { + public: + explicit ReshapeLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Reshape"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) {} + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top) {} + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) {} + + /// @brief vector of axes indices whose dimensions we'll copy from the bottom + vector copy_axes_; + /// @brief the index of the axis whose dimension we infer, or -1 if none + int inferred_axis_; + /// @brief the product of the "constant" output dimensions + int constant_count_; +}; + +} // namespace caffe + +#endif // CAFFE_XXX_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/rnn_layer.hpp b/usr/local/include/caffe/layers/rnn_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6dce238ae174a5b1de51868ad7dee6476362bd8a --- /dev/null +++ b/usr/local/include/caffe/layers/rnn_layer.hpp @@ -0,0 +1,47 @@ +#ifndef CAFFE_RNN_LAYER_HPP_ +#define CAFFE_RNN_LAYER_HPP_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/layer.hpp" +#include "caffe/layers/recurrent_layer.hpp" +#include "caffe/net.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +template class RecurrentLayer; + +/** + * @brief Processes time-varying inputs using a simple recurrent neural network + * (RNN). Implemented as a network unrolling the RNN computation in time. + * + * Given time-varying inputs @f$ x_t @f$, computes hidden state @f$ + * h_t := \tanh[ W_{hh} h_{t_1} + W_{xh} x_t + b_h ] + * @f$, and outputs @f$ + * o_t := \tanh[ W_{ho} h_t + b_o ] + * @f$. + */ +template +class RNNLayer : public RecurrentLayer { + public: + explicit RNNLayer(const LayerParameter& param) + : RecurrentLayer(param) {} + + virtual inline const char* type() const { return "RNN"; } + + protected: + virtual void FillUnrolledNet(NetParameter* net_param) const; + virtual void RecurrentInputBlobNames(vector* names) const; + virtual void RecurrentOutputBlobNames(vector* names) const; + virtual void RecurrentInputShapes(vector* shapes) const; + virtual void OutputBlobNames(vector* names) const; +}; + +} // namespace caffe + +#endif // CAFFE_RNN_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/scale_layer.hpp b/usr/local/include/caffe/layers/scale_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..45b714d40275b084f6787a0838eb8e700f0697fa --- /dev/null +++ b/usr/local/include/caffe/layers/scale_layer.hpp @@ -0,0 +1,85 @@ +#ifndef CAFFE_SCALE_LAYER_HPP_ +#define CAFFE_SCALE_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/bias_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the elementwise product of two input Blobs, with the shape of + * the latter Blob "broadcast" to match the shape of the former. + * Equivalent to tiling the latter Blob, then computing the elementwise + * product. Note: for efficiency and convenience, this layer can + * additionally perform a "broadcast" sum too when `bias_term: true` + * is set. + * + * The latter, scale input may be omitted, in which case it's learned as + * parameter of the layer (as is the bias, if it is included). + */ +template +class ScaleLayer: public Layer { + public: + explicit ScaleLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Scale"; } + // Scale + virtual inline int MinBottomBlobs() const { return 1; } + virtual inline int MaxBottomBlobs() const { return 2; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + /** + * In the below shape specifications, @f$ i @f$ denotes the value of the + * `axis` field given by `this->layer_param_.scale_param().axis()`, after + * canonicalization (i.e., conversion from negative to positive index, + * if applicable). + * + * @param bottom input Blob vector (length 2) + * -# @f$ (d_0 \times ... \times + * d_i \times ... \times d_j \times ... \times d_n) @f$ + * the first factor @f$ x @f$ + * -# @f$ (d_i \times ... \times d_j) @f$ + * the second factor @f$ y @f$ + * @param top output Blob vector (length 1) + * -# @f$ (d_0 \times ... \times + * d_i \times ... \times d_j \times ... \times d_n) @f$ + * the product @f$ z = x y @f$ computed after "broadcasting" y. + * Equivalent to tiling @f$ y @f$ to have the same shape as @f$ x @f$, + * then computing the elementwise product. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + shared_ptr > bias_layer_; + vector*> bias_bottom_vec_; + vector bias_propagate_down_; + int bias_param_id_; + + Blob sum_multiplier_; + Blob sum_result_; + Blob temp_; + int axis_; + int outer_dim_, scale_dim_, inner_dim_; +}; + + +} // namespace caffe + +#endif // CAFFE_SCALE_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/sigmoid_cross_entropy_loss_layer.hpp b/usr/local/include/caffe/layers/sigmoid_cross_entropy_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d92524421c146898d7809fcb927f14335d5dcf9 --- /dev/null +++ b/usr/local/include/caffe/layers/sigmoid_cross_entropy_loss_layer.hpp @@ -0,0 +1,128 @@ +#ifndef CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ +#define CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" +#include "caffe/layers/sigmoid_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the cross-entropy (logistic) loss @f$ + * E = \frac{-1}{n} \sum\limits_{n=1}^N \left[ + * p_n \log \hat{p}_n + + * (1 - p_n) \log(1 - \hat{p}_n) + * \right] + * @f$, often used for predicting targets interpreted as probabilities. + * + * This layer is implemented rather than separate + * SigmoidLayer + CrossEntropyLayer + * as its gradient computation is more numerically stable. + * At test time, this layer can be replaced simply by a SigmoidLayer. + * + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the scores @f$ x \in [-\infty, +\infty]@f$, + * which this layer maps to probability predictions + * @f$ \hat{p}_n = \sigma(x_n) \in [0, 1] @f$ + * using the sigmoid function @f$ \sigma(.) @f$ (see SigmoidLayer). + * -# @f$ (N \times C \times H \times W) @f$ + * the targets @f$ y \in [0, 1] @f$ + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed cross-entropy loss: @f$ + * E = \frac{-1}{n} \sum\limits_{n=1}^N \left[ + * p_n \log \hat{p}_n + (1 - p_n) \log(1 - \hat{p}_n) + * \right] + * @f$ + */ +template +class SigmoidCrossEntropyLossLayer : public LossLayer { + public: + explicit SigmoidCrossEntropyLossLayer(const LayerParameter& param) + : LossLayer(param), + sigmoid_layer_(new SigmoidLayer(param)), + sigmoid_output_(new Blob()) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "SigmoidCrossEntropyLoss"; } + + protected: + /// @copydoc SigmoidCrossEntropyLossLayer + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the sigmoid cross-entropy loss error gradient w.r.t. the + * predictions. + * + * Gradients cannot be computed with respect to the target inputs (bottom[1]), + * so this method ignores bottom[1] and requires !propagate_down[1], crashing + * if propagate_down[1] is set. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * propagate_down[1] must be false as gradient computation with respect + * to the targets is not implemented. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$x@f$; Backward computes diff + * @f$ \frac{\partial E}{\partial x} = + * \frac{1}{n} \sum\limits_{n=1}^N (\hat{p}_n - p_n) + * @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels -- ignored as we can't compute their error gradients + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// Read the normalization mode parameter and compute the normalizer based + /// on the blob size. If normalization_mode is VALID, the count of valid + /// outputs will be read from valid_count, unless it is -1 in which case + /// all outputs are assumed to be valid. + virtual Dtype get_normalizer( + LossParameter_NormalizationMode normalization_mode, int valid_count); + + /// The internal SigmoidLayer used to map predictions to probabilities. + shared_ptr > sigmoid_layer_; + /// sigmoid_output stores the output of the SigmoidLayer. + shared_ptr > sigmoid_output_; + /// bottom vector holder to call the underlying SigmoidLayer::Forward + vector*> sigmoid_bottom_vec_; + /// top vector holder to call the underlying SigmoidLayer::Forward + vector*> sigmoid_top_vec_; + + /// Whether to ignore instances with a certain label. + bool has_ignore_label_; + /// The label indicating that an instance should be ignored. + int ignore_label_; + /// How to normalize the loss. + LossParameter_NormalizationMode normalization_; + Dtype normalizer_; + int outer_num_, inner_num_; +}; + +} // namespace caffe + +#endif // CAFFE_SIGMOID_CROSS_ENTROPY_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/sigmoid_layer.hpp b/usr/local/include/caffe/layers/sigmoid_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac0f6927feb61a57b45ffad1f31134627067d85b --- /dev/null +++ b/usr/local/include/caffe/layers/sigmoid_layer.hpp @@ -0,0 +1,71 @@ +#ifndef CAFFE_SIGMOID_LAYER_HPP_ +#define CAFFE_SIGMOID_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Sigmoid function non-linearity @f$ + * y = (1 + \exp(-x))^{-1} + * @f$, a classic choice in neural networks. + * + * Note that the gradient vanishes as the values move away from 0. + * The ReLULayer is often a better choice for this reason. + */ +template +class SigmoidLayer : public NeuronLayer { + public: + explicit SigmoidLayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "Sigmoid"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = (1 + \exp(-x))^{-1} + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the sigmoid inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} + * = \frac{\partial E}{\partial y} y (1 - y) + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_SIGMOID_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/silence_layer.hpp b/usr/local/include/caffe/layers/silence_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fba087fcef088e9b54ea9faa1ee14946a6309697 --- /dev/null +++ b/usr/local/include/caffe/layers/silence_layer.hpp @@ -0,0 +1,43 @@ +#ifndef CAFFE_SILENCE_LAYER_HPP_ +#define CAFFE_SILENCE_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Ignores bottom blobs while producing no top blobs. (This is useful + * to suppress outputs during testing.) + */ +template +class SilenceLayer : public Layer { + public: + explicit SilenceLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top) {} + + virtual inline const char* type() const { return "Silence"; } + virtual inline int MinBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 0; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top) {} + // We can't define Forward_gpu here, since STUB_GPU will provide + // its own definition for CPU_ONLY mode. + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_SILENCE_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/slice_layer.hpp b/usr/local/include/caffe/layers/slice_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10a0abb6eebb05097c57fa7029a75a0ea551d247 --- /dev/null +++ b/usr/local/include/caffe/layers/slice_layer.hpp @@ -0,0 +1,51 @@ +#ifndef CAFFE_SLICE_LAYER_HPP_ +#define CAFFE_SLICE_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Takes a Blob and slices it along either the num or channel dimension, + * outputting multiple sliced Blob results. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class SliceLayer : public Layer { + public: + explicit SliceLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Slice"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int count_; + int num_slices_; + int slice_size_; + int slice_axis_; + vector slice_point_; +}; + +} // namespace caffe + +#endif // CAFFE_SLICE_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/softmax_layer.hpp b/usr/local/include/caffe/layers/softmax_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c65b8703e432ed2d781fe1d12cd9795515230d6d --- /dev/null +++ b/usr/local/include/caffe/layers/softmax_layer.hpp @@ -0,0 +1,50 @@ +#ifndef CAFFE_SOFTMAX_LAYER_HPP_ +#define CAFFE_SOFTMAX_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Computes the softmax function. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class SoftmaxLayer : public Layer { + public: + explicit SoftmaxLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Softmax"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int outer_num_; + int inner_num_; + int softmax_axis_; + /// sum_multiplier is used to carry out sum using BLAS + Blob sum_multiplier_; + /// scale is an intermediate Blob to hold temporary results. + Blob scale_; +}; + +} // namespace caffe + +#endif // CAFFE_SOFTMAX_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/softmax_loss_layer.hpp b/usr/local/include/caffe/layers/softmax_loss_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f07e8a02cf16e478607ed99f9676d9f6e95b14d9 --- /dev/null +++ b/usr/local/include/caffe/layers/softmax_loss_layer.hpp @@ -0,0 +1,130 @@ +#ifndef CAFFE_SOFTMAX_WITH_LOSS_LAYER_HPP_ +#define CAFFE_SOFTMAX_WITH_LOSS_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/loss_layer.hpp" +#include "caffe/layers/softmax_layer.hpp" + +namespace caffe { + +/** + * @brief Computes the multinomial logistic loss for a one-of-many + * classification task, passing real-valued predictions through a + * softmax to get a probability distribution over classes. + * + * This layer should be preferred over separate + * SoftmaxLayer + MultinomialLogisticLossLayer + * as its gradient computation is more numerically stable. + * At test time, this layer can be replaced simply by a SoftmaxLayer. + * + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ x @f$, a Blob with values in + * @f$ [-\infty, +\infty] @f$ indicating the predicted score for each of + * the @f$ K = CHW @f$ classes. This layer maps these scores to a + * probability distribution over classes using the softmax function + * @f$ \hat{p}_{nk} = \exp(x_{nk}) / + * \left[\sum_{k'} \exp(x_{nk'})\right] @f$ (see SoftmaxLayer). + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels @f$ l @f$, an integer-valued Blob with values + * @f$ l_n \in [0, 1, 2, ..., K - 1] @f$ + * indicating the correct class label among the @f$ K @f$ classes + * @param top output Blob vector (length 1) + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * the computed cross-entropy classification loss: @f$ E = + * \frac{-1}{N} \sum\limits_{n=1}^N \log(\hat{p}_{n,l_n}) + * @f$, for softmax output class probabilites @f$ \hat{p} @f$ + */ +template +class SoftmaxWithLossLayer : public LossLayer { + public: + /** + * @param param provides LossParameter loss_param, with options: + * - ignore_label (optional) + * Specify a label value that should be ignored when computing the loss. + * - normalize (optional, default true) + * If true, the loss is normalized by the number of (nonignored) labels + * present; otherwise the loss is simply summed over spatial locations. + */ + explicit SoftmaxWithLossLayer(const LayerParameter& param) + : LossLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "SoftmaxWithLoss"; } + virtual inline int ExactNumTopBlobs() const { return -1; } + virtual inline int MinTopBlobs() const { return 1; } + virtual inline int MaxTopBlobs() const { return 2; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + /** + * @brief Computes the softmax loss error gradient w.r.t. the predictions. + * + * Gradients cannot be computed with respect to the label inputs (bottom[1]), + * so this method ignores bottom[1] and requires !propagate_down[1], crashing + * if propagate_down[1] is set. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (1 \times 1 \times 1 \times 1) @f$ + * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, + * as @f$ \lambda @f$ is the coefficient of this layer's output + * @f$\ell_i@f$ in the overall Net loss + * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence + * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. + * (*Assuming that this top Blob is not used as a bottom (input) by any + * other layer of the Net.) + * @param propagate_down see Layer::Backward. + * propagate_down[1] must be false as we can't compute gradients with + * respect to the labels. + * @param bottom input Blob vector (length 2) + * -# @f$ (N \times C \times H \times W) @f$ + * the predictions @f$ x @f$; Backward computes diff + * @f$ \frac{\partial E}{\partial x} @f$ + * -# @f$ (N \times 1 \times 1 \times 1) @f$ + * the labels -- ignored as we can't compute their error gradients + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// Read the normalization mode parameter and compute the normalizer based + /// on the blob size. If normalization_mode is VALID, the count of valid + /// outputs will be read from valid_count, unless it is -1 in which case + /// all outputs are assumed to be valid. + virtual Dtype get_normalizer( + LossParameter_NormalizationMode normalization_mode, int valid_count); + + /// The internal SoftmaxLayer used to map predictions to a distribution. + shared_ptr > softmax_layer_; + /// prob stores the output probability predictions from the SoftmaxLayer. + Blob prob_; + /// bottom vector holder used in call to the underlying SoftmaxLayer::Forward + vector*> softmax_bottom_vec_; + /// top vector holder used in call to the underlying SoftmaxLayer::Forward + vector*> softmax_top_vec_; + /// Whether to ignore instances with a certain label. + bool has_ignore_label_; + /// The label indicating that an instance should be ignored. + int ignore_label_; + /// How to normalize the output loss. + LossParameter_NormalizationMode normalization_; + + int softmax_axis_, outer_num_, inner_num_; +}; + +} // namespace caffe + +#endif // CAFFE_SOFTMAX_WITH_LOSS_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/split_layer.hpp b/usr/local/include/caffe/layers/split_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8140dfc7c4079a84e39170fda2c83f5628be10ee --- /dev/null +++ b/usr/local/include/caffe/layers/split_layer.hpp @@ -0,0 +1,45 @@ +#ifndef CAFFE_SPLIT_LAYER_HPP_ +#define CAFFE_SPLIT_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Creates a "split" path in the network by copying the bottom Blob + * into multiple top Blob%s to be used by multiple consuming layers. + * + * TODO(dox): thorough documentation for Forward, Backward, and proto params. + */ +template +class SplitLayer : public Layer { + public: + explicit SplitLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Split"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int MinTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + int count_; +}; + +} // namespace caffe + +#endif // CAFFE_SPLIT_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/spp_layer.hpp b/usr/local/include/caffe/layers/spp_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9f145cc77e3d42dc9ea1878fd0b4d349692185f1 --- /dev/null +++ b/usr/local/include/caffe/layers/spp_layer.hpp @@ -0,0 +1,76 @@ +#ifndef CAFFE_SPP_LAYER_HPP_ +#define CAFFE_SPP_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Does spatial pyramid pooling on the input image + * by taking the max, average, etc. within regions + * so that the result vector of different sized + * images are of the same size. + */ +template +class SPPLayer : public Layer { + public: + explicit SPPLayer(const LayerParameter& param) + : Layer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "SPP"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + // calculates the kernel and stride dimensions for the pooling layer, + // returns a correctly configured LayerParameter for a PoolingLayer + virtual LayerParameter GetPoolingParam(const int pyramid_level, + const int bottom_h, const int bottom_w, const SPPParameter spp_param); + + int pyramid_height_; + int bottom_h_, bottom_w_; + int num_; + int channels_; + int kernel_h_, kernel_w_; + int pad_h_, pad_w_; + bool reshaped_first_time_; + + /// the internal Split layer that feeds the pooling layers + shared_ptr > split_layer_; + /// top vector holder used in call to the underlying SplitLayer::Forward + vector*> split_top_vec_; + /// bottom vector holder used in call to the underlying PoolingLayer::Forward + vector*>*> pooling_bottom_vecs_; + /// the internal Pooling layers of different kernel sizes + vector > > pooling_layers_; + /// top vector holders used in call to the underlying PoolingLayer::Forward + vector*>*> pooling_top_vecs_; + /// pooling_outputs stores the outputs of the PoolingLayers + vector*> pooling_outputs_; + /// the internal Flatten layers that the Pooling layers feed into + vector*> flatten_layers_; + /// top vector holders used in call to the underlying FlattenLayer::Forward + vector*>*> flatten_top_vecs_; + /// flatten_outputs stores the outputs of the FlattenLayers + vector*> flatten_outputs_; + /// bottom vector holder used in call to the underlying ConcatLayer::Forward + vector*> concat_bottom_vec_; + /// the internal Concat layers that the Flatten layers feed into + shared_ptr > concat_layer_; +}; + +} // namespace caffe + +#endif // CAFFE_SPP_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/swish_layer.hpp b/usr/local/include/caffe/layers/swish_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d538ff6de826afb759e9ebccb6a2a363ede78292 --- /dev/null +++ b/usr/local/include/caffe/layers/swish_layer.hpp @@ -0,0 +1,96 @@ +#ifndef CAFFE_SWISH_LAYER_HPP_ +#define CAFFE_SWISH_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" +#include "caffe/layers/sigmoid_layer.hpp" + +namespace caffe { + +/** + * @brief Swish non-linearity @f$ y = x \sigma (\beta x) @f$. + * A novel activation function that tends to work better than ReLU [1]. + * + * [1] Prajit Ramachandran, Barret Zoph, Quoc V. Le. "Searching for + * Activation Functions". arXiv preprint arXiv:1710.05941v2 (2017). + */ +template +class SwishLayer : public NeuronLayer { + public: + /** + * @param param provides SwishParameter swish_param, + * with SwishLayer options: + * - beta (\b optional, default 1). + * the value @f$ \beta @f$ in the @f$ y = x \sigma (\beta x) @f$. + */ + explicit SwishLayer(const LayerParameter& param) + : NeuronLayer(param), + sigmoid_layer_(new SigmoidLayer(param)), + sigmoid_input_(new Blob()), + sigmoid_output_(new Blob()) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Swish"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = x \sigma (\beta x) + * @f$. + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the sigmoid inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} + * = \frac{\partial E}{\partial y}(\beta y + + * \sigma (\beta x)(1 - \beta y)) + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + /// The internal SigmoidLayer + shared_ptr > sigmoid_layer_; + /// sigmoid_input_ stores the input of the SigmoidLayer. + shared_ptr > sigmoid_input_; + /// sigmoid_output_ stores the output of the SigmoidLayer. + shared_ptr > sigmoid_output_; + /// bottom vector holder to call the underlying SigmoidLayer::Forward + vector*> sigmoid_bottom_vec_; + /// top vector holder to call the underlying SigmoidLayer::Forward + vector*> sigmoid_top_vec_; +}; + +} // namespace caffe + +#endif // CAFFE_SWISH_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/tanh_layer.hpp b/usr/local/include/caffe/layers/tanh_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8f95e9322d9f93cdc023eca3d97fc487b6c81cac --- /dev/null +++ b/usr/local/include/caffe/layers/tanh_layer.hpp @@ -0,0 +1,73 @@ +#ifndef CAFFE_TANH_LAYER_HPP_ +#define CAFFE_TANH_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief TanH hyperbolic tangent non-linearity @f$ + * y = \frac{\exp(2x) - 1}{\exp(2x) + 1} + * @f$, popular in auto-encoders. + * + * Note that the gradient vanishes as the values move away from 0. + * The ReLULayer is often a better choice for this reason. + */ +template +class TanHLayer : public NeuronLayer { + public: + explicit TanHLayer(const LayerParameter& param) + : NeuronLayer(param) {} + + virtual inline const char* type() const { return "TanH"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \frac{\exp(2x) - 1}{\exp(2x) + 1} + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + /** + * @brief Computes the error gradient w.r.t. the sigmoid inputs. + * + * @param top output Blob vector (length 1), providing the error gradient with + * respect to the outputs + * -# @f$ (N \times C \times H \times W) @f$ + * containing error gradients @f$ \frac{\partial E}{\partial y} @f$ + * with respect to computed outputs @f$ y @f$ + * @param propagate_down see Layer::Backward. + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$; Backward fills their diff with + * gradients @f$ + * \frac{\partial E}{\partial x} + * = \frac{\partial E}{\partial y} + * \left(1 - \left[\frac{\exp(2x) - 1}{exp(2x) + 1} \right]^2 \right) + * = \frac{\partial E}{\partial y} (1 - y^2) + * @f$ if propagate_down[0] + */ + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); +}; + +} // namespace caffe + +#endif // CAFFE_TANH_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/threshold_layer.hpp b/usr/local/include/caffe/layers/threshold_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3bf4db63e5c4d3fff420cfc00a3a1e6a990bed1d --- /dev/null +++ b/usr/local/include/caffe/layers/threshold_layer.hpp @@ -0,0 +1,64 @@ +#ifndef CAFFE_THRESHOLD_LAYER_HPP_ +#define CAFFE_THRESHOLD_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +#include "caffe/layers/neuron_layer.hpp" + +namespace caffe { + +/** + * @brief Tests whether the input exceeds a threshold: outputs 1 for inputs + * above threshold; 0 otherwise. + */ +template +class ThresholdLayer : public NeuronLayer { + public: + /** + * @param param provides ThresholdParameter threshold_param, + * with ThresholdLayer options: + * - threshold (\b optional, default 0). + * the threshold value @f$ t @f$ to which the input values are compared. + */ + explicit ThresholdLayer(const LayerParameter& param) + : NeuronLayer(param) {} + virtual void LayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Threshold"; } + + protected: + /** + * @param bottom input Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the inputs @f$ x @f$ + * @param top output Blob vector (length 1) + * -# @f$ (N \times C \times H \times W) @f$ + * the computed outputs @f$ + * y = \left\{ + * \begin{array}{lr} + * 0 & \mathrm{if} \; x \le t \\ + * 1 & \mathrm{if} \; x > t + * \end{array} \right. + * @f$ + */ + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + /// @brief Not implemented (non-differentiable function) + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom) { + NOT_IMPLEMENTED; + } + + Dtype threshold_; +}; + +} // namespace caffe + +#endif // CAFFE_THRESHOLD_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/tile_layer.hpp b/usr/local/include/caffe/layers/tile_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fbdbe2f0c530fd381635b0fead74df1b2a82a68a --- /dev/null +++ b/usr/local/include/caffe/layers/tile_layer.hpp @@ -0,0 +1,43 @@ +#ifndef CAFFE_TILE_LAYER_HPP_ +#define CAFFE_TILE_LAYER_HPP_ + +#include + +#include "caffe/blob.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Copy a Blob along specified dimensions. + */ +template +class TileLayer : public Layer { + public: + explicit TileLayer(const LayerParameter& param) + : Layer(param) {} + virtual void Reshape(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "Tile"; } + virtual inline int ExactNumBottomBlobs() const { return 1; } + virtual inline int ExactNumTopBlobs() const { return 1; } + + protected: + virtual void Forward_cpu(const vector*>& bottom, + const vector*>& top); + virtual void Forward_gpu(const vector*>& bottom, + const vector*>& top); + + virtual void Backward_cpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + virtual void Backward_gpu(const vector*>& top, + const vector& propagate_down, const vector*>& bottom); + + unsigned int axis_, tiles_, outer_dim_, inner_dim_; +}; + +} // namespace caffe + +#endif // CAFFE_TILE_LAYER_HPP_ diff --git a/usr/local/include/caffe/layers/window_data_layer.hpp b/usr/local/include/caffe/layers/window_data_layer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b9b66b7cf1da616c01400e779ca579b0ef4b4b4d --- /dev/null +++ b/usr/local/include/caffe/layers/window_data_layer.hpp @@ -0,0 +1,56 @@ +#ifndef CAFFE_WINDOW_DATA_LAYER_HPP_ +#define CAFFE_WINDOW_DATA_LAYER_HPP_ + +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/data_transformer.hpp" +#include "caffe/internal_thread.hpp" +#include "caffe/layer.hpp" +#include "caffe/layers/base_data_layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Provides data to the Net from windows of images files, specified + * by a window data file. This layer is *DEPRECATED* and only kept for + * archival purposes for use by the original R-CNN. + * + * TODO(dox): thorough documentation for Forward and proto params. + */ +template +class WindowDataLayer : public BasePrefetchingDataLayer { + public: + explicit WindowDataLayer(const LayerParameter& param) + : BasePrefetchingDataLayer(param) {} + virtual ~WindowDataLayer(); + virtual void DataLayerSetUp(const vector*>& bottom, + const vector*>& top); + + virtual inline const char* type() const { return "WindowData"; } + virtual inline int ExactNumBottomBlobs() const { return 0; } + virtual inline int ExactNumTopBlobs() const { return 2; } + + protected: + virtual unsigned int PrefetchRand(); + virtual void load_batch(Batch* batch); + + shared_ptr prefetch_rng_; + vector > > image_database_; + enum WindowField { IMAGE_INDEX, LABEL, OVERLAP, X1, Y1, X2, Y2, NUM }; + vector > fg_windows_; + vector > bg_windows_; + Blob data_mean_; + vector mean_values_; + bool has_mean_file_; + bool has_mean_values_; + bool cache_images_; + vector > image_database_cache_; +}; + +} // namespace caffe + +#endif // CAFFE_WINDOW_DATA_LAYER_HPP_ diff --git a/usr/local/include/caffe/net.hpp b/usr/local/include/caffe/net.hpp new file mode 100644 index 0000000000000000000000000000000000000000..143d5d2888370123979526c62ef3249c6c05a5b7 --- /dev/null +++ b/usr/local/include/caffe/net.hpp @@ -0,0 +1,345 @@ +#ifndef CAFFE_NET_HPP_ +#define CAFFE_NET_HPP_ + +#include +#include +#include +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +/** + * @brief Connects Layer%s together into a directed acyclic graph (DAG) + * specified by a NetParameter. + * + * TODO(dox): more thorough description. + */ +template +class Net { + public: + explicit Net(const NetParameter& param); + explicit Net(const string& param_file, Phase phase, + const int level = 0, const vector* stages = NULL); + virtual ~Net() {} + + /// @brief Initialize a network with a NetParameter. + void Init(const NetParameter& param); + + /** + * @brief Run Forward and return the result. + * + */ + const vector*>& Forward(Dtype* loss = NULL); + /// @brief DEPRECATED; use Forward() instead. + const vector*>& 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 + * (topological) ordering by which the net is specified. For general DAG + * networks, note that (1) computing from one layer to another might entail + * extra computation on unrelated branches, and (2) computation starting in + * the middle may be incorrect if all of the layers of a fan-in are not + * included. + */ + Dtype ForwardFromTo(int start, int end); + Dtype ForwardFrom(int start); + Dtype ForwardTo(int end); + /// @brief DEPRECATED; set input blobs then use Forward() instead. + const vector*>& Forward(const vector* > & bottom, + Dtype* loss = NULL); + + /** + * @brief Zeroes out the diffs of all net parameters. + * Should be run before Backward. + */ + void ClearParamDiffs(); + + /** + * The network backward should take no input and output, since it solely + * computes the gradient w.r.t the parameters, and the data has already been + * provided during the forward pass. + */ + void Backward(); + void BackwardFromTo(int start, int end); + void BackwardFrom(int start); + void BackwardTo(int end); + + /** + * @brief Reshape all layers from bottom to top. + * + * This is useful to propagate changes to layer sizes without running + * a forward pass, e.g. to compute output feature size. + */ + void Reshape(); + + Dtype ForwardBackward() { + Dtype loss; + Forward(&loss); + Backward(); + return loss; + } + + /// @brief Updates the network weights based on the diff values computed. + void Update(); + /** + * @brief Shares weight data of owner blobs with shared blobs. + * + * Note: this is called by Net::Init, and thus should normally not be + * called manually. + */ + void ShareWeights(); + + /** + * @brief For an already initialized net, implicitly copies (i.e., using no + * additional memory) the pre-trained layers from another Net. + */ + void ShareTrainedLayersWith(const Net* other); + // For an already initialized net, CopyTrainedLayersFrom() copies the already + // trained layers from another net parameter instance. + /** + * @brief For an already initialized net, copies the pre-trained layers from + * another Net. + */ + void CopyTrainedLayersFrom(const NetParameter& param); + void CopyTrainedLayersFrom(const string& trained_filename); + void CopyTrainedLayersFromBinaryProto(const string& trained_filename); + void CopyTrainedLayersFromHDF5(const string& trained_filename); + /// @brief Writes the net to a proto. + void ToProto(NetParameter* param, bool write_diff = false) const; + /// @brief Writes the net to an HDF5 file. + void ToHDF5(const string& filename, bool write_diff = false) const; + + /// @brief returns the network name. + inline const string& name() const { return name_; } + /// @brief returns the layer names + inline const vector& layer_names() const { return layer_names_; } + /// @brief returns the blob names + inline const vector& blob_names() const { return blob_names_; } + /// @brief returns the blobs + inline const vector > >& blobs() const { + return blobs_; + } + /// @brief returns the layers + inline const vector > >& layers() const { + return layers_; + } + /// @brief returns the phase: TRAIN or TEST + inline Phase phase() const { return phase_; } + /** + * @brief returns the bottom vecs for each layer -- usually you won't + * need this unless you do per-layer checks such as gradients. + */ + inline const vector*> >& bottom_vecs() const { + return bottom_vecs_; + } + /** + * @brief returns the top vecs for each layer -- usually you won't + * need this unless you do per-layer checks such as gradients. + */ + inline const vector*> >& top_vecs() const { + return top_vecs_; + } + /// @brief returns the ids of the top blobs of layer i + inline const vector & top_ids(int i) const { + CHECK_GE(i, 0) << "Invalid layer id"; + CHECK_LT(i, top_id_vecs_.size()) << "Invalid layer id"; + return top_id_vecs_[i]; + } + /// @brief returns the ids of the bottom blobs of layer i + inline const vector & bottom_ids(int i) const { + CHECK_GE(i, 0) << "Invalid layer id"; + CHECK_LT(i, bottom_id_vecs_.size()) << "Invalid layer id"; + return bottom_id_vecs_[i]; + } + inline const vector >& bottom_need_backward() const { + return bottom_need_backward_; + } + inline const vector& blob_loss_weights() const { + return blob_loss_weights_; + } + inline const vector& layer_need_backward() const { + return layer_need_backward_; + } + /// @brief returns the parameters + inline const vector > >& params() const { + return params_; + } + inline const vector*>& learnable_params() const { + return learnable_params_; + } + /// @brief returns the learnable parameter learning rate multipliers + inline const vector& params_lr() const { return params_lr_; } + inline const vector& has_params_lr() const { return has_params_lr_; } + /// @brief returns the learnable parameter decay multipliers + inline const vector& params_weight_decay() const { + return params_weight_decay_; + } + inline const vector& has_params_decay() const { + return has_params_decay_; + } + const map& param_names_index() const { + return param_names_index_; + } + inline const vector& param_owners() const { return param_owners_; } + inline const vector& param_display_names() const { + return param_display_names_; + } + /// @brief Input and output blob numbers + inline int num_inputs() const { return net_input_blobs_.size(); } + inline int num_outputs() const { return net_output_blobs_.size(); } + inline const vector*>& input_blobs() const { + return net_input_blobs_; + } + inline const vector*>& output_blobs() const { + return net_output_blobs_; + } + inline const vector& input_blob_indices() const { + return net_input_blob_indices_; + } + inline const vector& output_blob_indices() const { + return net_output_blob_indices_; + } + bool has_blob(const string& blob_name) const; + const shared_ptr > blob_by_name(const string& blob_name) const; + bool has_layer(const string& layer_name) const; + const shared_ptr > layer_by_name(const string& layer_name) const; + + void set_debug_info(const bool value) { debug_info_ = value; } + + // Helpers for Init. + /** + * @brief Remove layers that the user specified should be excluded given the current + * phase, level, and stage. + */ + static void FilterNet(const NetParameter& param, + NetParameter* param_filtered); + /// @brief return whether NetState state meets NetStateRule rule + static bool StateMeetsRule(const NetState& state, const NetStateRule& rule, + const string& layer_name); + + // Invoked at specific points during an iteration + class Callback { + protected: + virtual void run(int layer) = 0; + + template + friend class Net; + }; + const vector& before_forward() const { return before_forward_; } + void add_before_forward(Callback* value) { + before_forward_.push_back(value); + } + const vector& after_forward() const { return after_forward_; } + void add_after_forward(Callback* value) { + after_forward_.push_back(value); + } + const vector& before_backward() const { return before_backward_; } + void add_before_backward(Callback* value) { + before_backward_.push_back(value); + } + const vector& after_backward() const { return after_backward_; } + void add_after_backward(Callback* value) { + after_backward_.push_back(value); + } + + protected: + // Helpers for Init. + /// @brief Append a new top blob to the net. + void AppendTop(const NetParameter& param, const int layer_id, + const int top_id, set* available_blobs, + map* blob_name_to_idx); + /// @brief Append a new bottom blob to the net. + int AppendBottom(const NetParameter& param, const int layer_id, + const int bottom_id, set* available_blobs, + map* blob_name_to_idx); + /// @brief Append a new parameter blob to the net. + void AppendParam(const NetParameter& param, const int layer_id, + const int param_id); + + /// @brief Helper for displaying debug info in Forward. + void ForwardDebugInfo(const int layer_id); + /// @brief Helper for displaying debug info in Backward. + void BackwardDebugInfo(const int layer_id); + /// @brief Helper for displaying debug info in Update. + void UpdateDebugInfo(const int param_id); + + /// @brief The network name + string name_; + /// @brief The phase: TRAIN or TEST + Phase phase_; + /// @brief Individual layers in the net + vector > > layers_; + vector layer_names_; + map layer_names_index_; + vector layer_need_backward_; + /// @brief the blobs storing intermediate results between the layer. + vector > > blobs_; + vector blob_names_; + map blob_names_index_; + vector blob_need_backward_; + /// bottom_vecs stores the vectors containing the input for each layer. + /// They don't actually host the blobs (blobs_ does), so we simply store + /// pointers. + vector*> > bottom_vecs_; + vector > bottom_id_vecs_; + vector > bottom_need_backward_; + /// top_vecs stores the vectors containing the output for each layer + vector*> > top_vecs_; + vector > top_id_vecs_; + /// Vector of weight in the loss (or objective) function of each net blob, + /// indexed by blob_id. + vector blob_loss_weights_; + vector > param_id_vecs_; + vector param_owners_; + vector param_display_names_; + vector > param_layer_indices_; + map param_names_index_; + /// blob indices for the input and the output of the net + vector net_input_blob_indices_; + vector net_output_blob_indices_; + vector*> net_input_blobs_; + vector*> net_output_blobs_; + /// The parameters in the network. + vector > > params_; + vector*> learnable_params_; + /** + * The mapping from params_ -> learnable_params_: we have + * learnable_param_ids_.size() == params_.size(), + * and learnable_params_[learnable_param_ids_[i]] == params_[i].get() + * if and only if params_[i] is an "owner"; otherwise, params_[i] is a sharer + * and learnable_params_[learnable_param_ids_[i]] gives its owner. + */ + vector learnable_param_ids_; + /// the learning rate multipliers for learnable_params_ + vector params_lr_; + vector has_params_lr_; + /// the weight decay multipliers for learnable_params_ + vector params_weight_decay_; + vector has_params_decay_; + /// The bytes of memory used by this net + size_t memory_used_; + /// Whether to compute and display debug info for the net. + bool debug_info_; + // Callbacks + vector before_forward_; + vector after_forward_; + vector before_backward_; + vector after_backward_; + +DISABLE_COPY_AND_ASSIGN(Net); +}; + + +} // namespace caffe + +#endif // CAFFE_NET_HPP_ diff --git a/usr/local/include/caffe/parallel.hpp b/usr/local/include/caffe/parallel.hpp new file mode 100644 index 0000000000000000000000000000000000000000..64bb48e6b0209addd1d422add193fdb039a15309 --- /dev/null +++ b/usr/local/include/caffe/parallel.hpp @@ -0,0 +1,123 @@ +#ifndef CAFFE_PARALLEL_HPP_ +#define CAFFE_PARALLEL_HPP_ + +#ifdef USE_NCCL + +#include + +#include +#include + +#include "caffe/blob.hpp" +#include "caffe/common.hpp" +#include "caffe/internal_thread.hpp" +#include "caffe/layer.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/solver.hpp" +#include "caffe/syncedmem.hpp" +#include "caffe/util/blocking_queue.hpp" +#include "caffe/util/nccl.hpp" + +namespace caffe { + +// Represents a net parameters. Once a net is created, its parameter buffers can +// be replaced by ones from Params, to allow parallelization. Params ensures +// parameters are allocated in one consecutive array. +template +class Params { + public: + explicit Params(shared_ptr > root_solver); + virtual ~Params() { + } + + inline size_t size() const { + return size_; + } + inline Dtype* data() const { + return data_; + } + inline Dtype* diff() const { + return diff_; + } + + protected: + const size_t size_; // Size of buffers + Dtype* data_; // Network parameters + Dtype* diff_; // Gradient + +DISABLE_COPY_AND_ASSIGN(Params); +}; + +// Params stored in GPU memory. +template +class GPUParams : public Params { + public: + GPUParams(shared_ptr > root_solver, int device); + virtual ~GPUParams(); + + void Configure(Solver* solver) const; + + protected: + using Params::size_; + using Params::data_; + using Params::diff_; +}; + +template +class NCCL : public GPUParams, + public Solver::Callback, + public Net::Callback { + public: + /** + * Single process version. + */ + explicit NCCL(shared_ptr > solver); + /** + * In multi-process settings, first create a NCCL id (new_uid), then + * pass it to each process to create connected instances. + */ + NCCL(shared_ptr > solver, const string& uid); + ~NCCL(); + + boost::barrier* barrier(); + void set_barrier(boost::barrier* value); + + /** + * In single process settings, create instances without uids and + * call this to connect them. + */ + static void InitSingleProcess(vector*>* nccls); + + static string new_uid(); + + /** + * Broadcast weights from rank 0 other solvers. + */ + void Broadcast(); + + /** + * Single process multi-GPU. + */ + void Run(const vector& gpus, const char* restore); + + protected: + void Init(); + void on_start() {} + void run(int layer); // Net callback + void on_gradients_ready(); + + ncclComm_t comm_; + cudaStream_t stream_; + + shared_ptr > solver_; + // Should not be necessary, https://github.com/NVIDIA/nccl/issues/37 + boost::barrier* barrier_; + using Params::size_; + using Params::data_; + using Params::diff_; +}; + +} // namespace caffe + +#endif // USE_NCCL +#endif // header diff --git a/usr/local/include/caffe/proto/caffe.pb.h b/usr/local/include/caffe/proto/caffe.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..c5a7c6c7b432750d68704f212d88d41b3f4c5f33 --- /dev/null +++ b/usr/local/include/caffe/proto/caffe.pb.h @@ -0,0 +1,39515 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: caffe.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_caffe_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_caffe_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3012000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3012004 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_caffe_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_caffe_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[63] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_caffe_2eproto; +namespace caffe { +class AccuracyParameter; +class AccuracyParameterDefaultTypeInternal; +extern AccuracyParameterDefaultTypeInternal _AccuracyParameter_default_instance_; +class ArgMaxParameter; +class ArgMaxParameterDefaultTypeInternal; +extern ArgMaxParameterDefaultTypeInternal _ArgMaxParameter_default_instance_; +class BatchNormParameter; +class BatchNormParameterDefaultTypeInternal; +extern BatchNormParameterDefaultTypeInternal _BatchNormParameter_default_instance_; +class BiasParameter; +class BiasParameterDefaultTypeInternal; +extern BiasParameterDefaultTypeInternal _BiasParameter_default_instance_; +class BlobProto; +class BlobProtoDefaultTypeInternal; +extern BlobProtoDefaultTypeInternal _BlobProto_default_instance_; +class BlobProtoVector; +class BlobProtoVectorDefaultTypeInternal; +extern BlobProtoVectorDefaultTypeInternal _BlobProtoVector_default_instance_; +class BlobShape; +class BlobShapeDefaultTypeInternal; +extern BlobShapeDefaultTypeInternal _BlobShape_default_instance_; +class ClipParameter; +class ClipParameterDefaultTypeInternal; +extern ClipParameterDefaultTypeInternal _ClipParameter_default_instance_; +class ConcatParameter; +class ConcatParameterDefaultTypeInternal; +extern ConcatParameterDefaultTypeInternal _ConcatParameter_default_instance_; +class ContrastiveLossParameter; +class ContrastiveLossParameterDefaultTypeInternal; +extern ContrastiveLossParameterDefaultTypeInternal _ContrastiveLossParameter_default_instance_; +class ConvolutionParameter; +class ConvolutionParameterDefaultTypeInternal; +extern ConvolutionParameterDefaultTypeInternal _ConvolutionParameter_default_instance_; +class CropParameter; +class CropParameterDefaultTypeInternal; +extern CropParameterDefaultTypeInternal _CropParameter_default_instance_; +class DataParameter; +class DataParameterDefaultTypeInternal; +extern DataParameterDefaultTypeInternal _DataParameter_default_instance_; +class Datum; +class DatumDefaultTypeInternal; +extern DatumDefaultTypeInternal _Datum_default_instance_; +class DropoutParameter; +class DropoutParameterDefaultTypeInternal; +extern DropoutParameterDefaultTypeInternal _DropoutParameter_default_instance_; +class DummyDataParameter; +class DummyDataParameterDefaultTypeInternal; +extern DummyDataParameterDefaultTypeInternal _DummyDataParameter_default_instance_; +class ELUParameter; +class ELUParameterDefaultTypeInternal; +extern ELUParameterDefaultTypeInternal _ELUParameter_default_instance_; +class EltwiseParameter; +class EltwiseParameterDefaultTypeInternal; +extern EltwiseParameterDefaultTypeInternal _EltwiseParameter_default_instance_; +class EmbedParameter; +class EmbedParameterDefaultTypeInternal; +extern EmbedParameterDefaultTypeInternal _EmbedParameter_default_instance_; +class ExpParameter; +class ExpParameterDefaultTypeInternal; +extern ExpParameterDefaultTypeInternal _ExpParameter_default_instance_; +class FillerParameter; +class FillerParameterDefaultTypeInternal; +extern FillerParameterDefaultTypeInternal _FillerParameter_default_instance_; +class FlattenParameter; +class FlattenParameterDefaultTypeInternal; +extern FlattenParameterDefaultTypeInternal _FlattenParameter_default_instance_; +class HDF5DataParameter; +class HDF5DataParameterDefaultTypeInternal; +extern HDF5DataParameterDefaultTypeInternal _HDF5DataParameter_default_instance_; +class HDF5OutputParameter; +class HDF5OutputParameterDefaultTypeInternal; +extern HDF5OutputParameterDefaultTypeInternal _HDF5OutputParameter_default_instance_; +class HingeLossParameter; +class HingeLossParameterDefaultTypeInternal; +extern HingeLossParameterDefaultTypeInternal _HingeLossParameter_default_instance_; +class ImageDataParameter; +class ImageDataParameterDefaultTypeInternal; +extern ImageDataParameterDefaultTypeInternal _ImageDataParameter_default_instance_; +class InfogainLossParameter; +class InfogainLossParameterDefaultTypeInternal; +extern InfogainLossParameterDefaultTypeInternal _InfogainLossParameter_default_instance_; +class InnerProductParameter; +class InnerProductParameterDefaultTypeInternal; +extern InnerProductParameterDefaultTypeInternal _InnerProductParameter_default_instance_; +class InputParameter; +class InputParameterDefaultTypeInternal; +extern InputParameterDefaultTypeInternal _InputParameter_default_instance_; +class LRNParameter; +class LRNParameterDefaultTypeInternal; +extern LRNParameterDefaultTypeInternal _LRNParameter_default_instance_; +class LayerParameter; +class LayerParameterDefaultTypeInternal; +extern LayerParameterDefaultTypeInternal _LayerParameter_default_instance_; +class LogParameter; +class LogParameterDefaultTypeInternal; +extern LogParameterDefaultTypeInternal _LogParameter_default_instance_; +class LossParameter; +class LossParameterDefaultTypeInternal; +extern LossParameterDefaultTypeInternal _LossParameter_default_instance_; +class MVNParameter; +class MVNParameterDefaultTypeInternal; +extern MVNParameterDefaultTypeInternal _MVNParameter_default_instance_; +class MemoryDataParameter; +class MemoryDataParameterDefaultTypeInternal; +extern MemoryDataParameterDefaultTypeInternal _MemoryDataParameter_default_instance_; +class NetParameter; +class NetParameterDefaultTypeInternal; +extern NetParameterDefaultTypeInternal _NetParameter_default_instance_; +class NetState; +class NetStateDefaultTypeInternal; +extern NetStateDefaultTypeInternal _NetState_default_instance_; +class NetStateRule; +class NetStateRuleDefaultTypeInternal; +extern NetStateRuleDefaultTypeInternal _NetStateRule_default_instance_; +class PReLUParameter; +class PReLUParameterDefaultTypeInternal; +extern PReLUParameterDefaultTypeInternal _PReLUParameter_default_instance_; +class ParamSpec; +class ParamSpecDefaultTypeInternal; +extern ParamSpecDefaultTypeInternal _ParamSpec_default_instance_; +class ParameterParameter; +class ParameterParameterDefaultTypeInternal; +extern ParameterParameterDefaultTypeInternal _ParameterParameter_default_instance_; +class PoolingParameter; +class PoolingParameterDefaultTypeInternal; +extern PoolingParameterDefaultTypeInternal _PoolingParameter_default_instance_; +class PowerParameter; +class PowerParameterDefaultTypeInternal; +extern PowerParameterDefaultTypeInternal _PowerParameter_default_instance_; +class PythonParameter; +class PythonParameterDefaultTypeInternal; +extern PythonParameterDefaultTypeInternal _PythonParameter_default_instance_; +class ReLUParameter; +class ReLUParameterDefaultTypeInternal; +extern ReLUParameterDefaultTypeInternal _ReLUParameter_default_instance_; +class RecurrentParameter; +class RecurrentParameterDefaultTypeInternal; +extern RecurrentParameterDefaultTypeInternal _RecurrentParameter_default_instance_; +class ReductionParameter; +class ReductionParameterDefaultTypeInternal; +extern ReductionParameterDefaultTypeInternal _ReductionParameter_default_instance_; +class ReshapeParameter; +class ReshapeParameterDefaultTypeInternal; +extern ReshapeParameterDefaultTypeInternal _ReshapeParameter_default_instance_; +class SPPParameter; +class SPPParameterDefaultTypeInternal; +extern SPPParameterDefaultTypeInternal _SPPParameter_default_instance_; +class ScaleParameter; +class ScaleParameterDefaultTypeInternal; +extern ScaleParameterDefaultTypeInternal _ScaleParameter_default_instance_; +class SigmoidParameter; +class SigmoidParameterDefaultTypeInternal; +extern SigmoidParameterDefaultTypeInternal _SigmoidParameter_default_instance_; +class SliceParameter; +class SliceParameterDefaultTypeInternal; +extern SliceParameterDefaultTypeInternal _SliceParameter_default_instance_; +class SoftmaxParameter; +class SoftmaxParameterDefaultTypeInternal; +extern SoftmaxParameterDefaultTypeInternal _SoftmaxParameter_default_instance_; +class SolverParameter; +class SolverParameterDefaultTypeInternal; +extern SolverParameterDefaultTypeInternal _SolverParameter_default_instance_; +class SolverState; +class SolverStateDefaultTypeInternal; +extern SolverStateDefaultTypeInternal _SolverState_default_instance_; +class SwishParameter; +class SwishParameterDefaultTypeInternal; +extern SwishParameterDefaultTypeInternal _SwishParameter_default_instance_; +class TanHParameter; +class TanHParameterDefaultTypeInternal; +extern TanHParameterDefaultTypeInternal _TanHParameter_default_instance_; +class ThresholdParameter; +class ThresholdParameterDefaultTypeInternal; +extern ThresholdParameterDefaultTypeInternal _ThresholdParameter_default_instance_; +class TileParameter; +class TileParameterDefaultTypeInternal; +extern TileParameterDefaultTypeInternal _TileParameter_default_instance_; +class TransformationParameter; +class TransformationParameterDefaultTypeInternal; +extern TransformationParameterDefaultTypeInternal _TransformationParameter_default_instance_; +class V0LayerParameter; +class V0LayerParameterDefaultTypeInternal; +extern V0LayerParameterDefaultTypeInternal _V0LayerParameter_default_instance_; +class V1LayerParameter; +class V1LayerParameterDefaultTypeInternal; +extern V1LayerParameterDefaultTypeInternal _V1LayerParameter_default_instance_; +class WindowDataParameter; +class WindowDataParameterDefaultTypeInternal; +extern WindowDataParameterDefaultTypeInternal _WindowDataParameter_default_instance_; +} // namespace caffe +PROTOBUF_NAMESPACE_OPEN +template<> ::caffe::AccuracyParameter* Arena::CreateMaybeMessage<::caffe::AccuracyParameter>(Arena*); +template<> ::caffe::ArgMaxParameter* Arena::CreateMaybeMessage<::caffe::ArgMaxParameter>(Arena*); +template<> ::caffe::BatchNormParameter* Arena::CreateMaybeMessage<::caffe::BatchNormParameter>(Arena*); +template<> ::caffe::BiasParameter* Arena::CreateMaybeMessage<::caffe::BiasParameter>(Arena*); +template<> ::caffe::BlobProto* Arena::CreateMaybeMessage<::caffe::BlobProto>(Arena*); +template<> ::caffe::BlobProtoVector* Arena::CreateMaybeMessage<::caffe::BlobProtoVector>(Arena*); +template<> ::caffe::BlobShape* Arena::CreateMaybeMessage<::caffe::BlobShape>(Arena*); +template<> ::caffe::ClipParameter* Arena::CreateMaybeMessage<::caffe::ClipParameter>(Arena*); +template<> ::caffe::ConcatParameter* Arena::CreateMaybeMessage<::caffe::ConcatParameter>(Arena*); +template<> ::caffe::ContrastiveLossParameter* Arena::CreateMaybeMessage<::caffe::ContrastiveLossParameter>(Arena*); +template<> ::caffe::ConvolutionParameter* Arena::CreateMaybeMessage<::caffe::ConvolutionParameter>(Arena*); +template<> ::caffe::CropParameter* Arena::CreateMaybeMessage<::caffe::CropParameter>(Arena*); +template<> ::caffe::DataParameter* Arena::CreateMaybeMessage<::caffe::DataParameter>(Arena*); +template<> ::caffe::Datum* Arena::CreateMaybeMessage<::caffe::Datum>(Arena*); +template<> ::caffe::DropoutParameter* Arena::CreateMaybeMessage<::caffe::DropoutParameter>(Arena*); +template<> ::caffe::DummyDataParameter* Arena::CreateMaybeMessage<::caffe::DummyDataParameter>(Arena*); +template<> ::caffe::ELUParameter* Arena::CreateMaybeMessage<::caffe::ELUParameter>(Arena*); +template<> ::caffe::EltwiseParameter* Arena::CreateMaybeMessage<::caffe::EltwiseParameter>(Arena*); +template<> ::caffe::EmbedParameter* Arena::CreateMaybeMessage<::caffe::EmbedParameter>(Arena*); +template<> ::caffe::ExpParameter* Arena::CreateMaybeMessage<::caffe::ExpParameter>(Arena*); +template<> ::caffe::FillerParameter* Arena::CreateMaybeMessage<::caffe::FillerParameter>(Arena*); +template<> ::caffe::FlattenParameter* Arena::CreateMaybeMessage<::caffe::FlattenParameter>(Arena*); +template<> ::caffe::HDF5DataParameter* Arena::CreateMaybeMessage<::caffe::HDF5DataParameter>(Arena*); +template<> ::caffe::HDF5OutputParameter* Arena::CreateMaybeMessage<::caffe::HDF5OutputParameter>(Arena*); +template<> ::caffe::HingeLossParameter* Arena::CreateMaybeMessage<::caffe::HingeLossParameter>(Arena*); +template<> ::caffe::ImageDataParameter* Arena::CreateMaybeMessage<::caffe::ImageDataParameter>(Arena*); +template<> ::caffe::InfogainLossParameter* Arena::CreateMaybeMessage<::caffe::InfogainLossParameter>(Arena*); +template<> ::caffe::InnerProductParameter* Arena::CreateMaybeMessage<::caffe::InnerProductParameter>(Arena*); +template<> ::caffe::InputParameter* Arena::CreateMaybeMessage<::caffe::InputParameter>(Arena*); +template<> ::caffe::LRNParameter* Arena::CreateMaybeMessage<::caffe::LRNParameter>(Arena*); +template<> ::caffe::LayerParameter* Arena::CreateMaybeMessage<::caffe::LayerParameter>(Arena*); +template<> ::caffe::LogParameter* Arena::CreateMaybeMessage<::caffe::LogParameter>(Arena*); +template<> ::caffe::LossParameter* Arena::CreateMaybeMessage<::caffe::LossParameter>(Arena*); +template<> ::caffe::MVNParameter* Arena::CreateMaybeMessage<::caffe::MVNParameter>(Arena*); +template<> ::caffe::MemoryDataParameter* Arena::CreateMaybeMessage<::caffe::MemoryDataParameter>(Arena*); +template<> ::caffe::NetParameter* Arena::CreateMaybeMessage<::caffe::NetParameter>(Arena*); +template<> ::caffe::NetState* Arena::CreateMaybeMessage<::caffe::NetState>(Arena*); +template<> ::caffe::NetStateRule* Arena::CreateMaybeMessage<::caffe::NetStateRule>(Arena*); +template<> ::caffe::PReLUParameter* Arena::CreateMaybeMessage<::caffe::PReLUParameter>(Arena*); +template<> ::caffe::ParamSpec* Arena::CreateMaybeMessage<::caffe::ParamSpec>(Arena*); +template<> ::caffe::ParameterParameter* Arena::CreateMaybeMessage<::caffe::ParameterParameter>(Arena*); +template<> ::caffe::PoolingParameter* Arena::CreateMaybeMessage<::caffe::PoolingParameter>(Arena*); +template<> ::caffe::PowerParameter* Arena::CreateMaybeMessage<::caffe::PowerParameter>(Arena*); +template<> ::caffe::PythonParameter* Arena::CreateMaybeMessage<::caffe::PythonParameter>(Arena*); +template<> ::caffe::ReLUParameter* Arena::CreateMaybeMessage<::caffe::ReLUParameter>(Arena*); +template<> ::caffe::RecurrentParameter* Arena::CreateMaybeMessage<::caffe::RecurrentParameter>(Arena*); +template<> ::caffe::ReductionParameter* Arena::CreateMaybeMessage<::caffe::ReductionParameter>(Arena*); +template<> ::caffe::ReshapeParameter* Arena::CreateMaybeMessage<::caffe::ReshapeParameter>(Arena*); +template<> ::caffe::SPPParameter* Arena::CreateMaybeMessage<::caffe::SPPParameter>(Arena*); +template<> ::caffe::ScaleParameter* Arena::CreateMaybeMessage<::caffe::ScaleParameter>(Arena*); +template<> ::caffe::SigmoidParameter* Arena::CreateMaybeMessage<::caffe::SigmoidParameter>(Arena*); +template<> ::caffe::SliceParameter* Arena::CreateMaybeMessage<::caffe::SliceParameter>(Arena*); +template<> ::caffe::SoftmaxParameter* Arena::CreateMaybeMessage<::caffe::SoftmaxParameter>(Arena*); +template<> ::caffe::SolverParameter* Arena::CreateMaybeMessage<::caffe::SolverParameter>(Arena*); +template<> ::caffe::SolverState* Arena::CreateMaybeMessage<::caffe::SolverState>(Arena*); +template<> ::caffe::SwishParameter* Arena::CreateMaybeMessage<::caffe::SwishParameter>(Arena*); +template<> ::caffe::TanHParameter* Arena::CreateMaybeMessage<::caffe::TanHParameter>(Arena*); +template<> ::caffe::ThresholdParameter* Arena::CreateMaybeMessage<::caffe::ThresholdParameter>(Arena*); +template<> ::caffe::TileParameter* Arena::CreateMaybeMessage<::caffe::TileParameter>(Arena*); +template<> ::caffe::TransformationParameter* Arena::CreateMaybeMessage<::caffe::TransformationParameter>(Arena*); +template<> ::caffe::V0LayerParameter* Arena::CreateMaybeMessage<::caffe::V0LayerParameter>(Arena*); +template<> ::caffe::V1LayerParameter* Arena::CreateMaybeMessage<::caffe::V1LayerParameter>(Arena*); +template<> ::caffe::WindowDataParameter* Arena::CreateMaybeMessage<::caffe::WindowDataParameter>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace caffe { + +enum FillerParameter_VarianceNorm : int { + FillerParameter_VarianceNorm_FAN_IN = 0, + FillerParameter_VarianceNorm_FAN_OUT = 1, + FillerParameter_VarianceNorm_AVERAGE = 2 +}; +bool FillerParameter_VarianceNorm_IsValid(int value); +constexpr FillerParameter_VarianceNorm FillerParameter_VarianceNorm_VarianceNorm_MIN = FillerParameter_VarianceNorm_FAN_IN; +constexpr FillerParameter_VarianceNorm FillerParameter_VarianceNorm_VarianceNorm_MAX = FillerParameter_VarianceNorm_AVERAGE; +constexpr int FillerParameter_VarianceNorm_VarianceNorm_ARRAYSIZE = FillerParameter_VarianceNorm_VarianceNorm_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FillerParameter_VarianceNorm_descriptor(); +template +inline const std::string& FillerParameter_VarianceNorm_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FillerParameter_VarianceNorm_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + FillerParameter_VarianceNorm_descriptor(), enum_t_value); +} +inline bool FillerParameter_VarianceNorm_Parse( + const std::string& name, FillerParameter_VarianceNorm* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + FillerParameter_VarianceNorm_descriptor(), name, value); +} +enum SolverParameter_SnapshotFormat : int { + SolverParameter_SnapshotFormat_HDF5 = 0, + SolverParameter_SnapshotFormat_BINARYPROTO = 1 +}; +bool SolverParameter_SnapshotFormat_IsValid(int value); +constexpr SolverParameter_SnapshotFormat SolverParameter_SnapshotFormat_SnapshotFormat_MIN = SolverParameter_SnapshotFormat_HDF5; +constexpr SolverParameter_SnapshotFormat SolverParameter_SnapshotFormat_SnapshotFormat_MAX = SolverParameter_SnapshotFormat_BINARYPROTO; +constexpr int SolverParameter_SnapshotFormat_SnapshotFormat_ARRAYSIZE = SolverParameter_SnapshotFormat_SnapshotFormat_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SolverParameter_SnapshotFormat_descriptor(); +template +inline const std::string& SolverParameter_SnapshotFormat_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SolverParameter_SnapshotFormat_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SolverParameter_SnapshotFormat_descriptor(), enum_t_value); +} +inline bool SolverParameter_SnapshotFormat_Parse( + const std::string& name, SolverParameter_SnapshotFormat* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SolverParameter_SnapshotFormat_descriptor(), name, value); +} +enum SolverParameter_SolverMode : int { + SolverParameter_SolverMode_CPU = 0, + SolverParameter_SolverMode_GPU = 1 +}; +bool SolverParameter_SolverMode_IsValid(int value); +constexpr SolverParameter_SolverMode SolverParameter_SolverMode_SolverMode_MIN = SolverParameter_SolverMode_CPU; +constexpr SolverParameter_SolverMode SolverParameter_SolverMode_SolverMode_MAX = SolverParameter_SolverMode_GPU; +constexpr int SolverParameter_SolverMode_SolverMode_ARRAYSIZE = SolverParameter_SolverMode_SolverMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SolverParameter_SolverMode_descriptor(); +template +inline const std::string& SolverParameter_SolverMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SolverParameter_SolverMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SolverParameter_SolverMode_descriptor(), enum_t_value); +} +inline bool SolverParameter_SolverMode_Parse( + const std::string& name, SolverParameter_SolverMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SolverParameter_SolverMode_descriptor(), name, value); +} +enum SolverParameter_SolverType : int { + SolverParameter_SolverType_SGD = 0, + SolverParameter_SolverType_NESTEROV = 1, + SolverParameter_SolverType_ADAGRAD = 2, + SolverParameter_SolverType_RMSPROP = 3, + SolverParameter_SolverType_ADADELTA = 4, + SolverParameter_SolverType_ADAM = 5 +}; +bool SolverParameter_SolverType_IsValid(int value); +constexpr SolverParameter_SolverType SolverParameter_SolverType_SolverType_MIN = SolverParameter_SolverType_SGD; +constexpr SolverParameter_SolverType SolverParameter_SolverType_SolverType_MAX = SolverParameter_SolverType_ADAM; +constexpr int SolverParameter_SolverType_SolverType_ARRAYSIZE = SolverParameter_SolverType_SolverType_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SolverParameter_SolverType_descriptor(); +template +inline const std::string& SolverParameter_SolverType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SolverParameter_SolverType_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SolverParameter_SolverType_descriptor(), enum_t_value); +} +inline bool SolverParameter_SolverType_Parse( + const std::string& name, SolverParameter_SolverType* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SolverParameter_SolverType_descriptor(), name, value); +} +enum ParamSpec_DimCheckMode : int { + ParamSpec_DimCheckMode_STRICT = 0, + ParamSpec_DimCheckMode_PERMISSIVE = 1 +}; +bool ParamSpec_DimCheckMode_IsValid(int value); +constexpr ParamSpec_DimCheckMode ParamSpec_DimCheckMode_DimCheckMode_MIN = ParamSpec_DimCheckMode_STRICT; +constexpr ParamSpec_DimCheckMode ParamSpec_DimCheckMode_DimCheckMode_MAX = ParamSpec_DimCheckMode_PERMISSIVE; +constexpr int ParamSpec_DimCheckMode_DimCheckMode_ARRAYSIZE = ParamSpec_DimCheckMode_DimCheckMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ParamSpec_DimCheckMode_descriptor(); +template +inline const std::string& ParamSpec_DimCheckMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ParamSpec_DimCheckMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + ParamSpec_DimCheckMode_descriptor(), enum_t_value); +} +inline bool ParamSpec_DimCheckMode_Parse( + const std::string& name, ParamSpec_DimCheckMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + ParamSpec_DimCheckMode_descriptor(), name, value); +} +enum LossParameter_NormalizationMode : int { + LossParameter_NormalizationMode_FULL = 0, + LossParameter_NormalizationMode_VALID = 1, + LossParameter_NormalizationMode_BATCH_SIZE = 2, + LossParameter_NormalizationMode_NONE = 3 +}; +bool LossParameter_NormalizationMode_IsValid(int value); +constexpr LossParameter_NormalizationMode LossParameter_NormalizationMode_NormalizationMode_MIN = LossParameter_NormalizationMode_FULL; +constexpr LossParameter_NormalizationMode LossParameter_NormalizationMode_NormalizationMode_MAX = LossParameter_NormalizationMode_NONE; +constexpr int LossParameter_NormalizationMode_NormalizationMode_ARRAYSIZE = LossParameter_NormalizationMode_NormalizationMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* LossParameter_NormalizationMode_descriptor(); +template +inline const std::string& LossParameter_NormalizationMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function LossParameter_NormalizationMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + LossParameter_NormalizationMode_descriptor(), enum_t_value); +} +inline bool LossParameter_NormalizationMode_Parse( + const std::string& name, LossParameter_NormalizationMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + LossParameter_NormalizationMode_descriptor(), name, value); +} +enum ConvolutionParameter_Engine : int { + ConvolutionParameter_Engine_DEFAULT = 0, + ConvolutionParameter_Engine_CAFFE = 1, + ConvolutionParameter_Engine_CUDNN = 2 +}; +bool ConvolutionParameter_Engine_IsValid(int value); +constexpr ConvolutionParameter_Engine ConvolutionParameter_Engine_Engine_MIN = ConvolutionParameter_Engine_DEFAULT; +constexpr ConvolutionParameter_Engine ConvolutionParameter_Engine_Engine_MAX = ConvolutionParameter_Engine_CUDNN; +constexpr int ConvolutionParameter_Engine_Engine_ARRAYSIZE = ConvolutionParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ConvolutionParameter_Engine_descriptor(); +template +inline const std::string& ConvolutionParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConvolutionParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + ConvolutionParameter_Engine_descriptor(), enum_t_value); +} +inline bool ConvolutionParameter_Engine_Parse( + const std::string& name, ConvolutionParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + ConvolutionParameter_Engine_descriptor(), name, value); +} +enum DataParameter_DB : int { + DataParameter_DB_LEVELDB = 0, + DataParameter_DB_LMDB = 1 +}; +bool DataParameter_DB_IsValid(int value); +constexpr DataParameter_DB DataParameter_DB_DB_MIN = DataParameter_DB_LEVELDB; +constexpr DataParameter_DB DataParameter_DB_DB_MAX = DataParameter_DB_LMDB; +constexpr int DataParameter_DB_DB_ARRAYSIZE = DataParameter_DB_DB_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* DataParameter_DB_descriptor(); +template +inline const std::string& DataParameter_DB_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DataParameter_DB_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + DataParameter_DB_descriptor(), enum_t_value); +} +inline bool DataParameter_DB_Parse( + const std::string& name, DataParameter_DB* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + DataParameter_DB_descriptor(), name, value); +} +enum EltwiseParameter_EltwiseOp : int { + EltwiseParameter_EltwiseOp_PROD = 0, + EltwiseParameter_EltwiseOp_SUM = 1, + EltwiseParameter_EltwiseOp_MAX = 2 +}; +bool EltwiseParameter_EltwiseOp_IsValid(int value); +constexpr EltwiseParameter_EltwiseOp EltwiseParameter_EltwiseOp_EltwiseOp_MIN = EltwiseParameter_EltwiseOp_PROD; +constexpr EltwiseParameter_EltwiseOp EltwiseParameter_EltwiseOp_EltwiseOp_MAX = EltwiseParameter_EltwiseOp_MAX; +constexpr int EltwiseParameter_EltwiseOp_EltwiseOp_ARRAYSIZE = EltwiseParameter_EltwiseOp_EltwiseOp_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* EltwiseParameter_EltwiseOp_descriptor(); +template +inline const std::string& EltwiseParameter_EltwiseOp_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function EltwiseParameter_EltwiseOp_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + EltwiseParameter_EltwiseOp_descriptor(), enum_t_value); +} +inline bool EltwiseParameter_EltwiseOp_Parse( + const std::string& name, EltwiseParameter_EltwiseOp* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + EltwiseParameter_EltwiseOp_descriptor(), name, value); +} +enum HingeLossParameter_Norm : int { + HingeLossParameter_Norm_L1 = 1, + HingeLossParameter_Norm_L2 = 2 +}; +bool HingeLossParameter_Norm_IsValid(int value); +constexpr HingeLossParameter_Norm HingeLossParameter_Norm_Norm_MIN = HingeLossParameter_Norm_L1; +constexpr HingeLossParameter_Norm HingeLossParameter_Norm_Norm_MAX = HingeLossParameter_Norm_L2; +constexpr int HingeLossParameter_Norm_Norm_ARRAYSIZE = HingeLossParameter_Norm_Norm_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* HingeLossParameter_Norm_descriptor(); +template +inline const std::string& HingeLossParameter_Norm_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function HingeLossParameter_Norm_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + HingeLossParameter_Norm_descriptor(), enum_t_value); +} +inline bool HingeLossParameter_Norm_Parse( + const std::string& name, HingeLossParameter_Norm* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + HingeLossParameter_Norm_descriptor(), name, value); +} +enum LRNParameter_NormRegion : int { + LRNParameter_NormRegion_ACROSS_CHANNELS = 0, + LRNParameter_NormRegion_WITHIN_CHANNEL = 1 +}; +bool LRNParameter_NormRegion_IsValid(int value); +constexpr LRNParameter_NormRegion LRNParameter_NormRegion_NormRegion_MIN = LRNParameter_NormRegion_ACROSS_CHANNELS; +constexpr LRNParameter_NormRegion LRNParameter_NormRegion_NormRegion_MAX = LRNParameter_NormRegion_WITHIN_CHANNEL; +constexpr int LRNParameter_NormRegion_NormRegion_ARRAYSIZE = LRNParameter_NormRegion_NormRegion_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* LRNParameter_NormRegion_descriptor(); +template +inline const std::string& LRNParameter_NormRegion_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function LRNParameter_NormRegion_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + LRNParameter_NormRegion_descriptor(), enum_t_value); +} +inline bool LRNParameter_NormRegion_Parse( + const std::string& name, LRNParameter_NormRegion* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + LRNParameter_NormRegion_descriptor(), name, value); +} +enum LRNParameter_Engine : int { + LRNParameter_Engine_DEFAULT = 0, + LRNParameter_Engine_CAFFE = 1, + LRNParameter_Engine_CUDNN = 2 +}; +bool LRNParameter_Engine_IsValid(int value); +constexpr LRNParameter_Engine LRNParameter_Engine_Engine_MIN = LRNParameter_Engine_DEFAULT; +constexpr LRNParameter_Engine LRNParameter_Engine_Engine_MAX = LRNParameter_Engine_CUDNN; +constexpr int LRNParameter_Engine_Engine_ARRAYSIZE = LRNParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* LRNParameter_Engine_descriptor(); +template +inline const std::string& LRNParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function LRNParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + LRNParameter_Engine_descriptor(), enum_t_value); +} +inline bool LRNParameter_Engine_Parse( + const std::string& name, LRNParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + LRNParameter_Engine_descriptor(), name, value); +} +enum PoolingParameter_PoolMethod : int { + PoolingParameter_PoolMethod_MAX = 0, + PoolingParameter_PoolMethod_AVE = 1, + PoolingParameter_PoolMethod_STOCHASTIC = 2 +}; +bool PoolingParameter_PoolMethod_IsValid(int value); +constexpr PoolingParameter_PoolMethod PoolingParameter_PoolMethod_PoolMethod_MIN = PoolingParameter_PoolMethod_MAX; +constexpr PoolingParameter_PoolMethod PoolingParameter_PoolMethod_PoolMethod_MAX = PoolingParameter_PoolMethod_STOCHASTIC; +constexpr int PoolingParameter_PoolMethod_PoolMethod_ARRAYSIZE = PoolingParameter_PoolMethod_PoolMethod_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PoolingParameter_PoolMethod_descriptor(); +template +inline const std::string& PoolingParameter_PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolingParameter_PoolMethod_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + PoolingParameter_PoolMethod_descriptor(), enum_t_value); +} +inline bool PoolingParameter_PoolMethod_Parse( + const std::string& name, PoolingParameter_PoolMethod* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + PoolingParameter_PoolMethod_descriptor(), name, value); +} +enum PoolingParameter_Engine : int { + PoolingParameter_Engine_DEFAULT = 0, + PoolingParameter_Engine_CAFFE = 1, + PoolingParameter_Engine_CUDNN = 2 +}; +bool PoolingParameter_Engine_IsValid(int value); +constexpr PoolingParameter_Engine PoolingParameter_Engine_Engine_MIN = PoolingParameter_Engine_DEFAULT; +constexpr PoolingParameter_Engine PoolingParameter_Engine_Engine_MAX = PoolingParameter_Engine_CUDNN; +constexpr int PoolingParameter_Engine_Engine_ARRAYSIZE = PoolingParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PoolingParameter_Engine_descriptor(); +template +inline const std::string& PoolingParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolingParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + PoolingParameter_Engine_descriptor(), enum_t_value); +} +inline bool PoolingParameter_Engine_Parse( + const std::string& name, PoolingParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + PoolingParameter_Engine_descriptor(), name, value); +} +enum PoolingParameter_RoundMode : int { + PoolingParameter_RoundMode_CEIL = 0, + PoolingParameter_RoundMode_FLOOR = 1 +}; +bool PoolingParameter_RoundMode_IsValid(int value); +constexpr PoolingParameter_RoundMode PoolingParameter_RoundMode_RoundMode_MIN = PoolingParameter_RoundMode_CEIL; +constexpr PoolingParameter_RoundMode PoolingParameter_RoundMode_RoundMode_MAX = PoolingParameter_RoundMode_FLOOR; +constexpr int PoolingParameter_RoundMode_RoundMode_ARRAYSIZE = PoolingParameter_RoundMode_RoundMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PoolingParameter_RoundMode_descriptor(); +template +inline const std::string& PoolingParameter_RoundMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolingParameter_RoundMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + PoolingParameter_RoundMode_descriptor(), enum_t_value); +} +inline bool PoolingParameter_RoundMode_Parse( + const std::string& name, PoolingParameter_RoundMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + PoolingParameter_RoundMode_descriptor(), name, value); +} +enum ReductionParameter_ReductionOp : int { + ReductionParameter_ReductionOp_SUM = 1, + ReductionParameter_ReductionOp_ASUM = 2, + ReductionParameter_ReductionOp_SUMSQ = 3, + ReductionParameter_ReductionOp_MEAN = 4 +}; +bool ReductionParameter_ReductionOp_IsValid(int value); +constexpr ReductionParameter_ReductionOp ReductionParameter_ReductionOp_ReductionOp_MIN = ReductionParameter_ReductionOp_SUM; +constexpr ReductionParameter_ReductionOp ReductionParameter_ReductionOp_ReductionOp_MAX = ReductionParameter_ReductionOp_MEAN; +constexpr int ReductionParameter_ReductionOp_ReductionOp_ARRAYSIZE = ReductionParameter_ReductionOp_ReductionOp_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ReductionParameter_ReductionOp_descriptor(); +template +inline const std::string& ReductionParameter_ReductionOp_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ReductionParameter_ReductionOp_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + ReductionParameter_ReductionOp_descriptor(), enum_t_value); +} +inline bool ReductionParameter_ReductionOp_Parse( + const std::string& name, ReductionParameter_ReductionOp* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + ReductionParameter_ReductionOp_descriptor(), name, value); +} +enum ReLUParameter_Engine : int { + ReLUParameter_Engine_DEFAULT = 0, + ReLUParameter_Engine_CAFFE = 1, + ReLUParameter_Engine_CUDNN = 2 +}; +bool ReLUParameter_Engine_IsValid(int value); +constexpr ReLUParameter_Engine ReLUParameter_Engine_Engine_MIN = ReLUParameter_Engine_DEFAULT; +constexpr ReLUParameter_Engine ReLUParameter_Engine_Engine_MAX = ReLUParameter_Engine_CUDNN; +constexpr int ReLUParameter_Engine_Engine_ARRAYSIZE = ReLUParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ReLUParameter_Engine_descriptor(); +template +inline const std::string& ReLUParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ReLUParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + ReLUParameter_Engine_descriptor(), enum_t_value); +} +inline bool ReLUParameter_Engine_Parse( + const std::string& name, ReLUParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + ReLUParameter_Engine_descriptor(), name, value); +} +enum SigmoidParameter_Engine : int { + SigmoidParameter_Engine_DEFAULT = 0, + SigmoidParameter_Engine_CAFFE = 1, + SigmoidParameter_Engine_CUDNN = 2 +}; +bool SigmoidParameter_Engine_IsValid(int value); +constexpr SigmoidParameter_Engine SigmoidParameter_Engine_Engine_MIN = SigmoidParameter_Engine_DEFAULT; +constexpr SigmoidParameter_Engine SigmoidParameter_Engine_Engine_MAX = SigmoidParameter_Engine_CUDNN; +constexpr int SigmoidParameter_Engine_Engine_ARRAYSIZE = SigmoidParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SigmoidParameter_Engine_descriptor(); +template +inline const std::string& SigmoidParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SigmoidParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SigmoidParameter_Engine_descriptor(), enum_t_value); +} +inline bool SigmoidParameter_Engine_Parse( + const std::string& name, SigmoidParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SigmoidParameter_Engine_descriptor(), name, value); +} +enum SoftmaxParameter_Engine : int { + SoftmaxParameter_Engine_DEFAULT = 0, + SoftmaxParameter_Engine_CAFFE = 1, + SoftmaxParameter_Engine_CUDNN = 2 +}; +bool SoftmaxParameter_Engine_IsValid(int value); +constexpr SoftmaxParameter_Engine SoftmaxParameter_Engine_Engine_MIN = SoftmaxParameter_Engine_DEFAULT; +constexpr SoftmaxParameter_Engine SoftmaxParameter_Engine_Engine_MAX = SoftmaxParameter_Engine_CUDNN; +constexpr int SoftmaxParameter_Engine_Engine_ARRAYSIZE = SoftmaxParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SoftmaxParameter_Engine_descriptor(); +template +inline const std::string& SoftmaxParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SoftmaxParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SoftmaxParameter_Engine_descriptor(), enum_t_value); +} +inline bool SoftmaxParameter_Engine_Parse( + const std::string& name, SoftmaxParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SoftmaxParameter_Engine_descriptor(), name, value); +} +enum TanHParameter_Engine : int { + TanHParameter_Engine_DEFAULT = 0, + TanHParameter_Engine_CAFFE = 1, + TanHParameter_Engine_CUDNN = 2 +}; +bool TanHParameter_Engine_IsValid(int value); +constexpr TanHParameter_Engine TanHParameter_Engine_Engine_MIN = TanHParameter_Engine_DEFAULT; +constexpr TanHParameter_Engine TanHParameter_Engine_Engine_MAX = TanHParameter_Engine_CUDNN; +constexpr int TanHParameter_Engine_Engine_ARRAYSIZE = TanHParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* TanHParameter_Engine_descriptor(); +template +inline const std::string& TanHParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function TanHParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + TanHParameter_Engine_descriptor(), enum_t_value); +} +inline bool TanHParameter_Engine_Parse( + const std::string& name, TanHParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + TanHParameter_Engine_descriptor(), name, value); +} +enum SPPParameter_PoolMethod : int { + SPPParameter_PoolMethod_MAX = 0, + SPPParameter_PoolMethod_AVE = 1, + SPPParameter_PoolMethod_STOCHASTIC = 2 +}; +bool SPPParameter_PoolMethod_IsValid(int value); +constexpr SPPParameter_PoolMethod SPPParameter_PoolMethod_PoolMethod_MIN = SPPParameter_PoolMethod_MAX; +constexpr SPPParameter_PoolMethod SPPParameter_PoolMethod_PoolMethod_MAX = SPPParameter_PoolMethod_STOCHASTIC; +constexpr int SPPParameter_PoolMethod_PoolMethod_ARRAYSIZE = SPPParameter_PoolMethod_PoolMethod_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SPPParameter_PoolMethod_descriptor(); +template +inline const std::string& SPPParameter_PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SPPParameter_PoolMethod_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SPPParameter_PoolMethod_descriptor(), enum_t_value); +} +inline bool SPPParameter_PoolMethod_Parse( + const std::string& name, SPPParameter_PoolMethod* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SPPParameter_PoolMethod_descriptor(), name, value); +} +enum SPPParameter_Engine : int { + SPPParameter_Engine_DEFAULT = 0, + SPPParameter_Engine_CAFFE = 1, + SPPParameter_Engine_CUDNN = 2 +}; +bool SPPParameter_Engine_IsValid(int value); +constexpr SPPParameter_Engine SPPParameter_Engine_Engine_MIN = SPPParameter_Engine_DEFAULT; +constexpr SPPParameter_Engine SPPParameter_Engine_Engine_MAX = SPPParameter_Engine_CUDNN; +constexpr int SPPParameter_Engine_Engine_ARRAYSIZE = SPPParameter_Engine_Engine_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SPPParameter_Engine_descriptor(); +template +inline const std::string& SPPParameter_Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SPPParameter_Engine_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + SPPParameter_Engine_descriptor(), enum_t_value); +} +inline bool SPPParameter_Engine_Parse( + const std::string& name, SPPParameter_Engine* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + SPPParameter_Engine_descriptor(), name, value); +} +enum V1LayerParameter_LayerType : int { + V1LayerParameter_LayerType_NONE = 0, + V1LayerParameter_LayerType_ABSVAL = 35, + V1LayerParameter_LayerType_ACCURACY = 1, + V1LayerParameter_LayerType_ARGMAX = 30, + V1LayerParameter_LayerType_BNLL = 2, + V1LayerParameter_LayerType_CONCAT = 3, + V1LayerParameter_LayerType_CONTRASTIVE_LOSS = 37, + V1LayerParameter_LayerType_CONVOLUTION = 4, + V1LayerParameter_LayerType_DATA = 5, + V1LayerParameter_LayerType_DECONVOLUTION = 39, + V1LayerParameter_LayerType_DROPOUT = 6, + V1LayerParameter_LayerType_DUMMY_DATA = 32, + V1LayerParameter_LayerType_EUCLIDEAN_LOSS = 7, + V1LayerParameter_LayerType_ELTWISE = 25, + V1LayerParameter_LayerType_EXP = 38, + V1LayerParameter_LayerType_FLATTEN = 8, + V1LayerParameter_LayerType_HDF5_DATA = 9, + V1LayerParameter_LayerType_HDF5_OUTPUT = 10, + V1LayerParameter_LayerType_HINGE_LOSS = 28, + V1LayerParameter_LayerType_IM2COL = 11, + V1LayerParameter_LayerType_IMAGE_DATA = 12, + V1LayerParameter_LayerType_INFOGAIN_LOSS = 13, + V1LayerParameter_LayerType_INNER_PRODUCT = 14, + V1LayerParameter_LayerType_LRN = 15, + V1LayerParameter_LayerType_MEMORY_DATA = 29, + V1LayerParameter_LayerType_MULTINOMIAL_LOGISTIC_LOSS = 16, + V1LayerParameter_LayerType_MVN = 34, + V1LayerParameter_LayerType_POOLING = 17, + V1LayerParameter_LayerType_POWER = 26, + V1LayerParameter_LayerType_RELU = 18, + V1LayerParameter_LayerType_SIGMOID = 19, + V1LayerParameter_LayerType_SIGMOID_CROSS_ENTROPY_LOSS = 27, + V1LayerParameter_LayerType_SILENCE = 36, + V1LayerParameter_LayerType_SOFTMAX = 20, + V1LayerParameter_LayerType_SOFTMAX_LOSS = 21, + V1LayerParameter_LayerType_SPLIT = 22, + V1LayerParameter_LayerType_SLICE = 33, + V1LayerParameter_LayerType_TANH = 23, + V1LayerParameter_LayerType_WINDOW_DATA = 24, + V1LayerParameter_LayerType_THRESHOLD = 31 +}; +bool V1LayerParameter_LayerType_IsValid(int value); +constexpr V1LayerParameter_LayerType V1LayerParameter_LayerType_LayerType_MIN = V1LayerParameter_LayerType_NONE; +constexpr V1LayerParameter_LayerType V1LayerParameter_LayerType_LayerType_MAX = V1LayerParameter_LayerType_DECONVOLUTION; +constexpr int V1LayerParameter_LayerType_LayerType_ARRAYSIZE = V1LayerParameter_LayerType_LayerType_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* V1LayerParameter_LayerType_descriptor(); +template +inline const std::string& V1LayerParameter_LayerType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function V1LayerParameter_LayerType_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + V1LayerParameter_LayerType_descriptor(), enum_t_value); +} +inline bool V1LayerParameter_LayerType_Parse( + const std::string& name, V1LayerParameter_LayerType* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + V1LayerParameter_LayerType_descriptor(), name, value); +} +enum V1LayerParameter_DimCheckMode : int { + V1LayerParameter_DimCheckMode_STRICT = 0, + V1LayerParameter_DimCheckMode_PERMISSIVE = 1 +}; +bool V1LayerParameter_DimCheckMode_IsValid(int value); +constexpr V1LayerParameter_DimCheckMode V1LayerParameter_DimCheckMode_DimCheckMode_MIN = V1LayerParameter_DimCheckMode_STRICT; +constexpr V1LayerParameter_DimCheckMode V1LayerParameter_DimCheckMode_DimCheckMode_MAX = V1LayerParameter_DimCheckMode_PERMISSIVE; +constexpr int V1LayerParameter_DimCheckMode_DimCheckMode_ARRAYSIZE = V1LayerParameter_DimCheckMode_DimCheckMode_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* V1LayerParameter_DimCheckMode_descriptor(); +template +inline const std::string& V1LayerParameter_DimCheckMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function V1LayerParameter_DimCheckMode_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + V1LayerParameter_DimCheckMode_descriptor(), enum_t_value); +} +inline bool V1LayerParameter_DimCheckMode_Parse( + const std::string& name, V1LayerParameter_DimCheckMode* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + V1LayerParameter_DimCheckMode_descriptor(), name, value); +} +enum V0LayerParameter_PoolMethod : int { + V0LayerParameter_PoolMethod_MAX = 0, + V0LayerParameter_PoolMethod_AVE = 1, + V0LayerParameter_PoolMethod_STOCHASTIC = 2 +}; +bool V0LayerParameter_PoolMethod_IsValid(int value); +constexpr V0LayerParameter_PoolMethod V0LayerParameter_PoolMethod_PoolMethod_MIN = V0LayerParameter_PoolMethod_MAX; +constexpr V0LayerParameter_PoolMethod V0LayerParameter_PoolMethod_PoolMethod_MAX = V0LayerParameter_PoolMethod_STOCHASTIC; +constexpr int V0LayerParameter_PoolMethod_PoolMethod_ARRAYSIZE = V0LayerParameter_PoolMethod_PoolMethod_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* V0LayerParameter_PoolMethod_descriptor(); +template +inline const std::string& V0LayerParameter_PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function V0LayerParameter_PoolMethod_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + V0LayerParameter_PoolMethod_descriptor(), enum_t_value); +} +inline bool V0LayerParameter_PoolMethod_Parse( + const std::string& name, V0LayerParameter_PoolMethod* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + V0LayerParameter_PoolMethod_descriptor(), name, value); +} +enum Phase : int { + TRAIN = 0, + TEST = 1 +}; +bool Phase_IsValid(int value); +constexpr Phase Phase_MIN = TRAIN; +constexpr Phase Phase_MAX = TEST; +constexpr int Phase_ARRAYSIZE = Phase_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Phase_descriptor(); +template +inline const std::string& Phase_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Phase_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + Phase_descriptor(), enum_t_value); +} +inline bool Phase_Parse( + const std::string& name, Phase* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + Phase_descriptor(), name, value); +} +// =================================================================== + +class BlobShape PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.BlobShape) */ { + public: + inline BlobShape() : BlobShape(nullptr) {}; + virtual ~BlobShape(); + + BlobShape(const BlobShape& from); + BlobShape(BlobShape&& from) noexcept + : BlobShape() { + *this = ::std::move(from); + } + + inline BlobShape& operator=(const BlobShape& from) { + CopyFrom(from); + return *this; + } + inline BlobShape& operator=(BlobShape&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const BlobShape& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const BlobShape* internal_default_instance() { + return reinterpret_cast( + &_BlobShape_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(BlobShape& a, BlobShape& b) { + a.Swap(&b); + } + inline void Swap(BlobShape* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BlobShape* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BlobShape* New() const final { + return CreateMaybeMessage(nullptr); + } + + BlobShape* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const BlobShape& from); + void MergeFrom(const BlobShape& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BlobShape* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.BlobShape"; + } + protected: + explicit BlobShape(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDimFieldNumber = 1, + }; + // repeated int64 dim = 1 [packed = true]; + int dim_size() const; + private: + int _internal_dim_size() const; + public: + void clear_dim(); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_dim(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& + _internal_dim() const; + void _internal_add_dim(::PROTOBUF_NAMESPACE_ID::int64 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* + _internal_mutable_dim(); + public: + ::PROTOBUF_NAMESPACE_ID::int64 dim(int index) const; + void set_dim(int index, ::PROTOBUF_NAMESPACE_ID::int64 value); + void add_dim(::PROTOBUF_NAMESPACE_ID::int64 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& + dim() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* + mutable_dim(); + + // @@protoc_insertion_point(class_scope:caffe.BlobShape) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 > dim_; + mutable std::atomic _dim_cached_byte_size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class BlobProto PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.BlobProto) */ { + public: + inline BlobProto() : BlobProto(nullptr) {}; + virtual ~BlobProto(); + + BlobProto(const BlobProto& from); + BlobProto(BlobProto&& from) noexcept + : BlobProto() { + *this = ::std::move(from); + } + + inline BlobProto& operator=(const BlobProto& from) { + CopyFrom(from); + return *this; + } + inline BlobProto& operator=(BlobProto&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const BlobProto& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const BlobProto* internal_default_instance() { + return reinterpret_cast( + &_BlobProto_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(BlobProto& a, BlobProto& b) { + a.Swap(&b); + } + inline void Swap(BlobProto* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BlobProto* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BlobProto* New() const final { + return CreateMaybeMessage(nullptr); + } + + BlobProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const BlobProto& from); + void MergeFrom(const BlobProto& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BlobProto* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.BlobProto"; + } + protected: + explicit BlobProto(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 5, + kDiffFieldNumber = 6, + kDoubleDataFieldNumber = 8, + kDoubleDiffFieldNumber = 9, + kShapeFieldNumber = 7, + kNumFieldNumber = 1, + kChannelsFieldNumber = 2, + kHeightFieldNumber = 3, + kWidthFieldNumber = 4, + }; + // repeated float data = 5 [packed = true]; + int data_size() const; + private: + int _internal_data_size() const; + public: + void clear_data(); + private: + float _internal_data(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_data() const; + void _internal_add_data(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_data(); + public: + float data(int index) const; + void set_data(int index, float value); + void add_data(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + data() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_data(); + + // repeated float diff = 6 [packed = true]; + int diff_size() const; + private: + int _internal_diff_size() const; + public: + void clear_diff(); + private: + float _internal_diff(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_diff() const; + void _internal_add_diff(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_diff(); + public: + float diff(int index) const; + void set_diff(int index, float value); + void add_diff(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + diff() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_diff(); + + // repeated double double_data = 8 [packed = true]; + int double_data_size() const; + private: + int _internal_double_data_size() const; + public: + void clear_double_data(); + private: + double _internal_double_data(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& + _internal_double_data() const; + void _internal_add_double_data(double value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* + _internal_mutable_double_data(); + public: + double double_data(int index) const; + void set_double_data(int index, double value); + void add_double_data(double value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& + double_data() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* + mutable_double_data(); + + // repeated double double_diff = 9 [packed = true]; + int double_diff_size() const; + private: + int _internal_double_diff_size() const; + public: + void clear_double_diff(); + private: + double _internal_double_diff(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& + _internal_double_diff() const; + void _internal_add_double_diff(double value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* + _internal_mutable_double_diff(); + public: + double double_diff(int index) const; + void set_double_diff(int index, double value); + void add_double_diff(double value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& + double_diff() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* + mutable_double_diff(); + + // optional .caffe.BlobShape shape = 7; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::caffe::BlobShape& shape() const; + ::caffe::BlobShape* release_shape(); + ::caffe::BlobShape* mutable_shape(); + void set_allocated_shape(::caffe::BlobShape* shape); + private: + const ::caffe::BlobShape& _internal_shape() const; + ::caffe::BlobShape* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape); + ::caffe::BlobShape* unsafe_arena_release_shape(); + + // optional int32 num = 1 [default = 0]; + bool has_num() const; + private: + bool _internal_has_num() const; + public: + void clear_num(); + ::PROTOBUF_NAMESPACE_ID::int32 num() const; + void set_num(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_num() const; + void _internal_set_num(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 channels = 2 [default = 0]; + bool has_channels() const; + private: + bool _internal_has_channels() const; + public: + void clear_channels(); + ::PROTOBUF_NAMESPACE_ID::int32 channels() const; + void set_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_channels() const; + void _internal_set_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 height = 3 [default = 0]; + bool has_height() const; + private: + bool _internal_has_height() const; + public: + void clear_height(); + ::PROTOBUF_NAMESPACE_ID::int32 height() const; + void set_height(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_height() const; + void _internal_set_height(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 width = 4 [default = 0]; + bool has_width() const; + private: + bool _internal_has_width() const; + public: + void clear_width(); + ::PROTOBUF_NAMESPACE_ID::int32 width() const; + void set_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_width() const; + void _internal_set_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.BlobProto) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > data_; + mutable std::atomic _data_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > diff_; + mutable std::atomic _diff_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double > double_data_; + mutable std::atomic _double_data_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< double > double_diff_; + mutable std::atomic _double_diff_cached_byte_size_; + ::caffe::BlobShape* shape_; + ::PROTOBUF_NAMESPACE_ID::int32 num_; + ::PROTOBUF_NAMESPACE_ID::int32 channels_; + ::PROTOBUF_NAMESPACE_ID::int32 height_; + ::PROTOBUF_NAMESPACE_ID::int32 width_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class BlobProtoVector PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.BlobProtoVector) */ { + public: + inline BlobProtoVector() : BlobProtoVector(nullptr) {}; + virtual ~BlobProtoVector(); + + BlobProtoVector(const BlobProtoVector& from); + BlobProtoVector(BlobProtoVector&& from) noexcept + : BlobProtoVector() { + *this = ::std::move(from); + } + + inline BlobProtoVector& operator=(const BlobProtoVector& from) { + CopyFrom(from); + return *this; + } + inline BlobProtoVector& operator=(BlobProtoVector&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const BlobProtoVector& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const BlobProtoVector* internal_default_instance() { + return reinterpret_cast( + &_BlobProtoVector_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(BlobProtoVector& a, BlobProtoVector& b) { + a.Swap(&b); + } + inline void Swap(BlobProtoVector* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BlobProtoVector* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BlobProtoVector* New() const final { + return CreateMaybeMessage(nullptr); + } + + BlobProtoVector* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const BlobProtoVector& from); + void MergeFrom(const BlobProtoVector& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BlobProtoVector* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.BlobProtoVector"; + } + protected: + explicit BlobProtoVector(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBlobsFieldNumber = 1, + }; + // repeated .caffe.BlobProto blobs = 1; + int blobs_size() const; + private: + int _internal_blobs_size() const; + public: + void clear_blobs(); + ::caffe::BlobProto* mutable_blobs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* + mutable_blobs(); + private: + const ::caffe::BlobProto& _internal_blobs(int index) const; + ::caffe::BlobProto* _internal_add_blobs(); + public: + const ::caffe::BlobProto& blobs(int index) const; + ::caffe::BlobProto* add_blobs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& + blobs() const; + + // @@protoc_insertion_point(class_scope:caffe.BlobProtoVector) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto > blobs_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class Datum PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.Datum) */ { + public: + inline Datum() : Datum(nullptr) {}; + virtual ~Datum(); + + Datum(const Datum& from); + Datum(Datum&& from) noexcept + : Datum() { + *this = ::std::move(from); + } + + inline Datum& operator=(const Datum& from) { + CopyFrom(from); + return *this; + } + inline Datum& operator=(Datum&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const Datum& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const Datum* internal_default_instance() { + return reinterpret_cast( + &_Datum_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(Datum& a, Datum& b) { + a.Swap(&b); + } + inline void Swap(Datum* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Datum* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline Datum* New() const final { + return CreateMaybeMessage(nullptr); + } + + Datum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const Datum& from); + void MergeFrom(const Datum& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Datum* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.Datum"; + } + protected: + explicit Datum(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFloatDataFieldNumber = 6, + kDataFieldNumber = 4, + kChannelsFieldNumber = 1, + kHeightFieldNumber = 2, + kWidthFieldNumber = 3, + kLabelFieldNumber = 5, + kEncodedFieldNumber = 7, + }; + // repeated float float_data = 6; + int float_data_size() const; + private: + int _internal_float_data_size() const; + public: + void clear_float_data(); + private: + float _internal_float_data(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_float_data() const; + void _internal_add_float_data(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_float_data(); + public: + float float_data(int index) const; + void set_float_data(int index, float value); + void add_float_data(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + float_data() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_float_data(); + + // optional bytes data = 4; + bool has_data() const; + private: + bool _internal_has_data() const; + public: + void clear_data(); + const std::string& data() const; + void set_data(const std::string& value); + void set_data(std::string&& value); + void set_data(const char* value); + void set_data(const void* value, size_t size); + std::string* mutable_data(); + std::string* release_data(); + void set_allocated_data(std::string* data); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_data(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_data( + std::string* data); + private: + const std::string& _internal_data() const; + void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // optional int32 channels = 1; + bool has_channels() const; + private: + bool _internal_has_channels() const; + public: + void clear_channels(); + ::PROTOBUF_NAMESPACE_ID::int32 channels() const; + void set_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_channels() const; + void _internal_set_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 height = 2; + bool has_height() const; + private: + bool _internal_has_height() const; + public: + void clear_height(); + ::PROTOBUF_NAMESPACE_ID::int32 height() const; + void set_height(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_height() const; + void _internal_set_height(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 width = 3; + bool has_width() const; + private: + bool _internal_has_width() const; + public: + void clear_width(); + ::PROTOBUF_NAMESPACE_ID::int32 width() const; + void set_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_width() const; + void _internal_set_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 label = 5; + bool has_label() const; + private: + bool _internal_has_label() const; + public: + void clear_label(); + ::PROTOBUF_NAMESPACE_ID::int32 label() const; + void set_label(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_label() const; + void _internal_set_label(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool encoded = 7 [default = false]; + bool has_encoded() const; + private: + bool _internal_has_encoded() const; + public: + void clear_encoded(); + bool encoded() const; + void set_encoded(bool value); + private: + bool _internal_encoded() const; + void _internal_set_encoded(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.Datum) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > float_data_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + ::PROTOBUF_NAMESPACE_ID::int32 channels_; + ::PROTOBUF_NAMESPACE_ID::int32 height_; + ::PROTOBUF_NAMESPACE_ID::int32 width_; + ::PROTOBUF_NAMESPACE_ID::int32 label_; + bool encoded_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class FillerParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.FillerParameter) */ { + public: + inline FillerParameter() : FillerParameter(nullptr) {}; + virtual ~FillerParameter(); + + FillerParameter(const FillerParameter& from); + FillerParameter(FillerParameter&& from) noexcept + : FillerParameter() { + *this = ::std::move(from); + } + + inline FillerParameter& operator=(const FillerParameter& from) { + CopyFrom(from); + return *this; + } + inline FillerParameter& operator=(FillerParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const FillerParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const FillerParameter* internal_default_instance() { + return reinterpret_cast( + &_FillerParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(FillerParameter& a, FillerParameter& b) { + a.Swap(&b); + } + inline void Swap(FillerParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FillerParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline FillerParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + FillerParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const FillerParameter& from); + void MergeFrom(const FillerParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(FillerParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.FillerParameter"; + } + protected: + explicit FillerParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef FillerParameter_VarianceNorm VarianceNorm; + static constexpr VarianceNorm FAN_IN = + FillerParameter_VarianceNorm_FAN_IN; + static constexpr VarianceNorm FAN_OUT = + FillerParameter_VarianceNorm_FAN_OUT; + static constexpr VarianceNorm AVERAGE = + FillerParameter_VarianceNorm_AVERAGE; + static inline bool VarianceNorm_IsValid(int value) { + return FillerParameter_VarianceNorm_IsValid(value); + } + static constexpr VarianceNorm VarianceNorm_MIN = + FillerParameter_VarianceNorm_VarianceNorm_MIN; + static constexpr VarianceNorm VarianceNorm_MAX = + FillerParameter_VarianceNorm_VarianceNorm_MAX; + static constexpr int VarianceNorm_ARRAYSIZE = + FillerParameter_VarianceNorm_VarianceNorm_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + VarianceNorm_descriptor() { + return FillerParameter_VarianceNorm_descriptor(); + } + template + static inline const std::string& VarianceNorm_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function VarianceNorm_Name."); + return FillerParameter_VarianceNorm_Name(enum_t_value); + } + static inline bool VarianceNorm_Parse(const std::string& name, + VarianceNorm* value) { + return FillerParameter_VarianceNorm_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kTypeFieldNumber = 1, + kValueFieldNumber = 2, + kMinFieldNumber = 3, + kMeanFieldNumber = 5, + kVarianceNormFieldNumber = 8, + kSparseFieldNumber = 7, + kMaxFieldNumber = 4, + kStdFieldNumber = 6, + }; + // optional string type = 1 [default = "constant"]; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // optional float value = 2 [default = 0]; + bool has_value() const; + private: + bool _internal_has_value() const; + public: + void clear_value(); + float value() const; + void set_value(float value); + private: + float _internal_value() const; + void _internal_set_value(float value); + public: + + // optional float min = 3 [default = 0]; + bool has_min() const; + private: + bool _internal_has_min() const; + public: + void clear_min(); + float min() const; + void set_min(float value); + private: + float _internal_min() const; + void _internal_set_min(float value); + public: + + // optional float mean = 5 [default = 0]; + bool has_mean() const; + private: + bool _internal_has_mean() const; + public: + void clear_mean(); + float mean() const; + void set_mean(float value); + private: + float _internal_mean() const; + void _internal_set_mean(float value); + public: + + // optional .caffe.FillerParameter.VarianceNorm variance_norm = 8 [default = FAN_IN]; + bool has_variance_norm() const; + private: + bool _internal_has_variance_norm() const; + public: + void clear_variance_norm(); + ::caffe::FillerParameter_VarianceNorm variance_norm() const; + void set_variance_norm(::caffe::FillerParameter_VarianceNorm value); + private: + ::caffe::FillerParameter_VarianceNorm _internal_variance_norm() const; + void _internal_set_variance_norm(::caffe::FillerParameter_VarianceNorm value); + public: + + // optional int32 sparse = 7 [default = -1]; + bool has_sparse() const; + private: + bool _internal_has_sparse() const; + public: + void clear_sparse(); + ::PROTOBUF_NAMESPACE_ID::int32 sparse() const; + void set_sparse(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_sparse() const; + void _internal_set_sparse(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional float max = 4 [default = 1]; + bool has_max() const; + private: + bool _internal_has_max() const; + public: + void clear_max(); + float max() const; + void set_max(float value); + private: + float _internal_max() const; + void _internal_set_max(float value); + public: + + // optional float std = 6 [default = 1]; + bool has_std() const; + private: + bool _internal_has_std() const; + public: + void clear_std(); + float std() const; + void set_std(float value); + private: + float _internal_std() const; + void _internal_set_std(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.FillerParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + public: + static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _i_give_permission_to_break_this_code_default_type_; + private: + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + float value_; + float min_; + float mean_; + int variance_norm_; + ::PROTOBUF_NAMESPACE_ID::int32 sparse_; + float max_; + float std_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class NetParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.NetParameter) */ { + public: + inline NetParameter() : NetParameter(nullptr) {}; + virtual ~NetParameter(); + + NetParameter(const NetParameter& from); + NetParameter(NetParameter&& from) noexcept + : NetParameter() { + *this = ::std::move(from); + } + + inline NetParameter& operator=(const NetParameter& from) { + CopyFrom(from); + return *this; + } + inline NetParameter& operator=(NetParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const NetParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const NetParameter* internal_default_instance() { + return reinterpret_cast( + &_NetParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(NetParameter& a, NetParameter& b) { + a.Swap(&b); + } + inline void Swap(NetParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NetParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline NetParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + NetParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const NetParameter& from); + void MergeFrom(const NetParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(NetParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.NetParameter"; + } + protected: + explicit NetParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kLayersFieldNumber = 2, + kInputFieldNumber = 3, + kInputDimFieldNumber = 4, + kInputShapeFieldNumber = 8, + kLayerFieldNumber = 100, + kNameFieldNumber = 1, + kStateFieldNumber = 6, + kForceBackwardFieldNumber = 5, + kDebugInfoFieldNumber = 7, + }; + // repeated .caffe.V1LayerParameter layers = 2; + int layers_size() const; + private: + int _internal_layers_size() const; + public: + void clear_layers(); + ::caffe::V1LayerParameter* mutable_layers(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::V1LayerParameter >* + mutable_layers(); + private: + const ::caffe::V1LayerParameter& _internal_layers(int index) const; + ::caffe::V1LayerParameter* _internal_add_layers(); + public: + const ::caffe::V1LayerParameter& layers(int index) const; + ::caffe::V1LayerParameter* add_layers(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::V1LayerParameter >& + layers() const; + + // repeated string input = 3; + int input_size() const; + private: + int _internal_input_size() const; + public: + void clear_input(); + const std::string& input(int index) const; + std::string* mutable_input(int index); + void set_input(int index, const std::string& value); + void set_input(int index, std::string&& value); + void set_input(int index, const char* value); + void set_input(int index, const char* value, size_t size); + std::string* add_input(); + void add_input(const std::string& value); + void add_input(std::string&& value); + void add_input(const char* value); + void add_input(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& input() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_input(); + private: + const std::string& _internal_input(int index) const; + std::string* _internal_add_input(); + public: + + // repeated int32 input_dim = 4; + int input_dim_size() const; + private: + int _internal_input_dim_size() const; + public: + void clear_input_dim(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_input_dim(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_input_dim() const; + void _internal_add_input_dim(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_input_dim(); + public: + ::PROTOBUF_NAMESPACE_ID::int32 input_dim(int index) const; + void set_input_dim(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); + void add_input_dim(::PROTOBUF_NAMESPACE_ID::int32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + input_dim() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + mutable_input_dim(); + + // repeated .caffe.BlobShape input_shape = 8; + int input_shape_size() const; + private: + int _internal_input_shape_size() const; + public: + void clear_input_shape(); + ::caffe::BlobShape* mutable_input_shape(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* + mutable_input_shape(); + private: + const ::caffe::BlobShape& _internal_input_shape(int index) const; + ::caffe::BlobShape* _internal_add_input_shape(); + public: + const ::caffe::BlobShape& input_shape(int index) const; + ::caffe::BlobShape* add_input_shape(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& + input_shape() const; + + // repeated .caffe.LayerParameter layer = 100; + int layer_size() const; + private: + int _internal_layer_size() const; + public: + void clear_layer(); + ::caffe::LayerParameter* mutable_layer(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::LayerParameter >* + mutable_layer(); + private: + const ::caffe::LayerParameter& _internal_layer(int index) const; + ::caffe::LayerParameter* _internal_add_layer(); + public: + const ::caffe::LayerParameter& layer(int index) const; + ::caffe::LayerParameter* add_layer(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::LayerParameter >& + layer() const; + + // optional string name = 1; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // optional .caffe.NetState state = 6; + bool has_state() const; + private: + bool _internal_has_state() const; + public: + void clear_state(); + const ::caffe::NetState& state() const; + ::caffe::NetState* release_state(); + ::caffe::NetState* mutable_state(); + void set_allocated_state(::caffe::NetState* state); + private: + const ::caffe::NetState& _internal_state() const; + ::caffe::NetState* _internal_mutable_state(); + public: + void unsafe_arena_set_allocated_state( + ::caffe::NetState* state); + ::caffe::NetState* unsafe_arena_release_state(); + + // optional bool force_backward = 5 [default = false]; + bool has_force_backward() const; + private: + bool _internal_has_force_backward() const; + public: + void clear_force_backward(); + bool force_backward() const; + void set_force_backward(bool value); + private: + bool _internal_force_backward() const; + void _internal_set_force_backward(bool value); + public: + + // optional bool debug_info = 7 [default = false]; + bool has_debug_info() const; + private: + bool _internal_has_debug_info() const; + public: + void clear_debug_info(); + bool debug_info() const; + void set_debug_info(bool value); + private: + bool _internal_debug_info() const; + void _internal_set_debug_info(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.NetParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::V1LayerParameter > layers_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField input_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > input_dim_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape > input_shape_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::LayerParameter > layer_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::caffe::NetState* state_; + bool force_backward_; + bool debug_info_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SolverParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SolverParameter) */ { + public: + inline SolverParameter() : SolverParameter(nullptr) {}; + virtual ~SolverParameter(); + + SolverParameter(const SolverParameter& from); + SolverParameter(SolverParameter&& from) noexcept + : SolverParameter() { + *this = ::std::move(from); + } + + inline SolverParameter& operator=(const SolverParameter& from) { + CopyFrom(from); + return *this; + } + inline SolverParameter& operator=(SolverParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SolverParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SolverParameter* internal_default_instance() { + return reinterpret_cast( + &_SolverParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(SolverParameter& a, SolverParameter& b) { + a.Swap(&b); + } + inline void Swap(SolverParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SolverParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SolverParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SolverParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SolverParameter& from); + void MergeFrom(const SolverParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SolverParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SolverParameter"; + } + protected: + explicit SolverParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef SolverParameter_SnapshotFormat SnapshotFormat; + static constexpr SnapshotFormat HDF5 = + SolverParameter_SnapshotFormat_HDF5; + static constexpr SnapshotFormat BINARYPROTO = + SolverParameter_SnapshotFormat_BINARYPROTO; + static inline bool SnapshotFormat_IsValid(int value) { + return SolverParameter_SnapshotFormat_IsValid(value); + } + static constexpr SnapshotFormat SnapshotFormat_MIN = + SolverParameter_SnapshotFormat_SnapshotFormat_MIN; + static constexpr SnapshotFormat SnapshotFormat_MAX = + SolverParameter_SnapshotFormat_SnapshotFormat_MAX; + static constexpr int SnapshotFormat_ARRAYSIZE = + SolverParameter_SnapshotFormat_SnapshotFormat_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + SnapshotFormat_descriptor() { + return SolverParameter_SnapshotFormat_descriptor(); + } + template + static inline const std::string& SnapshotFormat_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SnapshotFormat_Name."); + return SolverParameter_SnapshotFormat_Name(enum_t_value); + } + static inline bool SnapshotFormat_Parse(const std::string& name, + SnapshotFormat* value) { + return SolverParameter_SnapshotFormat_Parse(name, value); + } + + typedef SolverParameter_SolverMode SolverMode; + static constexpr SolverMode CPU = + SolverParameter_SolverMode_CPU; + static constexpr SolverMode GPU = + SolverParameter_SolverMode_GPU; + static inline bool SolverMode_IsValid(int value) { + return SolverParameter_SolverMode_IsValid(value); + } + static constexpr SolverMode SolverMode_MIN = + SolverParameter_SolverMode_SolverMode_MIN; + static constexpr SolverMode SolverMode_MAX = + SolverParameter_SolverMode_SolverMode_MAX; + static constexpr int SolverMode_ARRAYSIZE = + SolverParameter_SolverMode_SolverMode_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + SolverMode_descriptor() { + return SolverParameter_SolverMode_descriptor(); + } + template + static inline const std::string& SolverMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SolverMode_Name."); + return SolverParameter_SolverMode_Name(enum_t_value); + } + static inline bool SolverMode_Parse(const std::string& name, + SolverMode* value) { + return SolverParameter_SolverMode_Parse(name, value); + } + + typedef SolverParameter_SolverType SolverType; + static constexpr SolverType SGD = + SolverParameter_SolverType_SGD; + static constexpr SolverType NESTEROV = + SolverParameter_SolverType_NESTEROV; + static constexpr SolverType ADAGRAD = + SolverParameter_SolverType_ADAGRAD; + static constexpr SolverType RMSPROP = + SolverParameter_SolverType_RMSPROP; + static constexpr SolverType ADADELTA = + SolverParameter_SolverType_ADADELTA; + static constexpr SolverType ADAM = + SolverParameter_SolverType_ADAM; + static inline bool SolverType_IsValid(int value) { + return SolverParameter_SolverType_IsValid(value); + } + static constexpr SolverType SolverType_MIN = + SolverParameter_SolverType_SolverType_MIN; + static constexpr SolverType SolverType_MAX = + SolverParameter_SolverType_SolverType_MAX; + static constexpr int SolverType_ARRAYSIZE = + SolverParameter_SolverType_SolverType_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + SolverType_descriptor() { + return SolverParameter_SolverType_descriptor(); + } + template + static inline const std::string& SolverType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SolverType_Name."); + return SolverParameter_SolverType_Name(enum_t_value); + } + static inline bool SolverType_Parse(const std::string& name, + SolverType* value) { + return SolverParameter_SolverType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kTestNetFieldNumber = 2, + kTestIterFieldNumber = 3, + kTestNetParamFieldNumber = 22, + kTestStateFieldNumber = 27, + kStepvalueFieldNumber = 34, + kWeightsFieldNumber = 42, + kTrainNetFieldNumber = 1, + kLrPolicyFieldNumber = 8, + kSnapshotPrefixFieldNumber = 15, + kNetFieldNumber = 24, + kRegularizationTypeFieldNumber = 29, + kTypeFieldNumber = 40, + kTrainNetParamFieldNumber = 21, + kNetParamFieldNumber = 25, + kTrainStateFieldNumber = 26, + kTestIntervalFieldNumber = 4, + kBaseLrFieldNumber = 5, + kDisplayFieldNumber = 6, + kMaxIterFieldNumber = 7, + kGammaFieldNumber = 9, + kPowerFieldNumber = 10, + kMomentumFieldNumber = 11, + kWeightDecayFieldNumber = 12, + kStepsizeFieldNumber = 13, + kSnapshotFieldNumber = 14, + kDeviceIdFieldNumber = 18, + kTestComputeLossFieldNumber = 19, + kSnapshotDiffFieldNumber = 16, + kDebugInfoFieldNumber = 23, + kSolverTypeFieldNumber = 30, + kMomentum2FieldNumber = 39, + kRandomSeedFieldNumber = 20, + kSolverModeFieldNumber = 17, + kDeltaFieldNumber = 31, + kAverageLossFieldNumber = 33, + kTestInitializationFieldNumber = 32, + kSnapshotAfterTrainFieldNumber = 28, + kLayerWiseReduceFieldNumber = 41, + kClipGradientsFieldNumber = 35, + kIterSizeFieldNumber = 36, + kSnapshotFormatFieldNumber = 37, + kRmsDecayFieldNumber = 38, + }; + // repeated string test_net = 2; + int test_net_size() const; + private: + int _internal_test_net_size() const; + public: + void clear_test_net(); + const std::string& test_net(int index) const; + std::string* mutable_test_net(int index); + void set_test_net(int index, const std::string& value); + void set_test_net(int index, std::string&& value); + void set_test_net(int index, const char* value); + void set_test_net(int index, const char* value, size_t size); + std::string* add_test_net(); + void add_test_net(const std::string& value); + void add_test_net(std::string&& value); + void add_test_net(const char* value); + void add_test_net(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& test_net() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_test_net(); + private: + const std::string& _internal_test_net(int index) const; + std::string* _internal_add_test_net(); + public: + + // repeated int32 test_iter = 3; + int test_iter_size() const; + private: + int _internal_test_iter_size() const; + public: + void clear_test_iter(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_test_iter(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_test_iter() const; + void _internal_add_test_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_test_iter(); + public: + ::PROTOBUF_NAMESPACE_ID::int32 test_iter(int index) const; + void set_test_iter(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); + void add_test_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + test_iter() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + mutable_test_iter(); + + // repeated .caffe.NetParameter test_net_param = 22; + int test_net_param_size() const; + private: + int _internal_test_net_param_size() const; + public: + void clear_test_net_param(); + ::caffe::NetParameter* mutable_test_net_param(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetParameter >* + mutable_test_net_param(); + private: + const ::caffe::NetParameter& _internal_test_net_param(int index) const; + ::caffe::NetParameter* _internal_add_test_net_param(); + public: + const ::caffe::NetParameter& test_net_param(int index) const; + ::caffe::NetParameter* add_test_net_param(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetParameter >& + test_net_param() const; + + // repeated .caffe.NetState test_state = 27; + int test_state_size() const; + private: + int _internal_test_state_size() const; + public: + void clear_test_state(); + ::caffe::NetState* mutable_test_state(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetState >* + mutable_test_state(); + private: + const ::caffe::NetState& _internal_test_state(int index) const; + ::caffe::NetState* _internal_add_test_state(); + public: + const ::caffe::NetState& test_state(int index) const; + ::caffe::NetState* add_test_state(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetState >& + test_state() const; + + // repeated int32 stepvalue = 34; + int stepvalue_size() const; + private: + int _internal_stepvalue_size() const; + public: + void clear_stepvalue(); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_stepvalue(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + _internal_stepvalue() const; + void _internal_add_stepvalue(::PROTOBUF_NAMESPACE_ID::int32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + _internal_mutable_stepvalue(); + public: + ::PROTOBUF_NAMESPACE_ID::int32 stepvalue(int index) const; + void set_stepvalue(int index, ::PROTOBUF_NAMESPACE_ID::int32 value); + void add_stepvalue(::PROTOBUF_NAMESPACE_ID::int32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& + stepvalue() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* + mutable_stepvalue(); + + // repeated string weights = 42; + int weights_size() const; + private: + int _internal_weights_size() const; + public: + void clear_weights(); + const std::string& weights(int index) const; + std::string* mutable_weights(int index); + void set_weights(int index, const std::string& value); + void set_weights(int index, std::string&& value); + void set_weights(int index, const char* value); + void set_weights(int index, const char* value, size_t size); + std::string* add_weights(); + void add_weights(const std::string& value); + void add_weights(std::string&& value); + void add_weights(const char* value); + void add_weights(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& weights() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_weights(); + private: + const std::string& _internal_weights(int index) const; + std::string* _internal_add_weights(); + public: + + // optional string train_net = 1; + bool has_train_net() const; + private: + bool _internal_has_train_net() const; + public: + void clear_train_net(); + const std::string& train_net() const; + void set_train_net(const std::string& value); + void set_train_net(std::string&& value); + void set_train_net(const char* value); + void set_train_net(const char* value, size_t size); + std::string* mutable_train_net(); + std::string* release_train_net(); + void set_allocated_train_net(std::string* train_net); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_train_net(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_train_net( + std::string* train_net); + private: + const std::string& _internal_train_net() const; + void _internal_set_train_net(const std::string& value); + std::string* _internal_mutable_train_net(); + public: + + // optional string lr_policy = 8; + bool has_lr_policy() const; + private: + bool _internal_has_lr_policy() const; + public: + void clear_lr_policy(); + const std::string& lr_policy() const; + void set_lr_policy(const std::string& value); + void set_lr_policy(std::string&& value); + void set_lr_policy(const char* value); + void set_lr_policy(const char* value, size_t size); + std::string* mutable_lr_policy(); + std::string* release_lr_policy(); + void set_allocated_lr_policy(std::string* lr_policy); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_lr_policy(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_lr_policy( + std::string* lr_policy); + private: + const std::string& _internal_lr_policy() const; + void _internal_set_lr_policy(const std::string& value); + std::string* _internal_mutable_lr_policy(); + public: + + // optional string snapshot_prefix = 15; + bool has_snapshot_prefix() const; + private: + bool _internal_has_snapshot_prefix() const; + public: + void clear_snapshot_prefix(); + const std::string& snapshot_prefix() const; + void set_snapshot_prefix(const std::string& value); + void set_snapshot_prefix(std::string&& value); + void set_snapshot_prefix(const char* value); + void set_snapshot_prefix(const char* value, size_t size); + std::string* mutable_snapshot_prefix(); + std::string* release_snapshot_prefix(); + void set_allocated_snapshot_prefix(std::string* snapshot_prefix); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_snapshot_prefix(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_snapshot_prefix( + std::string* snapshot_prefix); + private: + const std::string& _internal_snapshot_prefix() const; + void _internal_set_snapshot_prefix(const std::string& value); + std::string* _internal_mutable_snapshot_prefix(); + public: + + // optional string net = 24; + bool has_net() const; + private: + bool _internal_has_net() const; + public: + void clear_net(); + const std::string& net() const; + void set_net(const std::string& value); + void set_net(std::string&& value); + void set_net(const char* value); + void set_net(const char* value, size_t size); + std::string* mutable_net(); + std::string* release_net(); + void set_allocated_net(std::string* net); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_net(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_net( + std::string* net); + private: + const std::string& _internal_net() const; + void _internal_set_net(const std::string& value); + std::string* _internal_mutable_net(); + public: + + // optional string regularization_type = 29 [default = "L2"]; + bool has_regularization_type() const; + private: + bool _internal_has_regularization_type() const; + public: + void clear_regularization_type(); + const std::string& regularization_type() const; + void set_regularization_type(const std::string& value); + void set_regularization_type(std::string&& value); + void set_regularization_type(const char* value); + void set_regularization_type(const char* value, size_t size); + std::string* mutable_regularization_type(); + std::string* release_regularization_type(); + void set_allocated_regularization_type(std::string* regularization_type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_regularization_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_regularization_type( + std::string* regularization_type); + private: + const std::string& _internal_regularization_type() const; + void _internal_set_regularization_type(const std::string& value); + std::string* _internal_mutable_regularization_type(); + public: + + // optional string type = 40 [default = "SGD"]; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // optional .caffe.NetParameter train_net_param = 21; + bool has_train_net_param() const; + private: + bool _internal_has_train_net_param() const; + public: + void clear_train_net_param(); + const ::caffe::NetParameter& train_net_param() const; + ::caffe::NetParameter* release_train_net_param(); + ::caffe::NetParameter* mutable_train_net_param(); + void set_allocated_train_net_param(::caffe::NetParameter* train_net_param); + private: + const ::caffe::NetParameter& _internal_train_net_param() const; + ::caffe::NetParameter* _internal_mutable_train_net_param(); + public: + void unsafe_arena_set_allocated_train_net_param( + ::caffe::NetParameter* train_net_param); + ::caffe::NetParameter* unsafe_arena_release_train_net_param(); + + // optional .caffe.NetParameter net_param = 25; + bool has_net_param() const; + private: + bool _internal_has_net_param() const; + public: + void clear_net_param(); + const ::caffe::NetParameter& net_param() const; + ::caffe::NetParameter* release_net_param(); + ::caffe::NetParameter* mutable_net_param(); + void set_allocated_net_param(::caffe::NetParameter* net_param); + private: + const ::caffe::NetParameter& _internal_net_param() const; + ::caffe::NetParameter* _internal_mutable_net_param(); + public: + void unsafe_arena_set_allocated_net_param( + ::caffe::NetParameter* net_param); + ::caffe::NetParameter* unsafe_arena_release_net_param(); + + // optional .caffe.NetState train_state = 26; + bool has_train_state() const; + private: + bool _internal_has_train_state() const; + public: + void clear_train_state(); + const ::caffe::NetState& train_state() const; + ::caffe::NetState* release_train_state(); + ::caffe::NetState* mutable_train_state(); + void set_allocated_train_state(::caffe::NetState* train_state); + private: + const ::caffe::NetState& _internal_train_state() const; + ::caffe::NetState* _internal_mutable_train_state(); + public: + void unsafe_arena_set_allocated_train_state( + ::caffe::NetState* train_state); + ::caffe::NetState* unsafe_arena_release_train_state(); + + // optional int32 test_interval = 4 [default = 0]; + bool has_test_interval() const; + private: + bool _internal_has_test_interval() const; + public: + void clear_test_interval(); + ::PROTOBUF_NAMESPACE_ID::int32 test_interval() const; + void set_test_interval(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_test_interval() const; + void _internal_set_test_interval(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional float base_lr = 5; + bool has_base_lr() const; + private: + bool _internal_has_base_lr() const; + public: + void clear_base_lr(); + float base_lr() const; + void set_base_lr(float value); + private: + float _internal_base_lr() const; + void _internal_set_base_lr(float value); + public: + + // optional int32 display = 6; + bool has_display() const; + private: + bool _internal_has_display() const; + public: + void clear_display(); + ::PROTOBUF_NAMESPACE_ID::int32 display() const; + void set_display(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_display() const; + void _internal_set_display(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 max_iter = 7; + bool has_max_iter() const; + private: + bool _internal_has_max_iter() const; + public: + void clear_max_iter(); + ::PROTOBUF_NAMESPACE_ID::int32 max_iter() const; + void set_max_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_max_iter() const; + void _internal_set_max_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional float gamma = 9; + bool has_gamma() const; + private: + bool _internal_has_gamma() const; + public: + void clear_gamma(); + float gamma() const; + void set_gamma(float value); + private: + float _internal_gamma() const; + void _internal_set_gamma(float value); + public: + + // optional float power = 10; + bool has_power() const; + private: + bool _internal_has_power() const; + public: + void clear_power(); + float power() const; + void set_power(float value); + private: + float _internal_power() const; + void _internal_set_power(float value); + public: + + // optional float momentum = 11; + bool has_momentum() const; + private: + bool _internal_has_momentum() const; + public: + void clear_momentum(); + float momentum() const; + void set_momentum(float value); + private: + float _internal_momentum() const; + void _internal_set_momentum(float value); + public: + + // optional float weight_decay = 12; + bool has_weight_decay() const; + private: + bool _internal_has_weight_decay() const; + public: + void clear_weight_decay(); + float weight_decay() const; + void set_weight_decay(float value); + private: + float _internal_weight_decay() const; + void _internal_set_weight_decay(float value); + public: + + // optional int32 stepsize = 13; + bool has_stepsize() const; + private: + bool _internal_has_stepsize() const; + public: + void clear_stepsize(); + ::PROTOBUF_NAMESPACE_ID::int32 stepsize() const; + void set_stepsize(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_stepsize() const; + void _internal_set_stepsize(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 snapshot = 14 [default = 0]; + bool has_snapshot() const; + private: + bool _internal_has_snapshot() const; + public: + void clear_snapshot(); + ::PROTOBUF_NAMESPACE_ID::int32 snapshot() const; + void set_snapshot(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_snapshot() const; + void _internal_set_snapshot(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 device_id = 18 [default = 0]; + bool has_device_id() const; + private: + bool _internal_has_device_id() const; + public: + void clear_device_id(); + ::PROTOBUF_NAMESPACE_ID::int32 device_id() const; + void set_device_id(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_device_id() const; + void _internal_set_device_id(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool test_compute_loss = 19 [default = false]; + bool has_test_compute_loss() const; + private: + bool _internal_has_test_compute_loss() const; + public: + void clear_test_compute_loss(); + bool test_compute_loss() const; + void set_test_compute_loss(bool value); + private: + bool _internal_test_compute_loss() const; + void _internal_set_test_compute_loss(bool value); + public: + + // optional bool snapshot_diff = 16 [default = false]; + bool has_snapshot_diff() const; + private: + bool _internal_has_snapshot_diff() const; + public: + void clear_snapshot_diff(); + bool snapshot_diff() const; + void set_snapshot_diff(bool value); + private: + bool _internal_snapshot_diff() const; + void _internal_set_snapshot_diff(bool value); + public: + + // optional bool debug_info = 23 [default = false]; + bool has_debug_info() const; + private: + bool _internal_has_debug_info() const; + public: + void clear_debug_info(); + bool debug_info() const; + void set_debug_info(bool value); + private: + bool _internal_debug_info() const; + void _internal_set_debug_info(bool value); + public: + + // optional .caffe.SolverParameter.SolverType solver_type = 30 [default = SGD]; + bool has_solver_type() const; + private: + bool _internal_has_solver_type() const; + public: + void clear_solver_type(); + ::caffe::SolverParameter_SolverType solver_type() const; + void set_solver_type(::caffe::SolverParameter_SolverType value); + private: + ::caffe::SolverParameter_SolverType _internal_solver_type() const; + void _internal_set_solver_type(::caffe::SolverParameter_SolverType value); + public: + + // optional float momentum2 = 39 [default = 0.999]; + bool has_momentum2() const; + private: + bool _internal_has_momentum2() const; + public: + void clear_momentum2(); + float momentum2() const; + void set_momentum2(float value); + private: + float _internal_momentum2() const; + void _internal_set_momentum2(float value); + public: + + // optional int64 random_seed = 20 [default = -1]; + bool has_random_seed() const; + private: + bool _internal_has_random_seed() const; + public: + void clear_random_seed(); + ::PROTOBUF_NAMESPACE_ID::int64 random_seed() const; + void set_random_seed(::PROTOBUF_NAMESPACE_ID::int64 value); + private: + ::PROTOBUF_NAMESPACE_ID::int64 _internal_random_seed() const; + void _internal_set_random_seed(::PROTOBUF_NAMESPACE_ID::int64 value); + public: + + // optional .caffe.SolverParameter.SolverMode solver_mode = 17 [default = GPU]; + bool has_solver_mode() const; + private: + bool _internal_has_solver_mode() const; + public: + void clear_solver_mode(); + ::caffe::SolverParameter_SolverMode solver_mode() const; + void set_solver_mode(::caffe::SolverParameter_SolverMode value); + private: + ::caffe::SolverParameter_SolverMode _internal_solver_mode() const; + void _internal_set_solver_mode(::caffe::SolverParameter_SolverMode value); + public: + + // optional float delta = 31 [default = 1e-08]; + bool has_delta() const; + private: + bool _internal_has_delta() const; + public: + void clear_delta(); + float delta() const; + void set_delta(float value); + private: + float _internal_delta() const; + void _internal_set_delta(float value); + public: + + // optional int32 average_loss = 33 [default = 1]; + bool has_average_loss() const; + private: + bool _internal_has_average_loss() const; + public: + void clear_average_loss(); + ::PROTOBUF_NAMESPACE_ID::int32 average_loss() const; + void set_average_loss(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_average_loss() const; + void _internal_set_average_loss(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool test_initialization = 32 [default = true]; + bool has_test_initialization() const; + private: + bool _internal_has_test_initialization() const; + public: + void clear_test_initialization(); + bool test_initialization() const; + void set_test_initialization(bool value); + private: + bool _internal_test_initialization() const; + void _internal_set_test_initialization(bool value); + public: + + // optional bool snapshot_after_train = 28 [default = true]; + bool has_snapshot_after_train() const; + private: + bool _internal_has_snapshot_after_train() const; + public: + void clear_snapshot_after_train(); + bool snapshot_after_train() const; + void set_snapshot_after_train(bool value); + private: + bool _internal_snapshot_after_train() const; + void _internal_set_snapshot_after_train(bool value); + public: + + // optional bool layer_wise_reduce = 41 [default = true]; + bool has_layer_wise_reduce() const; + private: + bool _internal_has_layer_wise_reduce() const; + public: + void clear_layer_wise_reduce(); + bool layer_wise_reduce() const; + void set_layer_wise_reduce(bool value); + private: + bool _internal_layer_wise_reduce() const; + void _internal_set_layer_wise_reduce(bool value); + public: + + // optional float clip_gradients = 35 [default = -1]; + bool has_clip_gradients() const; + private: + bool _internal_has_clip_gradients() const; + public: + void clear_clip_gradients(); + float clip_gradients() const; + void set_clip_gradients(float value); + private: + float _internal_clip_gradients() const; + void _internal_set_clip_gradients(float value); + public: + + // optional int32 iter_size = 36 [default = 1]; + bool has_iter_size() const; + private: + bool _internal_has_iter_size() const; + public: + void clear_iter_size(); + ::PROTOBUF_NAMESPACE_ID::int32 iter_size() const; + void set_iter_size(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_iter_size() const; + void _internal_set_iter_size(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional .caffe.SolverParameter.SnapshotFormat snapshot_format = 37 [default = BINARYPROTO]; + bool has_snapshot_format() const; + private: + bool _internal_has_snapshot_format() const; + public: + void clear_snapshot_format(); + ::caffe::SolverParameter_SnapshotFormat snapshot_format() const; + void set_snapshot_format(::caffe::SolverParameter_SnapshotFormat value); + private: + ::caffe::SolverParameter_SnapshotFormat _internal_snapshot_format() const; + void _internal_set_snapshot_format(::caffe::SolverParameter_SnapshotFormat value); + public: + + // optional float rms_decay = 38 [default = 0.99]; + bool has_rms_decay() const; + private: + bool _internal_has_rms_decay() const; + public: + void clear_rms_decay(); + float rms_decay() const; + void set_rms_decay(float value); + private: + float _internal_rms_decay() const; + void _internal_set_rms_decay(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SolverParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<2> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField test_net_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > test_iter_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetParameter > test_net_param_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetState > test_state_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > stepvalue_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField weights_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr train_net_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr lr_policy_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr snapshot_prefix_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr net_; + public: + static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _i_give_permission_to_break_this_code_default_regularization_type_; + private: + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr regularization_type_; + public: + static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _i_give_permission_to_break_this_code_default_type_; + private: + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + ::caffe::NetParameter* train_net_param_; + ::caffe::NetParameter* net_param_; + ::caffe::NetState* train_state_; + ::PROTOBUF_NAMESPACE_ID::int32 test_interval_; + float base_lr_; + ::PROTOBUF_NAMESPACE_ID::int32 display_; + ::PROTOBUF_NAMESPACE_ID::int32 max_iter_; + float gamma_; + float power_; + float momentum_; + float weight_decay_; + ::PROTOBUF_NAMESPACE_ID::int32 stepsize_; + ::PROTOBUF_NAMESPACE_ID::int32 snapshot_; + ::PROTOBUF_NAMESPACE_ID::int32 device_id_; + bool test_compute_loss_; + bool snapshot_diff_; + bool debug_info_; + int solver_type_; + float momentum2_; + ::PROTOBUF_NAMESPACE_ID::int64 random_seed_; + int solver_mode_; + float delta_; + ::PROTOBUF_NAMESPACE_ID::int32 average_loss_; + bool test_initialization_; + bool snapshot_after_train_; + bool layer_wise_reduce_; + float clip_gradients_; + ::PROTOBUF_NAMESPACE_ID::int32 iter_size_; + int snapshot_format_; + float rms_decay_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SolverState PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SolverState) */ { + public: + inline SolverState() : SolverState(nullptr) {}; + virtual ~SolverState(); + + SolverState(const SolverState& from); + SolverState(SolverState&& from) noexcept + : SolverState() { + *this = ::std::move(from); + } + + inline SolverState& operator=(const SolverState& from) { + CopyFrom(from); + return *this; + } + inline SolverState& operator=(SolverState&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SolverState& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SolverState* internal_default_instance() { + return reinterpret_cast( + &_SolverState_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(SolverState& a, SolverState& b) { + a.Swap(&b); + } + inline void Swap(SolverState* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SolverState* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SolverState* New() const final { + return CreateMaybeMessage(nullptr); + } + + SolverState* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SolverState& from); + void MergeFrom(const SolverState& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SolverState* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SolverState"; + } + protected: + explicit SolverState(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kHistoryFieldNumber = 3, + kLearnedNetFieldNumber = 2, + kIterFieldNumber = 1, + kCurrentStepFieldNumber = 4, + }; + // repeated .caffe.BlobProto history = 3; + int history_size() const; + private: + int _internal_history_size() const; + public: + void clear_history(); + ::caffe::BlobProto* mutable_history(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* + mutable_history(); + private: + const ::caffe::BlobProto& _internal_history(int index) const; + ::caffe::BlobProto* _internal_add_history(); + public: + const ::caffe::BlobProto& history(int index) const; + ::caffe::BlobProto* add_history(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& + history() const; + + // optional string learned_net = 2; + bool has_learned_net() const; + private: + bool _internal_has_learned_net() const; + public: + void clear_learned_net(); + const std::string& learned_net() const; + void set_learned_net(const std::string& value); + void set_learned_net(std::string&& value); + void set_learned_net(const char* value); + void set_learned_net(const char* value, size_t size); + std::string* mutable_learned_net(); + std::string* release_learned_net(); + void set_allocated_learned_net(std::string* learned_net); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_learned_net(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_learned_net( + std::string* learned_net); + private: + const std::string& _internal_learned_net() const; + void _internal_set_learned_net(const std::string& value); + std::string* _internal_mutable_learned_net(); + public: + + // optional int32 iter = 1; + bool has_iter() const; + private: + bool _internal_has_iter() const; + public: + void clear_iter(); + ::PROTOBUF_NAMESPACE_ID::int32 iter() const; + void set_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_iter() const; + void _internal_set_iter(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 current_step = 4 [default = 0]; + bool has_current_step() const; + private: + bool _internal_has_current_step() const; + public: + void clear_current_step(); + ::PROTOBUF_NAMESPACE_ID::int32 current_step() const; + void set_current_step(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_current_step() const; + void _internal_set_current_step(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SolverState) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto > history_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr learned_net_; + ::PROTOBUF_NAMESPACE_ID::int32 iter_; + ::PROTOBUF_NAMESPACE_ID::int32 current_step_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class NetState PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.NetState) */ { + public: + inline NetState() : NetState(nullptr) {}; + virtual ~NetState(); + + NetState(const NetState& from); + NetState(NetState&& from) noexcept + : NetState() { + *this = ::std::move(from); + } + + inline NetState& operator=(const NetState& from) { + CopyFrom(from); + return *this; + } + inline NetState& operator=(NetState&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const NetState& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const NetState* internal_default_instance() { + return reinterpret_cast( + &_NetState_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(NetState& a, NetState& b) { + a.Swap(&b); + } + inline void Swap(NetState* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NetState* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline NetState* New() const final { + return CreateMaybeMessage(nullptr); + } + + NetState* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const NetState& from); + void MergeFrom(const NetState& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(NetState* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.NetState"; + } + protected: + explicit NetState(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStageFieldNumber = 3, + kLevelFieldNumber = 2, + kPhaseFieldNumber = 1, + }; + // repeated string stage = 3; + int stage_size() const; + private: + int _internal_stage_size() const; + public: + void clear_stage(); + const std::string& stage(int index) const; + std::string* mutable_stage(int index); + void set_stage(int index, const std::string& value); + void set_stage(int index, std::string&& value); + void set_stage(int index, const char* value); + void set_stage(int index, const char* value, size_t size); + std::string* add_stage(); + void add_stage(const std::string& value); + void add_stage(std::string&& value); + void add_stage(const char* value); + void add_stage(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& stage() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_stage(); + private: + const std::string& _internal_stage(int index) const; + std::string* _internal_add_stage(); + public: + + // optional int32 level = 2 [default = 0]; + bool has_level() const; + private: + bool _internal_has_level() const; + public: + void clear_level(); + ::PROTOBUF_NAMESPACE_ID::int32 level() const; + void set_level(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_level() const; + void _internal_set_level(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional .caffe.Phase phase = 1 [default = TEST]; + bool has_phase() const; + private: + bool _internal_has_phase() const; + public: + void clear_phase(); + ::caffe::Phase phase() const; + void set_phase(::caffe::Phase value); + private: + ::caffe::Phase _internal_phase() const; + void _internal_set_phase(::caffe::Phase value); + public: + + // @@protoc_insertion_point(class_scope:caffe.NetState) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField stage_; + ::PROTOBUF_NAMESPACE_ID::int32 level_; + int phase_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class NetStateRule PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.NetStateRule) */ { + public: + inline NetStateRule() : NetStateRule(nullptr) {}; + virtual ~NetStateRule(); + + NetStateRule(const NetStateRule& from); + NetStateRule(NetStateRule&& from) noexcept + : NetStateRule() { + *this = ::std::move(from); + } + + inline NetStateRule& operator=(const NetStateRule& from) { + CopyFrom(from); + return *this; + } + inline NetStateRule& operator=(NetStateRule&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const NetStateRule& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const NetStateRule* internal_default_instance() { + return reinterpret_cast( + &_NetStateRule_default_instance_); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(NetStateRule& a, NetStateRule& b) { + a.Swap(&b); + } + inline void Swap(NetStateRule* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(NetStateRule* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline NetStateRule* New() const final { + return CreateMaybeMessage(nullptr); + } + + NetStateRule* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const NetStateRule& from); + void MergeFrom(const NetStateRule& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(NetStateRule* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.NetStateRule"; + } + protected: + explicit NetStateRule(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStageFieldNumber = 4, + kNotStageFieldNumber = 5, + kPhaseFieldNumber = 1, + kMinLevelFieldNumber = 2, + kMaxLevelFieldNumber = 3, + }; + // repeated string stage = 4; + int stage_size() const; + private: + int _internal_stage_size() const; + public: + void clear_stage(); + const std::string& stage(int index) const; + std::string* mutable_stage(int index); + void set_stage(int index, const std::string& value); + void set_stage(int index, std::string&& value); + void set_stage(int index, const char* value); + void set_stage(int index, const char* value, size_t size); + std::string* add_stage(); + void add_stage(const std::string& value); + void add_stage(std::string&& value); + void add_stage(const char* value); + void add_stage(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& stage() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_stage(); + private: + const std::string& _internal_stage(int index) const; + std::string* _internal_add_stage(); + public: + + // repeated string not_stage = 5; + int not_stage_size() const; + private: + int _internal_not_stage_size() const; + public: + void clear_not_stage(); + const std::string& not_stage(int index) const; + std::string* mutable_not_stage(int index); + void set_not_stage(int index, const std::string& value); + void set_not_stage(int index, std::string&& value); + void set_not_stage(int index, const char* value); + void set_not_stage(int index, const char* value, size_t size); + std::string* add_not_stage(); + void add_not_stage(const std::string& value); + void add_not_stage(std::string&& value); + void add_not_stage(const char* value); + void add_not_stage(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& not_stage() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_not_stage(); + private: + const std::string& _internal_not_stage(int index) const; + std::string* _internal_add_not_stage(); + public: + + // optional .caffe.Phase phase = 1; + bool has_phase() const; + private: + bool _internal_has_phase() const; + public: + void clear_phase(); + ::caffe::Phase phase() const; + void set_phase(::caffe::Phase value); + private: + ::caffe::Phase _internal_phase() const; + void _internal_set_phase(::caffe::Phase value); + public: + + // optional int32 min_level = 2; + bool has_min_level() const; + private: + bool _internal_has_min_level() const; + public: + void clear_min_level(); + ::PROTOBUF_NAMESPACE_ID::int32 min_level() const; + void set_min_level(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_min_level() const; + void _internal_set_min_level(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 max_level = 3; + bool has_max_level() const; + private: + bool _internal_has_max_level() const; + public: + void clear_max_level(); + ::PROTOBUF_NAMESPACE_ID::int32 max_level() const; + void set_max_level(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_max_level() const; + void _internal_set_max_level(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.NetStateRule) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField stage_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField not_stage_; + int phase_; + ::PROTOBUF_NAMESPACE_ID::int32 min_level_; + ::PROTOBUF_NAMESPACE_ID::int32 max_level_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ParamSpec PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ParamSpec) */ { + public: + inline ParamSpec() : ParamSpec(nullptr) {}; + virtual ~ParamSpec(); + + ParamSpec(const ParamSpec& from); + ParamSpec(ParamSpec&& from) noexcept + : ParamSpec() { + *this = ::std::move(from); + } + + inline ParamSpec& operator=(const ParamSpec& from) { + CopyFrom(from); + return *this; + } + inline ParamSpec& operator=(ParamSpec&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ParamSpec& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ParamSpec* internal_default_instance() { + return reinterpret_cast( + &_ParamSpec_default_instance_); + } + static constexpr int kIndexInFileMessages = + 10; + + friend void swap(ParamSpec& a, ParamSpec& b) { + a.Swap(&b); + } + inline void Swap(ParamSpec* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ParamSpec* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ParamSpec* New() const final { + return CreateMaybeMessage(nullptr); + } + + ParamSpec* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ParamSpec& from); + void MergeFrom(const ParamSpec& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ParamSpec* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ParamSpec"; + } + protected: + explicit ParamSpec(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef ParamSpec_DimCheckMode DimCheckMode; + static constexpr DimCheckMode STRICT = + ParamSpec_DimCheckMode_STRICT; + static constexpr DimCheckMode PERMISSIVE = + ParamSpec_DimCheckMode_PERMISSIVE; + static inline bool DimCheckMode_IsValid(int value) { + return ParamSpec_DimCheckMode_IsValid(value); + } + static constexpr DimCheckMode DimCheckMode_MIN = + ParamSpec_DimCheckMode_DimCheckMode_MIN; + static constexpr DimCheckMode DimCheckMode_MAX = + ParamSpec_DimCheckMode_DimCheckMode_MAX; + static constexpr int DimCheckMode_ARRAYSIZE = + ParamSpec_DimCheckMode_DimCheckMode_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + DimCheckMode_descriptor() { + return ParamSpec_DimCheckMode_descriptor(); + } + template + static inline const std::string& DimCheckMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DimCheckMode_Name."); + return ParamSpec_DimCheckMode_Name(enum_t_value); + } + static inline bool DimCheckMode_Parse(const std::string& name, + DimCheckMode* value) { + return ParamSpec_DimCheckMode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kNameFieldNumber = 1, + kShareModeFieldNumber = 2, + kLrMultFieldNumber = 3, + kDecayMultFieldNumber = 4, + }; + // optional string name = 1; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // optional .caffe.ParamSpec.DimCheckMode share_mode = 2; + bool has_share_mode() const; + private: + bool _internal_has_share_mode() const; + public: + void clear_share_mode(); + ::caffe::ParamSpec_DimCheckMode share_mode() const; + void set_share_mode(::caffe::ParamSpec_DimCheckMode value); + private: + ::caffe::ParamSpec_DimCheckMode _internal_share_mode() const; + void _internal_set_share_mode(::caffe::ParamSpec_DimCheckMode value); + public: + + // optional float lr_mult = 3 [default = 1]; + bool has_lr_mult() const; + private: + bool _internal_has_lr_mult() const; + public: + void clear_lr_mult(); + float lr_mult() const; + void set_lr_mult(float value); + private: + float _internal_lr_mult() const; + void _internal_set_lr_mult(float value); + public: + + // optional float decay_mult = 4 [default = 1]; + bool has_decay_mult() const; + private: + bool _internal_has_decay_mult() const; + public: + void clear_decay_mult(); + float decay_mult() const; + void set_decay_mult(float value); + private: + float _internal_decay_mult() const; + void _internal_set_decay_mult(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ParamSpec) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + int share_mode_; + float lr_mult_; + float decay_mult_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class LayerParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.LayerParameter) */ { + public: + inline LayerParameter() : LayerParameter(nullptr) {}; + virtual ~LayerParameter(); + + LayerParameter(const LayerParameter& from); + LayerParameter(LayerParameter&& from) noexcept + : LayerParameter() { + *this = ::std::move(from); + } + + inline LayerParameter& operator=(const LayerParameter& from) { + CopyFrom(from); + return *this; + } + inline LayerParameter& operator=(LayerParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const LayerParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const LayerParameter* internal_default_instance() { + return reinterpret_cast( + &_LayerParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 11; + + friend void swap(LayerParameter& a, LayerParameter& b) { + a.Swap(&b); + } + inline void Swap(LayerParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LayerParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline LayerParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + LayerParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const LayerParameter& from); + void MergeFrom(const LayerParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LayerParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.LayerParameter"; + } + protected: + explicit LayerParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBottomFieldNumber = 3, + kTopFieldNumber = 4, + kLossWeightFieldNumber = 5, + kParamFieldNumber = 6, + kBlobsFieldNumber = 7, + kIncludeFieldNumber = 8, + kExcludeFieldNumber = 9, + kPropagateDownFieldNumber = 11, + kNameFieldNumber = 1, + kTypeFieldNumber = 2, + kTransformParamFieldNumber = 100, + kLossParamFieldNumber = 101, + kAccuracyParamFieldNumber = 102, + kArgmaxParamFieldNumber = 103, + kConcatParamFieldNumber = 104, + kContrastiveLossParamFieldNumber = 105, + kConvolutionParamFieldNumber = 106, + kDataParamFieldNumber = 107, + kDropoutParamFieldNumber = 108, + kDummyDataParamFieldNumber = 109, + kEltwiseParamFieldNumber = 110, + kExpParamFieldNumber = 111, + kHdf5DataParamFieldNumber = 112, + kHdf5OutputParamFieldNumber = 113, + kHingeLossParamFieldNumber = 114, + kImageDataParamFieldNumber = 115, + kInfogainLossParamFieldNumber = 116, + kInnerProductParamFieldNumber = 117, + kLrnParamFieldNumber = 118, + kMemoryDataParamFieldNumber = 119, + kMvnParamFieldNumber = 120, + kPoolingParamFieldNumber = 121, + kPowerParamFieldNumber = 122, + kReluParamFieldNumber = 123, + kSigmoidParamFieldNumber = 124, + kSoftmaxParamFieldNumber = 125, + kSliceParamFieldNumber = 126, + kTanhParamFieldNumber = 127, + kThresholdParamFieldNumber = 128, + kWindowDataParamFieldNumber = 129, + kPythonParamFieldNumber = 130, + kPreluParamFieldNumber = 131, + kSppParamFieldNumber = 132, + kReshapeParamFieldNumber = 133, + kLogParamFieldNumber = 134, + kFlattenParamFieldNumber = 135, + kReductionParamFieldNumber = 136, + kEmbedParamFieldNumber = 137, + kTileParamFieldNumber = 138, + kBatchNormParamFieldNumber = 139, + kEluParamFieldNumber = 140, + kBiasParamFieldNumber = 141, + kScaleParamFieldNumber = 142, + kInputParamFieldNumber = 143, + kCropParamFieldNumber = 144, + kParameterParamFieldNumber = 145, + kRecurrentParamFieldNumber = 146, + kSwishParamFieldNumber = 147, + kClipParamFieldNumber = 148, + kPhaseFieldNumber = 10, + }; + // repeated string bottom = 3; + int bottom_size() const; + private: + int _internal_bottom_size() const; + public: + void clear_bottom(); + const std::string& bottom(int index) const; + std::string* mutable_bottom(int index); + void set_bottom(int index, const std::string& value); + void set_bottom(int index, std::string&& value); + void set_bottom(int index, const char* value); + void set_bottom(int index, const char* value, size_t size); + std::string* add_bottom(); + void add_bottom(const std::string& value); + void add_bottom(std::string&& value); + void add_bottom(const char* value); + void add_bottom(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& bottom() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_bottom(); + private: + const std::string& _internal_bottom(int index) const; + std::string* _internal_add_bottom(); + public: + + // repeated string top = 4; + int top_size() const; + private: + int _internal_top_size() const; + public: + void clear_top(); + const std::string& top(int index) const; + std::string* mutable_top(int index); + void set_top(int index, const std::string& value); + void set_top(int index, std::string&& value); + void set_top(int index, const char* value); + void set_top(int index, const char* value, size_t size); + std::string* add_top(); + void add_top(const std::string& value); + void add_top(std::string&& value); + void add_top(const char* value); + void add_top(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& top() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_top(); + private: + const std::string& _internal_top(int index) const; + std::string* _internal_add_top(); + public: + + // repeated float loss_weight = 5; + int loss_weight_size() const; + private: + int _internal_loss_weight_size() const; + public: + void clear_loss_weight(); + private: + float _internal_loss_weight(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_loss_weight() const; + void _internal_add_loss_weight(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_loss_weight(); + public: + float loss_weight(int index) const; + void set_loss_weight(int index, float value); + void add_loss_weight(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + loss_weight() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_loss_weight(); + + // repeated .caffe.ParamSpec param = 6; + int param_size() const; + private: + int _internal_param_size() const; + public: + void clear_param(); + ::caffe::ParamSpec* mutable_param(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::ParamSpec >* + mutable_param(); + private: + const ::caffe::ParamSpec& _internal_param(int index) const; + ::caffe::ParamSpec* _internal_add_param(); + public: + const ::caffe::ParamSpec& param(int index) const; + ::caffe::ParamSpec* add_param(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::ParamSpec >& + param() const; + + // repeated .caffe.BlobProto blobs = 7; + int blobs_size() const; + private: + int _internal_blobs_size() const; + public: + void clear_blobs(); + ::caffe::BlobProto* mutable_blobs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* + mutable_blobs(); + private: + const ::caffe::BlobProto& _internal_blobs(int index) const; + ::caffe::BlobProto* _internal_add_blobs(); + public: + const ::caffe::BlobProto& blobs(int index) const; + ::caffe::BlobProto* add_blobs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& + blobs() const; + + // repeated .caffe.NetStateRule include = 8; + int include_size() const; + private: + int _internal_include_size() const; + public: + void clear_include(); + ::caffe::NetStateRule* mutable_include(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* + mutable_include(); + private: + const ::caffe::NetStateRule& _internal_include(int index) const; + ::caffe::NetStateRule* _internal_add_include(); + public: + const ::caffe::NetStateRule& include(int index) const; + ::caffe::NetStateRule* add_include(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& + include() const; + + // repeated .caffe.NetStateRule exclude = 9; + int exclude_size() const; + private: + int _internal_exclude_size() const; + public: + void clear_exclude(); + ::caffe::NetStateRule* mutable_exclude(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* + mutable_exclude(); + private: + const ::caffe::NetStateRule& _internal_exclude(int index) const; + ::caffe::NetStateRule* _internal_add_exclude(); + public: + const ::caffe::NetStateRule& exclude(int index) const; + ::caffe::NetStateRule* add_exclude(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& + exclude() const; + + // repeated bool propagate_down = 11; + int propagate_down_size() const; + private: + int _internal_propagate_down_size() const; + public: + void clear_propagate_down(); + private: + bool _internal_propagate_down(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& + _internal_propagate_down() const; + void _internal_add_propagate_down(bool value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* + _internal_mutable_propagate_down(); + public: + bool propagate_down(int index) const; + void set_propagate_down(int index, bool value); + void add_propagate_down(bool value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& + propagate_down() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* + mutable_propagate_down(); + + // optional string name = 1; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // optional string type = 2; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // optional .caffe.TransformationParameter transform_param = 100; + bool has_transform_param() const; + private: + bool _internal_has_transform_param() const; + public: + void clear_transform_param(); + const ::caffe::TransformationParameter& transform_param() const; + ::caffe::TransformationParameter* release_transform_param(); + ::caffe::TransformationParameter* mutable_transform_param(); + void set_allocated_transform_param(::caffe::TransformationParameter* transform_param); + private: + const ::caffe::TransformationParameter& _internal_transform_param() const; + ::caffe::TransformationParameter* _internal_mutable_transform_param(); + public: + void unsafe_arena_set_allocated_transform_param( + ::caffe::TransformationParameter* transform_param); + ::caffe::TransformationParameter* unsafe_arena_release_transform_param(); + + // optional .caffe.LossParameter loss_param = 101; + bool has_loss_param() const; + private: + bool _internal_has_loss_param() const; + public: + void clear_loss_param(); + const ::caffe::LossParameter& loss_param() const; + ::caffe::LossParameter* release_loss_param(); + ::caffe::LossParameter* mutable_loss_param(); + void set_allocated_loss_param(::caffe::LossParameter* loss_param); + private: + const ::caffe::LossParameter& _internal_loss_param() const; + ::caffe::LossParameter* _internal_mutable_loss_param(); + public: + void unsafe_arena_set_allocated_loss_param( + ::caffe::LossParameter* loss_param); + ::caffe::LossParameter* unsafe_arena_release_loss_param(); + + // optional .caffe.AccuracyParameter accuracy_param = 102; + bool has_accuracy_param() const; + private: + bool _internal_has_accuracy_param() const; + public: + void clear_accuracy_param(); + const ::caffe::AccuracyParameter& accuracy_param() const; + ::caffe::AccuracyParameter* release_accuracy_param(); + ::caffe::AccuracyParameter* mutable_accuracy_param(); + void set_allocated_accuracy_param(::caffe::AccuracyParameter* accuracy_param); + private: + const ::caffe::AccuracyParameter& _internal_accuracy_param() const; + ::caffe::AccuracyParameter* _internal_mutable_accuracy_param(); + public: + void unsafe_arena_set_allocated_accuracy_param( + ::caffe::AccuracyParameter* accuracy_param); + ::caffe::AccuracyParameter* unsafe_arena_release_accuracy_param(); + + // optional .caffe.ArgMaxParameter argmax_param = 103; + bool has_argmax_param() const; + private: + bool _internal_has_argmax_param() const; + public: + void clear_argmax_param(); + const ::caffe::ArgMaxParameter& argmax_param() const; + ::caffe::ArgMaxParameter* release_argmax_param(); + ::caffe::ArgMaxParameter* mutable_argmax_param(); + void set_allocated_argmax_param(::caffe::ArgMaxParameter* argmax_param); + private: + const ::caffe::ArgMaxParameter& _internal_argmax_param() const; + ::caffe::ArgMaxParameter* _internal_mutable_argmax_param(); + public: + void unsafe_arena_set_allocated_argmax_param( + ::caffe::ArgMaxParameter* argmax_param); + ::caffe::ArgMaxParameter* unsafe_arena_release_argmax_param(); + + // optional .caffe.ConcatParameter concat_param = 104; + bool has_concat_param() const; + private: + bool _internal_has_concat_param() const; + public: + void clear_concat_param(); + const ::caffe::ConcatParameter& concat_param() const; + ::caffe::ConcatParameter* release_concat_param(); + ::caffe::ConcatParameter* mutable_concat_param(); + void set_allocated_concat_param(::caffe::ConcatParameter* concat_param); + private: + const ::caffe::ConcatParameter& _internal_concat_param() const; + ::caffe::ConcatParameter* _internal_mutable_concat_param(); + public: + void unsafe_arena_set_allocated_concat_param( + ::caffe::ConcatParameter* concat_param); + ::caffe::ConcatParameter* unsafe_arena_release_concat_param(); + + // optional .caffe.ContrastiveLossParameter contrastive_loss_param = 105; + bool has_contrastive_loss_param() const; + private: + bool _internal_has_contrastive_loss_param() const; + public: + void clear_contrastive_loss_param(); + const ::caffe::ContrastiveLossParameter& contrastive_loss_param() const; + ::caffe::ContrastiveLossParameter* release_contrastive_loss_param(); + ::caffe::ContrastiveLossParameter* mutable_contrastive_loss_param(); + void set_allocated_contrastive_loss_param(::caffe::ContrastiveLossParameter* contrastive_loss_param); + private: + const ::caffe::ContrastiveLossParameter& _internal_contrastive_loss_param() const; + ::caffe::ContrastiveLossParameter* _internal_mutable_contrastive_loss_param(); + public: + void unsafe_arena_set_allocated_contrastive_loss_param( + ::caffe::ContrastiveLossParameter* contrastive_loss_param); + ::caffe::ContrastiveLossParameter* unsafe_arena_release_contrastive_loss_param(); + + // optional .caffe.ConvolutionParameter convolution_param = 106; + bool has_convolution_param() const; + private: + bool _internal_has_convolution_param() const; + public: + void clear_convolution_param(); + const ::caffe::ConvolutionParameter& convolution_param() const; + ::caffe::ConvolutionParameter* release_convolution_param(); + ::caffe::ConvolutionParameter* mutable_convolution_param(); + void set_allocated_convolution_param(::caffe::ConvolutionParameter* convolution_param); + private: + const ::caffe::ConvolutionParameter& _internal_convolution_param() const; + ::caffe::ConvolutionParameter* _internal_mutable_convolution_param(); + public: + void unsafe_arena_set_allocated_convolution_param( + ::caffe::ConvolutionParameter* convolution_param); + ::caffe::ConvolutionParameter* unsafe_arena_release_convolution_param(); + + // optional .caffe.DataParameter data_param = 107; + bool has_data_param() const; + private: + bool _internal_has_data_param() const; + public: + void clear_data_param(); + const ::caffe::DataParameter& data_param() const; + ::caffe::DataParameter* release_data_param(); + ::caffe::DataParameter* mutable_data_param(); + void set_allocated_data_param(::caffe::DataParameter* data_param); + private: + const ::caffe::DataParameter& _internal_data_param() const; + ::caffe::DataParameter* _internal_mutable_data_param(); + public: + void unsafe_arena_set_allocated_data_param( + ::caffe::DataParameter* data_param); + ::caffe::DataParameter* unsafe_arena_release_data_param(); + + // optional .caffe.DropoutParameter dropout_param = 108; + bool has_dropout_param() const; + private: + bool _internal_has_dropout_param() const; + public: + void clear_dropout_param(); + const ::caffe::DropoutParameter& dropout_param() const; + ::caffe::DropoutParameter* release_dropout_param(); + ::caffe::DropoutParameter* mutable_dropout_param(); + void set_allocated_dropout_param(::caffe::DropoutParameter* dropout_param); + private: + const ::caffe::DropoutParameter& _internal_dropout_param() const; + ::caffe::DropoutParameter* _internal_mutable_dropout_param(); + public: + void unsafe_arena_set_allocated_dropout_param( + ::caffe::DropoutParameter* dropout_param); + ::caffe::DropoutParameter* unsafe_arena_release_dropout_param(); + + // optional .caffe.DummyDataParameter dummy_data_param = 109; + bool has_dummy_data_param() const; + private: + bool _internal_has_dummy_data_param() const; + public: + void clear_dummy_data_param(); + const ::caffe::DummyDataParameter& dummy_data_param() const; + ::caffe::DummyDataParameter* release_dummy_data_param(); + ::caffe::DummyDataParameter* mutable_dummy_data_param(); + void set_allocated_dummy_data_param(::caffe::DummyDataParameter* dummy_data_param); + private: + const ::caffe::DummyDataParameter& _internal_dummy_data_param() const; + ::caffe::DummyDataParameter* _internal_mutable_dummy_data_param(); + public: + void unsafe_arena_set_allocated_dummy_data_param( + ::caffe::DummyDataParameter* dummy_data_param); + ::caffe::DummyDataParameter* unsafe_arena_release_dummy_data_param(); + + // optional .caffe.EltwiseParameter eltwise_param = 110; + bool has_eltwise_param() const; + private: + bool _internal_has_eltwise_param() const; + public: + void clear_eltwise_param(); + const ::caffe::EltwiseParameter& eltwise_param() const; + ::caffe::EltwiseParameter* release_eltwise_param(); + ::caffe::EltwiseParameter* mutable_eltwise_param(); + void set_allocated_eltwise_param(::caffe::EltwiseParameter* eltwise_param); + private: + const ::caffe::EltwiseParameter& _internal_eltwise_param() const; + ::caffe::EltwiseParameter* _internal_mutable_eltwise_param(); + public: + void unsafe_arena_set_allocated_eltwise_param( + ::caffe::EltwiseParameter* eltwise_param); + ::caffe::EltwiseParameter* unsafe_arena_release_eltwise_param(); + + // optional .caffe.ExpParameter exp_param = 111; + bool has_exp_param() const; + private: + bool _internal_has_exp_param() const; + public: + void clear_exp_param(); + const ::caffe::ExpParameter& exp_param() const; + ::caffe::ExpParameter* release_exp_param(); + ::caffe::ExpParameter* mutable_exp_param(); + void set_allocated_exp_param(::caffe::ExpParameter* exp_param); + private: + const ::caffe::ExpParameter& _internal_exp_param() const; + ::caffe::ExpParameter* _internal_mutable_exp_param(); + public: + void unsafe_arena_set_allocated_exp_param( + ::caffe::ExpParameter* exp_param); + ::caffe::ExpParameter* unsafe_arena_release_exp_param(); + + // optional .caffe.HDF5DataParameter hdf5_data_param = 112; + bool has_hdf5_data_param() const; + private: + bool _internal_has_hdf5_data_param() const; + public: + void clear_hdf5_data_param(); + const ::caffe::HDF5DataParameter& hdf5_data_param() const; + ::caffe::HDF5DataParameter* release_hdf5_data_param(); + ::caffe::HDF5DataParameter* mutable_hdf5_data_param(); + void set_allocated_hdf5_data_param(::caffe::HDF5DataParameter* hdf5_data_param); + private: + const ::caffe::HDF5DataParameter& _internal_hdf5_data_param() const; + ::caffe::HDF5DataParameter* _internal_mutable_hdf5_data_param(); + public: + void unsafe_arena_set_allocated_hdf5_data_param( + ::caffe::HDF5DataParameter* hdf5_data_param); + ::caffe::HDF5DataParameter* unsafe_arena_release_hdf5_data_param(); + + // optional .caffe.HDF5OutputParameter hdf5_output_param = 113; + bool has_hdf5_output_param() const; + private: + bool _internal_has_hdf5_output_param() const; + public: + void clear_hdf5_output_param(); + const ::caffe::HDF5OutputParameter& hdf5_output_param() const; + ::caffe::HDF5OutputParameter* release_hdf5_output_param(); + ::caffe::HDF5OutputParameter* mutable_hdf5_output_param(); + void set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param); + private: + const ::caffe::HDF5OutputParameter& _internal_hdf5_output_param() const; + ::caffe::HDF5OutputParameter* _internal_mutable_hdf5_output_param(); + public: + void unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param); + ::caffe::HDF5OutputParameter* unsafe_arena_release_hdf5_output_param(); + + // optional .caffe.HingeLossParameter hinge_loss_param = 114; + bool has_hinge_loss_param() const; + private: + bool _internal_has_hinge_loss_param() const; + public: + void clear_hinge_loss_param(); + const ::caffe::HingeLossParameter& hinge_loss_param() const; + ::caffe::HingeLossParameter* release_hinge_loss_param(); + ::caffe::HingeLossParameter* mutable_hinge_loss_param(); + void set_allocated_hinge_loss_param(::caffe::HingeLossParameter* hinge_loss_param); + private: + const ::caffe::HingeLossParameter& _internal_hinge_loss_param() const; + ::caffe::HingeLossParameter* _internal_mutable_hinge_loss_param(); + public: + void unsafe_arena_set_allocated_hinge_loss_param( + ::caffe::HingeLossParameter* hinge_loss_param); + ::caffe::HingeLossParameter* unsafe_arena_release_hinge_loss_param(); + + // optional .caffe.ImageDataParameter image_data_param = 115; + bool has_image_data_param() const; + private: + bool _internal_has_image_data_param() const; + public: + void clear_image_data_param(); + const ::caffe::ImageDataParameter& image_data_param() const; + ::caffe::ImageDataParameter* release_image_data_param(); + ::caffe::ImageDataParameter* mutable_image_data_param(); + void set_allocated_image_data_param(::caffe::ImageDataParameter* image_data_param); + private: + const ::caffe::ImageDataParameter& _internal_image_data_param() const; + ::caffe::ImageDataParameter* _internal_mutable_image_data_param(); + public: + void unsafe_arena_set_allocated_image_data_param( + ::caffe::ImageDataParameter* image_data_param); + ::caffe::ImageDataParameter* unsafe_arena_release_image_data_param(); + + // optional .caffe.InfogainLossParameter infogain_loss_param = 116; + bool has_infogain_loss_param() const; + private: + bool _internal_has_infogain_loss_param() const; + public: + void clear_infogain_loss_param(); + const ::caffe::InfogainLossParameter& infogain_loss_param() const; + ::caffe::InfogainLossParameter* release_infogain_loss_param(); + ::caffe::InfogainLossParameter* mutable_infogain_loss_param(); + void set_allocated_infogain_loss_param(::caffe::InfogainLossParameter* infogain_loss_param); + private: + const ::caffe::InfogainLossParameter& _internal_infogain_loss_param() const; + ::caffe::InfogainLossParameter* _internal_mutable_infogain_loss_param(); + public: + void unsafe_arena_set_allocated_infogain_loss_param( + ::caffe::InfogainLossParameter* infogain_loss_param); + ::caffe::InfogainLossParameter* unsafe_arena_release_infogain_loss_param(); + + // optional .caffe.InnerProductParameter inner_product_param = 117; + bool has_inner_product_param() const; + private: + bool _internal_has_inner_product_param() const; + public: + void clear_inner_product_param(); + const ::caffe::InnerProductParameter& inner_product_param() const; + ::caffe::InnerProductParameter* release_inner_product_param(); + ::caffe::InnerProductParameter* mutable_inner_product_param(); + void set_allocated_inner_product_param(::caffe::InnerProductParameter* inner_product_param); + private: + const ::caffe::InnerProductParameter& _internal_inner_product_param() const; + ::caffe::InnerProductParameter* _internal_mutable_inner_product_param(); + public: + void unsafe_arena_set_allocated_inner_product_param( + ::caffe::InnerProductParameter* inner_product_param); + ::caffe::InnerProductParameter* unsafe_arena_release_inner_product_param(); + + // optional .caffe.LRNParameter lrn_param = 118; + bool has_lrn_param() const; + private: + bool _internal_has_lrn_param() const; + public: + void clear_lrn_param(); + const ::caffe::LRNParameter& lrn_param() const; + ::caffe::LRNParameter* release_lrn_param(); + ::caffe::LRNParameter* mutable_lrn_param(); + void set_allocated_lrn_param(::caffe::LRNParameter* lrn_param); + private: + const ::caffe::LRNParameter& _internal_lrn_param() const; + ::caffe::LRNParameter* _internal_mutable_lrn_param(); + public: + void unsafe_arena_set_allocated_lrn_param( + ::caffe::LRNParameter* lrn_param); + ::caffe::LRNParameter* unsafe_arena_release_lrn_param(); + + // optional .caffe.MemoryDataParameter memory_data_param = 119; + bool has_memory_data_param() const; + private: + bool _internal_has_memory_data_param() const; + public: + void clear_memory_data_param(); + const ::caffe::MemoryDataParameter& memory_data_param() const; + ::caffe::MemoryDataParameter* release_memory_data_param(); + ::caffe::MemoryDataParameter* mutable_memory_data_param(); + void set_allocated_memory_data_param(::caffe::MemoryDataParameter* memory_data_param); + private: + const ::caffe::MemoryDataParameter& _internal_memory_data_param() const; + ::caffe::MemoryDataParameter* _internal_mutable_memory_data_param(); + public: + void unsafe_arena_set_allocated_memory_data_param( + ::caffe::MemoryDataParameter* memory_data_param); + ::caffe::MemoryDataParameter* unsafe_arena_release_memory_data_param(); + + // optional .caffe.MVNParameter mvn_param = 120; + bool has_mvn_param() const; + private: + bool _internal_has_mvn_param() const; + public: + void clear_mvn_param(); + const ::caffe::MVNParameter& mvn_param() const; + ::caffe::MVNParameter* release_mvn_param(); + ::caffe::MVNParameter* mutable_mvn_param(); + void set_allocated_mvn_param(::caffe::MVNParameter* mvn_param); + private: + const ::caffe::MVNParameter& _internal_mvn_param() const; + ::caffe::MVNParameter* _internal_mutable_mvn_param(); + public: + void unsafe_arena_set_allocated_mvn_param( + ::caffe::MVNParameter* mvn_param); + ::caffe::MVNParameter* unsafe_arena_release_mvn_param(); + + // optional .caffe.PoolingParameter pooling_param = 121; + bool has_pooling_param() const; + private: + bool _internal_has_pooling_param() const; + public: + void clear_pooling_param(); + const ::caffe::PoolingParameter& pooling_param() const; + ::caffe::PoolingParameter* release_pooling_param(); + ::caffe::PoolingParameter* mutable_pooling_param(); + void set_allocated_pooling_param(::caffe::PoolingParameter* pooling_param); + private: + const ::caffe::PoolingParameter& _internal_pooling_param() const; + ::caffe::PoolingParameter* _internal_mutable_pooling_param(); + public: + void unsafe_arena_set_allocated_pooling_param( + ::caffe::PoolingParameter* pooling_param); + ::caffe::PoolingParameter* unsafe_arena_release_pooling_param(); + + // optional .caffe.PowerParameter power_param = 122; + bool has_power_param() const; + private: + bool _internal_has_power_param() const; + public: + void clear_power_param(); + const ::caffe::PowerParameter& power_param() const; + ::caffe::PowerParameter* release_power_param(); + ::caffe::PowerParameter* mutable_power_param(); + void set_allocated_power_param(::caffe::PowerParameter* power_param); + private: + const ::caffe::PowerParameter& _internal_power_param() const; + ::caffe::PowerParameter* _internal_mutable_power_param(); + public: + void unsafe_arena_set_allocated_power_param( + ::caffe::PowerParameter* power_param); + ::caffe::PowerParameter* unsafe_arena_release_power_param(); + + // optional .caffe.ReLUParameter relu_param = 123; + bool has_relu_param() const; + private: + bool _internal_has_relu_param() const; + public: + void clear_relu_param(); + const ::caffe::ReLUParameter& relu_param() const; + ::caffe::ReLUParameter* release_relu_param(); + ::caffe::ReLUParameter* mutable_relu_param(); + void set_allocated_relu_param(::caffe::ReLUParameter* relu_param); + private: + const ::caffe::ReLUParameter& _internal_relu_param() const; + ::caffe::ReLUParameter* _internal_mutable_relu_param(); + public: + void unsafe_arena_set_allocated_relu_param( + ::caffe::ReLUParameter* relu_param); + ::caffe::ReLUParameter* unsafe_arena_release_relu_param(); + + // optional .caffe.SigmoidParameter sigmoid_param = 124; + bool has_sigmoid_param() const; + private: + bool _internal_has_sigmoid_param() const; + public: + void clear_sigmoid_param(); + const ::caffe::SigmoidParameter& sigmoid_param() const; + ::caffe::SigmoidParameter* release_sigmoid_param(); + ::caffe::SigmoidParameter* mutable_sigmoid_param(); + void set_allocated_sigmoid_param(::caffe::SigmoidParameter* sigmoid_param); + private: + const ::caffe::SigmoidParameter& _internal_sigmoid_param() const; + ::caffe::SigmoidParameter* _internal_mutable_sigmoid_param(); + public: + void unsafe_arena_set_allocated_sigmoid_param( + ::caffe::SigmoidParameter* sigmoid_param); + ::caffe::SigmoidParameter* unsafe_arena_release_sigmoid_param(); + + // optional .caffe.SoftmaxParameter softmax_param = 125; + bool has_softmax_param() const; + private: + bool _internal_has_softmax_param() const; + public: + void clear_softmax_param(); + const ::caffe::SoftmaxParameter& softmax_param() const; + ::caffe::SoftmaxParameter* release_softmax_param(); + ::caffe::SoftmaxParameter* mutable_softmax_param(); + void set_allocated_softmax_param(::caffe::SoftmaxParameter* softmax_param); + private: + const ::caffe::SoftmaxParameter& _internal_softmax_param() const; + ::caffe::SoftmaxParameter* _internal_mutable_softmax_param(); + public: + void unsafe_arena_set_allocated_softmax_param( + ::caffe::SoftmaxParameter* softmax_param); + ::caffe::SoftmaxParameter* unsafe_arena_release_softmax_param(); + + // optional .caffe.SliceParameter slice_param = 126; + bool has_slice_param() const; + private: + bool _internal_has_slice_param() const; + public: + void clear_slice_param(); + const ::caffe::SliceParameter& slice_param() const; + ::caffe::SliceParameter* release_slice_param(); + ::caffe::SliceParameter* mutable_slice_param(); + void set_allocated_slice_param(::caffe::SliceParameter* slice_param); + private: + const ::caffe::SliceParameter& _internal_slice_param() const; + ::caffe::SliceParameter* _internal_mutable_slice_param(); + public: + void unsafe_arena_set_allocated_slice_param( + ::caffe::SliceParameter* slice_param); + ::caffe::SliceParameter* unsafe_arena_release_slice_param(); + + // optional .caffe.TanHParameter tanh_param = 127; + bool has_tanh_param() const; + private: + bool _internal_has_tanh_param() const; + public: + void clear_tanh_param(); + const ::caffe::TanHParameter& tanh_param() const; + ::caffe::TanHParameter* release_tanh_param(); + ::caffe::TanHParameter* mutable_tanh_param(); + void set_allocated_tanh_param(::caffe::TanHParameter* tanh_param); + private: + const ::caffe::TanHParameter& _internal_tanh_param() const; + ::caffe::TanHParameter* _internal_mutable_tanh_param(); + public: + void unsafe_arena_set_allocated_tanh_param( + ::caffe::TanHParameter* tanh_param); + ::caffe::TanHParameter* unsafe_arena_release_tanh_param(); + + // optional .caffe.ThresholdParameter threshold_param = 128; + bool has_threshold_param() const; + private: + bool _internal_has_threshold_param() const; + public: + void clear_threshold_param(); + const ::caffe::ThresholdParameter& threshold_param() const; + ::caffe::ThresholdParameter* release_threshold_param(); + ::caffe::ThresholdParameter* mutable_threshold_param(); + void set_allocated_threshold_param(::caffe::ThresholdParameter* threshold_param); + private: + const ::caffe::ThresholdParameter& _internal_threshold_param() const; + ::caffe::ThresholdParameter* _internal_mutable_threshold_param(); + public: + void unsafe_arena_set_allocated_threshold_param( + ::caffe::ThresholdParameter* threshold_param); + ::caffe::ThresholdParameter* unsafe_arena_release_threshold_param(); + + // optional .caffe.WindowDataParameter window_data_param = 129; + bool has_window_data_param() const; + private: + bool _internal_has_window_data_param() const; + public: + void clear_window_data_param(); + const ::caffe::WindowDataParameter& window_data_param() const; + ::caffe::WindowDataParameter* release_window_data_param(); + ::caffe::WindowDataParameter* mutable_window_data_param(); + void set_allocated_window_data_param(::caffe::WindowDataParameter* window_data_param); + private: + const ::caffe::WindowDataParameter& _internal_window_data_param() const; + ::caffe::WindowDataParameter* _internal_mutable_window_data_param(); + public: + void unsafe_arena_set_allocated_window_data_param( + ::caffe::WindowDataParameter* window_data_param); + ::caffe::WindowDataParameter* unsafe_arena_release_window_data_param(); + + // optional .caffe.PythonParameter python_param = 130; + bool has_python_param() const; + private: + bool _internal_has_python_param() const; + public: + void clear_python_param(); + const ::caffe::PythonParameter& python_param() const; + ::caffe::PythonParameter* release_python_param(); + ::caffe::PythonParameter* mutable_python_param(); + void set_allocated_python_param(::caffe::PythonParameter* python_param); + private: + const ::caffe::PythonParameter& _internal_python_param() const; + ::caffe::PythonParameter* _internal_mutable_python_param(); + public: + void unsafe_arena_set_allocated_python_param( + ::caffe::PythonParameter* python_param); + ::caffe::PythonParameter* unsafe_arena_release_python_param(); + + // optional .caffe.PReLUParameter prelu_param = 131; + bool has_prelu_param() const; + private: + bool _internal_has_prelu_param() const; + public: + void clear_prelu_param(); + const ::caffe::PReLUParameter& prelu_param() const; + ::caffe::PReLUParameter* release_prelu_param(); + ::caffe::PReLUParameter* mutable_prelu_param(); + void set_allocated_prelu_param(::caffe::PReLUParameter* prelu_param); + private: + const ::caffe::PReLUParameter& _internal_prelu_param() const; + ::caffe::PReLUParameter* _internal_mutable_prelu_param(); + public: + void unsafe_arena_set_allocated_prelu_param( + ::caffe::PReLUParameter* prelu_param); + ::caffe::PReLUParameter* unsafe_arena_release_prelu_param(); + + // optional .caffe.SPPParameter spp_param = 132; + bool has_spp_param() const; + private: + bool _internal_has_spp_param() const; + public: + void clear_spp_param(); + const ::caffe::SPPParameter& spp_param() const; + ::caffe::SPPParameter* release_spp_param(); + ::caffe::SPPParameter* mutable_spp_param(); + void set_allocated_spp_param(::caffe::SPPParameter* spp_param); + private: + const ::caffe::SPPParameter& _internal_spp_param() const; + ::caffe::SPPParameter* _internal_mutable_spp_param(); + public: + void unsafe_arena_set_allocated_spp_param( + ::caffe::SPPParameter* spp_param); + ::caffe::SPPParameter* unsafe_arena_release_spp_param(); + + // optional .caffe.ReshapeParameter reshape_param = 133; + bool has_reshape_param() const; + private: + bool _internal_has_reshape_param() const; + public: + void clear_reshape_param(); + const ::caffe::ReshapeParameter& reshape_param() const; + ::caffe::ReshapeParameter* release_reshape_param(); + ::caffe::ReshapeParameter* mutable_reshape_param(); + void set_allocated_reshape_param(::caffe::ReshapeParameter* reshape_param); + private: + const ::caffe::ReshapeParameter& _internal_reshape_param() const; + ::caffe::ReshapeParameter* _internal_mutable_reshape_param(); + public: + void unsafe_arena_set_allocated_reshape_param( + ::caffe::ReshapeParameter* reshape_param); + ::caffe::ReshapeParameter* unsafe_arena_release_reshape_param(); + + // optional .caffe.LogParameter log_param = 134; + bool has_log_param() const; + private: + bool _internal_has_log_param() const; + public: + void clear_log_param(); + const ::caffe::LogParameter& log_param() const; + ::caffe::LogParameter* release_log_param(); + ::caffe::LogParameter* mutable_log_param(); + void set_allocated_log_param(::caffe::LogParameter* log_param); + private: + const ::caffe::LogParameter& _internal_log_param() const; + ::caffe::LogParameter* _internal_mutable_log_param(); + public: + void unsafe_arena_set_allocated_log_param( + ::caffe::LogParameter* log_param); + ::caffe::LogParameter* unsafe_arena_release_log_param(); + + // optional .caffe.FlattenParameter flatten_param = 135; + bool has_flatten_param() const; + private: + bool _internal_has_flatten_param() const; + public: + void clear_flatten_param(); + const ::caffe::FlattenParameter& flatten_param() const; + ::caffe::FlattenParameter* release_flatten_param(); + ::caffe::FlattenParameter* mutable_flatten_param(); + void set_allocated_flatten_param(::caffe::FlattenParameter* flatten_param); + private: + const ::caffe::FlattenParameter& _internal_flatten_param() const; + ::caffe::FlattenParameter* _internal_mutable_flatten_param(); + public: + void unsafe_arena_set_allocated_flatten_param( + ::caffe::FlattenParameter* flatten_param); + ::caffe::FlattenParameter* unsafe_arena_release_flatten_param(); + + // optional .caffe.ReductionParameter reduction_param = 136; + bool has_reduction_param() const; + private: + bool _internal_has_reduction_param() const; + public: + void clear_reduction_param(); + const ::caffe::ReductionParameter& reduction_param() const; + ::caffe::ReductionParameter* release_reduction_param(); + ::caffe::ReductionParameter* mutable_reduction_param(); + void set_allocated_reduction_param(::caffe::ReductionParameter* reduction_param); + private: + const ::caffe::ReductionParameter& _internal_reduction_param() const; + ::caffe::ReductionParameter* _internal_mutable_reduction_param(); + public: + void unsafe_arena_set_allocated_reduction_param( + ::caffe::ReductionParameter* reduction_param); + ::caffe::ReductionParameter* unsafe_arena_release_reduction_param(); + + // optional .caffe.EmbedParameter embed_param = 137; + bool has_embed_param() const; + private: + bool _internal_has_embed_param() const; + public: + void clear_embed_param(); + const ::caffe::EmbedParameter& embed_param() const; + ::caffe::EmbedParameter* release_embed_param(); + ::caffe::EmbedParameter* mutable_embed_param(); + void set_allocated_embed_param(::caffe::EmbedParameter* embed_param); + private: + const ::caffe::EmbedParameter& _internal_embed_param() const; + ::caffe::EmbedParameter* _internal_mutable_embed_param(); + public: + void unsafe_arena_set_allocated_embed_param( + ::caffe::EmbedParameter* embed_param); + ::caffe::EmbedParameter* unsafe_arena_release_embed_param(); + + // optional .caffe.TileParameter tile_param = 138; + bool has_tile_param() const; + private: + bool _internal_has_tile_param() const; + public: + void clear_tile_param(); + const ::caffe::TileParameter& tile_param() const; + ::caffe::TileParameter* release_tile_param(); + ::caffe::TileParameter* mutable_tile_param(); + void set_allocated_tile_param(::caffe::TileParameter* tile_param); + private: + const ::caffe::TileParameter& _internal_tile_param() const; + ::caffe::TileParameter* _internal_mutable_tile_param(); + public: + void unsafe_arena_set_allocated_tile_param( + ::caffe::TileParameter* tile_param); + ::caffe::TileParameter* unsafe_arena_release_tile_param(); + + // optional .caffe.BatchNormParameter batch_norm_param = 139; + bool has_batch_norm_param() const; + private: + bool _internal_has_batch_norm_param() const; + public: + void clear_batch_norm_param(); + const ::caffe::BatchNormParameter& batch_norm_param() const; + ::caffe::BatchNormParameter* release_batch_norm_param(); + ::caffe::BatchNormParameter* mutable_batch_norm_param(); + void set_allocated_batch_norm_param(::caffe::BatchNormParameter* batch_norm_param); + private: + const ::caffe::BatchNormParameter& _internal_batch_norm_param() const; + ::caffe::BatchNormParameter* _internal_mutable_batch_norm_param(); + public: + void unsafe_arena_set_allocated_batch_norm_param( + ::caffe::BatchNormParameter* batch_norm_param); + ::caffe::BatchNormParameter* unsafe_arena_release_batch_norm_param(); + + // optional .caffe.ELUParameter elu_param = 140; + bool has_elu_param() const; + private: + bool _internal_has_elu_param() const; + public: + void clear_elu_param(); + const ::caffe::ELUParameter& elu_param() const; + ::caffe::ELUParameter* release_elu_param(); + ::caffe::ELUParameter* mutable_elu_param(); + void set_allocated_elu_param(::caffe::ELUParameter* elu_param); + private: + const ::caffe::ELUParameter& _internal_elu_param() const; + ::caffe::ELUParameter* _internal_mutable_elu_param(); + public: + void unsafe_arena_set_allocated_elu_param( + ::caffe::ELUParameter* elu_param); + ::caffe::ELUParameter* unsafe_arena_release_elu_param(); + + // optional .caffe.BiasParameter bias_param = 141; + bool has_bias_param() const; + private: + bool _internal_has_bias_param() const; + public: + void clear_bias_param(); + const ::caffe::BiasParameter& bias_param() const; + ::caffe::BiasParameter* release_bias_param(); + ::caffe::BiasParameter* mutable_bias_param(); + void set_allocated_bias_param(::caffe::BiasParameter* bias_param); + private: + const ::caffe::BiasParameter& _internal_bias_param() const; + ::caffe::BiasParameter* _internal_mutable_bias_param(); + public: + void unsafe_arena_set_allocated_bias_param( + ::caffe::BiasParameter* bias_param); + ::caffe::BiasParameter* unsafe_arena_release_bias_param(); + + // optional .caffe.ScaleParameter scale_param = 142; + bool has_scale_param() const; + private: + bool _internal_has_scale_param() const; + public: + void clear_scale_param(); + const ::caffe::ScaleParameter& scale_param() const; + ::caffe::ScaleParameter* release_scale_param(); + ::caffe::ScaleParameter* mutable_scale_param(); + void set_allocated_scale_param(::caffe::ScaleParameter* scale_param); + private: + const ::caffe::ScaleParameter& _internal_scale_param() const; + ::caffe::ScaleParameter* _internal_mutable_scale_param(); + public: + void unsafe_arena_set_allocated_scale_param( + ::caffe::ScaleParameter* scale_param); + ::caffe::ScaleParameter* unsafe_arena_release_scale_param(); + + // optional .caffe.InputParameter input_param = 143; + bool has_input_param() const; + private: + bool _internal_has_input_param() const; + public: + void clear_input_param(); + const ::caffe::InputParameter& input_param() const; + ::caffe::InputParameter* release_input_param(); + ::caffe::InputParameter* mutable_input_param(); + void set_allocated_input_param(::caffe::InputParameter* input_param); + private: + const ::caffe::InputParameter& _internal_input_param() const; + ::caffe::InputParameter* _internal_mutable_input_param(); + public: + void unsafe_arena_set_allocated_input_param( + ::caffe::InputParameter* input_param); + ::caffe::InputParameter* unsafe_arena_release_input_param(); + + // optional .caffe.CropParameter crop_param = 144; + bool has_crop_param() const; + private: + bool _internal_has_crop_param() const; + public: + void clear_crop_param(); + const ::caffe::CropParameter& crop_param() const; + ::caffe::CropParameter* release_crop_param(); + ::caffe::CropParameter* mutable_crop_param(); + void set_allocated_crop_param(::caffe::CropParameter* crop_param); + private: + const ::caffe::CropParameter& _internal_crop_param() const; + ::caffe::CropParameter* _internal_mutable_crop_param(); + public: + void unsafe_arena_set_allocated_crop_param( + ::caffe::CropParameter* crop_param); + ::caffe::CropParameter* unsafe_arena_release_crop_param(); + + // optional .caffe.ParameterParameter parameter_param = 145; + bool has_parameter_param() const; + private: + bool _internal_has_parameter_param() const; + public: + void clear_parameter_param(); + const ::caffe::ParameterParameter& parameter_param() const; + ::caffe::ParameterParameter* release_parameter_param(); + ::caffe::ParameterParameter* mutable_parameter_param(); + void set_allocated_parameter_param(::caffe::ParameterParameter* parameter_param); + private: + const ::caffe::ParameterParameter& _internal_parameter_param() const; + ::caffe::ParameterParameter* _internal_mutable_parameter_param(); + public: + void unsafe_arena_set_allocated_parameter_param( + ::caffe::ParameterParameter* parameter_param); + ::caffe::ParameterParameter* unsafe_arena_release_parameter_param(); + + // optional .caffe.RecurrentParameter recurrent_param = 146; + bool has_recurrent_param() const; + private: + bool _internal_has_recurrent_param() const; + public: + void clear_recurrent_param(); + const ::caffe::RecurrentParameter& recurrent_param() const; + ::caffe::RecurrentParameter* release_recurrent_param(); + ::caffe::RecurrentParameter* mutable_recurrent_param(); + void set_allocated_recurrent_param(::caffe::RecurrentParameter* recurrent_param); + private: + const ::caffe::RecurrentParameter& _internal_recurrent_param() const; + ::caffe::RecurrentParameter* _internal_mutable_recurrent_param(); + public: + void unsafe_arena_set_allocated_recurrent_param( + ::caffe::RecurrentParameter* recurrent_param); + ::caffe::RecurrentParameter* unsafe_arena_release_recurrent_param(); + + // optional .caffe.SwishParameter swish_param = 147; + bool has_swish_param() const; + private: + bool _internal_has_swish_param() const; + public: + void clear_swish_param(); + const ::caffe::SwishParameter& swish_param() const; + ::caffe::SwishParameter* release_swish_param(); + ::caffe::SwishParameter* mutable_swish_param(); + void set_allocated_swish_param(::caffe::SwishParameter* swish_param); + private: + const ::caffe::SwishParameter& _internal_swish_param() const; + ::caffe::SwishParameter* _internal_mutable_swish_param(); + public: + void unsafe_arena_set_allocated_swish_param( + ::caffe::SwishParameter* swish_param); + ::caffe::SwishParameter* unsafe_arena_release_swish_param(); + + // optional .caffe.ClipParameter clip_param = 148; + bool has_clip_param() const; + private: + bool _internal_has_clip_param() const; + public: + void clear_clip_param(); + const ::caffe::ClipParameter& clip_param() const; + ::caffe::ClipParameter* release_clip_param(); + ::caffe::ClipParameter* mutable_clip_param(); + void set_allocated_clip_param(::caffe::ClipParameter* clip_param); + private: + const ::caffe::ClipParameter& _internal_clip_param() const; + ::caffe::ClipParameter* _internal_mutable_clip_param(); + public: + void unsafe_arena_set_allocated_clip_param( + ::caffe::ClipParameter* clip_param); + ::caffe::ClipParameter* unsafe_arena_release_clip_param(); + + // optional .caffe.Phase phase = 10; + bool has_phase() const; + private: + bool _internal_has_phase() const; + public: + void clear_phase(); + ::caffe::Phase phase() const; + void set_phase(::caffe::Phase value); + private: + ::caffe::Phase _internal_phase() const; + void _internal_set_phase(::caffe::Phase value); + public: + + // @@protoc_insertion_point(class_scope:caffe.LayerParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<2> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField bottom_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField top_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > loss_weight_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::ParamSpec > param_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto > blobs_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule > include_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule > exclude_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool > propagate_down_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + ::caffe::TransformationParameter* transform_param_; + ::caffe::LossParameter* loss_param_; + ::caffe::AccuracyParameter* accuracy_param_; + ::caffe::ArgMaxParameter* argmax_param_; + ::caffe::ConcatParameter* concat_param_; + ::caffe::ContrastiveLossParameter* contrastive_loss_param_; + ::caffe::ConvolutionParameter* convolution_param_; + ::caffe::DataParameter* data_param_; + ::caffe::DropoutParameter* dropout_param_; + ::caffe::DummyDataParameter* dummy_data_param_; + ::caffe::EltwiseParameter* eltwise_param_; + ::caffe::ExpParameter* exp_param_; + ::caffe::HDF5DataParameter* hdf5_data_param_; + ::caffe::HDF5OutputParameter* hdf5_output_param_; + ::caffe::HingeLossParameter* hinge_loss_param_; + ::caffe::ImageDataParameter* image_data_param_; + ::caffe::InfogainLossParameter* infogain_loss_param_; + ::caffe::InnerProductParameter* inner_product_param_; + ::caffe::LRNParameter* lrn_param_; + ::caffe::MemoryDataParameter* memory_data_param_; + ::caffe::MVNParameter* mvn_param_; + ::caffe::PoolingParameter* pooling_param_; + ::caffe::PowerParameter* power_param_; + ::caffe::ReLUParameter* relu_param_; + ::caffe::SigmoidParameter* sigmoid_param_; + ::caffe::SoftmaxParameter* softmax_param_; + ::caffe::SliceParameter* slice_param_; + ::caffe::TanHParameter* tanh_param_; + ::caffe::ThresholdParameter* threshold_param_; + ::caffe::WindowDataParameter* window_data_param_; + ::caffe::PythonParameter* python_param_; + ::caffe::PReLUParameter* prelu_param_; + ::caffe::SPPParameter* spp_param_; + ::caffe::ReshapeParameter* reshape_param_; + ::caffe::LogParameter* log_param_; + ::caffe::FlattenParameter* flatten_param_; + ::caffe::ReductionParameter* reduction_param_; + ::caffe::EmbedParameter* embed_param_; + ::caffe::TileParameter* tile_param_; + ::caffe::BatchNormParameter* batch_norm_param_; + ::caffe::ELUParameter* elu_param_; + ::caffe::BiasParameter* bias_param_; + ::caffe::ScaleParameter* scale_param_; + ::caffe::InputParameter* input_param_; + ::caffe::CropParameter* crop_param_; + ::caffe::ParameterParameter* parameter_param_; + ::caffe::RecurrentParameter* recurrent_param_; + ::caffe::SwishParameter* swish_param_; + ::caffe::ClipParameter* clip_param_; + int phase_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class TransformationParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.TransformationParameter) */ { + public: + inline TransformationParameter() : TransformationParameter(nullptr) {}; + virtual ~TransformationParameter(); + + TransformationParameter(const TransformationParameter& from); + TransformationParameter(TransformationParameter&& from) noexcept + : TransformationParameter() { + *this = ::std::move(from); + } + + inline TransformationParameter& operator=(const TransformationParameter& from) { + CopyFrom(from); + return *this; + } + inline TransformationParameter& operator=(TransformationParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const TransformationParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const TransformationParameter* internal_default_instance() { + return reinterpret_cast( + &_TransformationParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 12; + + friend void swap(TransformationParameter& a, TransformationParameter& b) { + a.Swap(&b); + } + inline void Swap(TransformationParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TransformationParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline TransformationParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + TransformationParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const TransformationParameter& from); + void MergeFrom(const TransformationParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TransformationParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.TransformationParameter"; + } + protected: + explicit TransformationParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMeanValueFieldNumber = 5, + kMeanFileFieldNumber = 4, + kCropSizeFieldNumber = 3, + kMirrorFieldNumber = 2, + kForceColorFieldNumber = 6, + kForceGrayFieldNumber = 7, + kScaleFieldNumber = 1, + }; + // repeated float mean_value = 5; + int mean_value_size() const; + private: + int _internal_mean_value_size() const; + public: + void clear_mean_value(); + private: + float _internal_mean_value(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_mean_value() const; + void _internal_add_mean_value(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_mean_value(); + public: + float mean_value(int index) const; + void set_mean_value(int index, float value); + void add_mean_value(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + mean_value() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_mean_value(); + + // optional string mean_file = 4; + bool has_mean_file() const; + private: + bool _internal_has_mean_file() const; + public: + void clear_mean_file(); + const std::string& mean_file() const; + void set_mean_file(const std::string& value); + void set_mean_file(std::string&& value); + void set_mean_file(const char* value); + void set_mean_file(const char* value, size_t size); + std::string* mutable_mean_file(); + std::string* release_mean_file(); + void set_allocated_mean_file(std::string* mean_file); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_mean_file(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_mean_file( + std::string* mean_file); + private: + const std::string& _internal_mean_file() const; + void _internal_set_mean_file(const std::string& value); + std::string* _internal_mutable_mean_file(); + public: + + // optional uint32 crop_size = 3 [default = 0]; + bool has_crop_size() const; + private: + bool _internal_has_crop_size() const; + public: + void clear_crop_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size() const; + void set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_crop_size() const; + void _internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool mirror = 2 [default = false]; + bool has_mirror() const; + private: + bool _internal_has_mirror() const; + public: + void clear_mirror(); + bool mirror() const; + void set_mirror(bool value); + private: + bool _internal_mirror() const; + void _internal_set_mirror(bool value); + public: + + // optional bool force_color = 6 [default = false]; + bool has_force_color() const; + private: + bool _internal_has_force_color() const; + public: + void clear_force_color(); + bool force_color() const; + void set_force_color(bool value); + private: + bool _internal_force_color() const; + void _internal_set_force_color(bool value); + public: + + // optional bool force_gray = 7 [default = false]; + bool has_force_gray() const; + private: + bool _internal_has_force_gray() const; + public: + void clear_force_gray(); + bool force_gray() const; + void set_force_gray(bool value); + private: + bool _internal_force_gray() const; + void _internal_set_force_gray(bool value); + public: + + // optional float scale = 1 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.TransformationParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > mean_value_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr mean_file_; + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size_; + bool mirror_; + bool force_color_; + bool force_gray_; + float scale_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class LossParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.LossParameter) */ { + public: + inline LossParameter() : LossParameter(nullptr) {}; + virtual ~LossParameter(); + + LossParameter(const LossParameter& from); + LossParameter(LossParameter&& from) noexcept + : LossParameter() { + *this = ::std::move(from); + } + + inline LossParameter& operator=(const LossParameter& from) { + CopyFrom(from); + return *this; + } + inline LossParameter& operator=(LossParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const LossParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const LossParameter* internal_default_instance() { + return reinterpret_cast( + &_LossParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 13; + + friend void swap(LossParameter& a, LossParameter& b) { + a.Swap(&b); + } + inline void Swap(LossParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LossParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline LossParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + LossParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const LossParameter& from); + void MergeFrom(const LossParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LossParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.LossParameter"; + } + protected: + explicit LossParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef LossParameter_NormalizationMode NormalizationMode; + static constexpr NormalizationMode FULL = + LossParameter_NormalizationMode_FULL; + static constexpr NormalizationMode VALID = + LossParameter_NormalizationMode_VALID; + static constexpr NormalizationMode BATCH_SIZE = + LossParameter_NormalizationMode_BATCH_SIZE; + static constexpr NormalizationMode NONE = + LossParameter_NormalizationMode_NONE; + static inline bool NormalizationMode_IsValid(int value) { + return LossParameter_NormalizationMode_IsValid(value); + } + static constexpr NormalizationMode NormalizationMode_MIN = + LossParameter_NormalizationMode_NormalizationMode_MIN; + static constexpr NormalizationMode NormalizationMode_MAX = + LossParameter_NormalizationMode_NormalizationMode_MAX; + static constexpr int NormalizationMode_ARRAYSIZE = + LossParameter_NormalizationMode_NormalizationMode_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + NormalizationMode_descriptor() { + return LossParameter_NormalizationMode_descriptor(); + } + template + static inline const std::string& NormalizationMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function NormalizationMode_Name."); + return LossParameter_NormalizationMode_Name(enum_t_value); + } + static inline bool NormalizationMode_Parse(const std::string& name, + NormalizationMode* value) { + return LossParameter_NormalizationMode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kIgnoreLabelFieldNumber = 1, + kNormalizeFieldNumber = 2, + kNormalizationFieldNumber = 3, + }; + // optional int32 ignore_label = 1; + bool has_ignore_label() const; + private: + bool _internal_has_ignore_label() const; + public: + void clear_ignore_label(); + ::PROTOBUF_NAMESPACE_ID::int32 ignore_label() const; + void set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_ignore_label() const; + void _internal_set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool normalize = 2; + bool has_normalize() const; + private: + bool _internal_has_normalize() const; + public: + void clear_normalize(); + bool normalize() const; + void set_normalize(bool value); + private: + bool _internal_normalize() const; + void _internal_set_normalize(bool value); + public: + + // optional .caffe.LossParameter.NormalizationMode normalization = 3 [default = VALID]; + bool has_normalization() const; + private: + bool _internal_has_normalization() const; + public: + void clear_normalization(); + ::caffe::LossParameter_NormalizationMode normalization() const; + void set_normalization(::caffe::LossParameter_NormalizationMode value); + private: + ::caffe::LossParameter_NormalizationMode _internal_normalization() const; + void _internal_set_normalization(::caffe::LossParameter_NormalizationMode value); + public: + + // @@protoc_insertion_point(class_scope:caffe.LossParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::int32 ignore_label_; + bool normalize_; + int normalization_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class AccuracyParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.AccuracyParameter) */ { + public: + inline AccuracyParameter() : AccuracyParameter(nullptr) {}; + virtual ~AccuracyParameter(); + + AccuracyParameter(const AccuracyParameter& from); + AccuracyParameter(AccuracyParameter&& from) noexcept + : AccuracyParameter() { + *this = ::std::move(from); + } + + inline AccuracyParameter& operator=(const AccuracyParameter& from) { + CopyFrom(from); + return *this; + } + inline AccuracyParameter& operator=(AccuracyParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const AccuracyParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const AccuracyParameter* internal_default_instance() { + return reinterpret_cast( + &_AccuracyParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 14; + + friend void swap(AccuracyParameter& a, AccuracyParameter& b) { + a.Swap(&b); + } + inline void Swap(AccuracyParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AccuracyParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline AccuracyParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + AccuracyParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const AccuracyParameter& from); + void MergeFrom(const AccuracyParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AccuracyParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.AccuracyParameter"; + } + protected: + explicit AccuracyParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kIgnoreLabelFieldNumber = 3, + kTopKFieldNumber = 1, + kAxisFieldNumber = 2, + }; + // optional int32 ignore_label = 3; + bool has_ignore_label() const; + private: + bool _internal_has_ignore_label() const; + public: + void clear_ignore_label(); + ::PROTOBUF_NAMESPACE_ID::int32 ignore_label() const; + void set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_ignore_label() const; + void _internal_set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional uint32 top_k = 1 [default = 1]; + bool has_top_k() const; + private: + bool _internal_has_top_k() const; + public: + void clear_top_k(); + ::PROTOBUF_NAMESPACE_ID::uint32 top_k() const; + void set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_top_k() const; + void _internal_set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional int32 axis = 2 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.AccuracyParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::int32 ignore_label_; + ::PROTOBUF_NAMESPACE_ID::uint32 top_k_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ArgMaxParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ArgMaxParameter) */ { + public: + inline ArgMaxParameter() : ArgMaxParameter(nullptr) {}; + virtual ~ArgMaxParameter(); + + ArgMaxParameter(const ArgMaxParameter& from); + ArgMaxParameter(ArgMaxParameter&& from) noexcept + : ArgMaxParameter() { + *this = ::std::move(from); + } + + inline ArgMaxParameter& operator=(const ArgMaxParameter& from) { + CopyFrom(from); + return *this; + } + inline ArgMaxParameter& operator=(ArgMaxParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ArgMaxParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ArgMaxParameter* internal_default_instance() { + return reinterpret_cast( + &_ArgMaxParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 15; + + friend void swap(ArgMaxParameter& a, ArgMaxParameter& b) { + a.Swap(&b); + } + inline void Swap(ArgMaxParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ArgMaxParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ArgMaxParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ArgMaxParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ArgMaxParameter& from); + void MergeFrom(const ArgMaxParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ArgMaxParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ArgMaxParameter"; + } + protected: + explicit ArgMaxParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOutMaxValFieldNumber = 1, + kAxisFieldNumber = 3, + kTopKFieldNumber = 2, + }; + // optional bool out_max_val = 1 [default = false]; + bool has_out_max_val() const; + private: + bool _internal_has_out_max_val() const; + public: + void clear_out_max_val(); + bool out_max_val() const; + void set_out_max_val(bool value); + private: + bool _internal_out_max_val() const; + void _internal_set_out_max_val(bool value); + public: + + // optional int32 axis = 3; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional uint32 top_k = 2 [default = 1]; + bool has_top_k() const; + private: + bool _internal_has_top_k() const; + public: + void clear_top_k(); + ::PROTOBUF_NAMESPACE_ID::uint32 top_k() const; + void set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_top_k() const; + void _internal_set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ArgMaxParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool out_max_val_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + ::PROTOBUF_NAMESPACE_ID::uint32 top_k_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ClipParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ClipParameter) */ { + public: + inline ClipParameter() : ClipParameter(nullptr) {}; + virtual ~ClipParameter(); + + ClipParameter(const ClipParameter& from); + ClipParameter(ClipParameter&& from) noexcept + : ClipParameter() { + *this = ::std::move(from); + } + + inline ClipParameter& operator=(const ClipParameter& from) { + CopyFrom(from); + return *this; + } + inline ClipParameter& operator=(ClipParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ClipParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ClipParameter* internal_default_instance() { + return reinterpret_cast( + &_ClipParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 16; + + friend void swap(ClipParameter& a, ClipParameter& b) { + a.Swap(&b); + } + inline void Swap(ClipParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ClipParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ClipParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ClipParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ClipParameter& from); + void MergeFrom(const ClipParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ClipParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ClipParameter"; + } + protected: + explicit ClipParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMinFieldNumber = 1, + kMaxFieldNumber = 2, + }; + // optional float min = 1; + bool has_min() const; + private: + bool _internal_has_min() const; + public: + void clear_min(); + float min() const; + void set_min(float value); + private: + float _internal_min() const; + void _internal_set_min(float value); + public: + + // optional float max = 2; + bool has_max() const; + private: + bool _internal_has_max() const; + public: + void clear_max(); + float max() const; + void set_max(float value); + private: + float _internal_max() const; + void _internal_set_max(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ClipParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float min_; + float max_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ConcatParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ConcatParameter) */ { + public: + inline ConcatParameter() : ConcatParameter(nullptr) {}; + virtual ~ConcatParameter(); + + ConcatParameter(const ConcatParameter& from); + ConcatParameter(ConcatParameter&& from) noexcept + : ConcatParameter() { + *this = ::std::move(from); + } + + inline ConcatParameter& operator=(const ConcatParameter& from) { + CopyFrom(from); + return *this; + } + inline ConcatParameter& operator=(ConcatParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ConcatParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ConcatParameter* internal_default_instance() { + return reinterpret_cast( + &_ConcatParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 17; + + friend void swap(ConcatParameter& a, ConcatParameter& b) { + a.Swap(&b); + } + inline void Swap(ConcatParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConcatParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ConcatParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ConcatParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ConcatParameter& from); + void MergeFrom(const ConcatParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ConcatParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ConcatParameter"; + } + protected: + explicit ConcatParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kConcatDimFieldNumber = 1, + kAxisFieldNumber = 2, + }; + // optional uint32 concat_dim = 1 [default = 1]; + bool has_concat_dim() const; + private: + bool _internal_has_concat_dim() const; + public: + void clear_concat_dim(); + ::PROTOBUF_NAMESPACE_ID::uint32 concat_dim() const; + void set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_concat_dim() const; + void _internal_set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional int32 axis = 2 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ConcatParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 concat_dim_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class BatchNormParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.BatchNormParameter) */ { + public: + inline BatchNormParameter() : BatchNormParameter(nullptr) {}; + virtual ~BatchNormParameter(); + + BatchNormParameter(const BatchNormParameter& from); + BatchNormParameter(BatchNormParameter&& from) noexcept + : BatchNormParameter() { + *this = ::std::move(from); + } + + inline BatchNormParameter& operator=(const BatchNormParameter& from) { + CopyFrom(from); + return *this; + } + inline BatchNormParameter& operator=(BatchNormParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const BatchNormParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const BatchNormParameter* internal_default_instance() { + return reinterpret_cast( + &_BatchNormParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 18; + + friend void swap(BatchNormParameter& a, BatchNormParameter& b) { + a.Swap(&b); + } + inline void Swap(BatchNormParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BatchNormParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BatchNormParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + BatchNormParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const BatchNormParameter& from); + void MergeFrom(const BatchNormParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BatchNormParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.BatchNormParameter"; + } + protected: + explicit BatchNormParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kUseGlobalStatsFieldNumber = 1, + kMovingAverageFractionFieldNumber = 2, + kEpsFieldNumber = 3, + }; + // optional bool use_global_stats = 1; + bool has_use_global_stats() const; + private: + bool _internal_has_use_global_stats() const; + public: + void clear_use_global_stats(); + bool use_global_stats() const; + void set_use_global_stats(bool value); + private: + bool _internal_use_global_stats() const; + void _internal_set_use_global_stats(bool value); + public: + + // optional float moving_average_fraction = 2 [default = 0.999]; + bool has_moving_average_fraction() const; + private: + bool _internal_has_moving_average_fraction() const; + public: + void clear_moving_average_fraction(); + float moving_average_fraction() const; + void set_moving_average_fraction(float value); + private: + float _internal_moving_average_fraction() const; + void _internal_set_moving_average_fraction(float value); + public: + + // optional float eps = 3 [default = 1e-05]; + bool has_eps() const; + private: + bool _internal_has_eps() const; + public: + void clear_eps(); + float eps() const; + void set_eps(float value); + private: + float _internal_eps() const; + void _internal_set_eps(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.BatchNormParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool use_global_stats_; + float moving_average_fraction_; + float eps_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class BiasParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.BiasParameter) */ { + public: + inline BiasParameter() : BiasParameter(nullptr) {}; + virtual ~BiasParameter(); + + BiasParameter(const BiasParameter& from); + BiasParameter(BiasParameter&& from) noexcept + : BiasParameter() { + *this = ::std::move(from); + } + + inline BiasParameter& operator=(const BiasParameter& from) { + CopyFrom(from); + return *this; + } + inline BiasParameter& operator=(BiasParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const BiasParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const BiasParameter* internal_default_instance() { + return reinterpret_cast( + &_BiasParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 19; + + friend void swap(BiasParameter& a, BiasParameter& b) { + a.Swap(&b); + } + inline void Swap(BiasParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BiasParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline BiasParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + BiasParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const BiasParameter& from); + void MergeFrom(const BiasParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(BiasParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.BiasParameter"; + } + protected: + explicit BiasParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFillerFieldNumber = 3, + kAxisFieldNumber = 1, + kNumAxesFieldNumber = 2, + }; + // optional .caffe.FillerParameter filler = 3; + bool has_filler() const; + private: + bool _internal_has_filler() const; + public: + void clear_filler(); + const ::caffe::FillerParameter& filler() const; + ::caffe::FillerParameter* release_filler(); + ::caffe::FillerParameter* mutable_filler(); + void set_allocated_filler(::caffe::FillerParameter* filler); + private: + const ::caffe::FillerParameter& _internal_filler() const; + ::caffe::FillerParameter* _internal_mutable_filler(); + public: + void unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler); + ::caffe::FillerParameter* unsafe_arena_release_filler(); + + // optional int32 axis = 1 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 num_axes = 2 [default = 1]; + bool has_num_axes() const; + private: + bool _internal_has_num_axes() const; + public: + void clear_num_axes(); + ::PROTOBUF_NAMESPACE_ID::int32 num_axes() const; + void set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_num_axes() const; + void _internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.BiasParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* filler_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + ::PROTOBUF_NAMESPACE_ID::int32 num_axes_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ContrastiveLossParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ContrastiveLossParameter) */ { + public: + inline ContrastiveLossParameter() : ContrastiveLossParameter(nullptr) {}; + virtual ~ContrastiveLossParameter(); + + ContrastiveLossParameter(const ContrastiveLossParameter& from); + ContrastiveLossParameter(ContrastiveLossParameter&& from) noexcept + : ContrastiveLossParameter() { + *this = ::std::move(from); + } + + inline ContrastiveLossParameter& operator=(const ContrastiveLossParameter& from) { + CopyFrom(from); + return *this; + } + inline ContrastiveLossParameter& operator=(ContrastiveLossParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ContrastiveLossParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ContrastiveLossParameter* internal_default_instance() { + return reinterpret_cast( + &_ContrastiveLossParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 20; + + friend void swap(ContrastiveLossParameter& a, ContrastiveLossParameter& b) { + a.Swap(&b); + } + inline void Swap(ContrastiveLossParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ContrastiveLossParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ContrastiveLossParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ContrastiveLossParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ContrastiveLossParameter& from); + void MergeFrom(const ContrastiveLossParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ContrastiveLossParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ContrastiveLossParameter"; + } + protected: + explicit ContrastiveLossParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kLegacyVersionFieldNumber = 2, + kMarginFieldNumber = 1, + }; + // optional bool legacy_version = 2 [default = false]; + bool has_legacy_version() const; + private: + bool _internal_has_legacy_version() const; + public: + void clear_legacy_version(); + bool legacy_version() const; + void set_legacy_version(bool value); + private: + bool _internal_legacy_version() const; + void _internal_set_legacy_version(bool value); + public: + + // optional float margin = 1 [default = 1]; + bool has_margin() const; + private: + bool _internal_has_margin() const; + public: + void clear_margin(); + float margin() const; + void set_margin(float value); + private: + float _internal_margin() const; + void _internal_set_margin(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ContrastiveLossParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool legacy_version_; + float margin_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ConvolutionParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ConvolutionParameter) */ { + public: + inline ConvolutionParameter() : ConvolutionParameter(nullptr) {}; + virtual ~ConvolutionParameter(); + + ConvolutionParameter(const ConvolutionParameter& from); + ConvolutionParameter(ConvolutionParameter&& from) noexcept + : ConvolutionParameter() { + *this = ::std::move(from); + } + + inline ConvolutionParameter& operator=(const ConvolutionParameter& from) { + CopyFrom(from); + return *this; + } + inline ConvolutionParameter& operator=(ConvolutionParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ConvolutionParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ConvolutionParameter* internal_default_instance() { + return reinterpret_cast( + &_ConvolutionParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 21; + + friend void swap(ConvolutionParameter& a, ConvolutionParameter& b) { + a.Swap(&b); + } + inline void Swap(ConvolutionParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConvolutionParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ConvolutionParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ConvolutionParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ConvolutionParameter& from); + void MergeFrom(const ConvolutionParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ConvolutionParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ConvolutionParameter"; + } + protected: + explicit ConvolutionParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef ConvolutionParameter_Engine Engine; + static constexpr Engine DEFAULT = + ConvolutionParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + ConvolutionParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + ConvolutionParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return ConvolutionParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + ConvolutionParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + ConvolutionParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + ConvolutionParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return ConvolutionParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return ConvolutionParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return ConvolutionParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kPadFieldNumber = 3, + kKernelSizeFieldNumber = 4, + kStrideFieldNumber = 6, + kDilationFieldNumber = 18, + kWeightFillerFieldNumber = 7, + kBiasFillerFieldNumber = 8, + kNumOutputFieldNumber = 1, + kPadHFieldNumber = 9, + kPadWFieldNumber = 10, + kKernelHFieldNumber = 11, + kKernelWFieldNumber = 12, + kStrideHFieldNumber = 13, + kStrideWFieldNumber = 14, + kEngineFieldNumber = 15, + kForceNdIm2ColFieldNumber = 17, + kAxisFieldNumber = 16, + kBiasTermFieldNumber = 2, + kGroupFieldNumber = 5, + }; + // repeated uint32 pad = 3; + int pad_size() const; + private: + int _internal_pad_size() const; + public: + void clear_pad(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_pad() const; + void _internal_add_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_pad(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 pad(int index) const; + void set_pad(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + pad() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_pad(); + + // repeated uint32 kernel_size = 4; + int kernel_size_size() const; + private: + int _internal_kernel_size_size() const; + public: + void clear_kernel_size(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_size(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_kernel_size() const; + void _internal_add_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_kernel_size(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_size(int index) const; + void set_kernel_size(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + kernel_size() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_kernel_size(); + + // repeated uint32 stride = 6; + int stride_size() const; + private: + int _internal_stride_size() const; + public: + void clear_stride(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_stride() const; + void _internal_add_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_stride(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 stride(int index) const; + void set_stride(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + stride() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_stride(); + + // repeated uint32 dilation = 18; + int dilation_size() const; + private: + int _internal_dilation_size() const; + public: + void clear_dilation(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_dilation(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_dilation() const; + void _internal_add_dilation(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_dilation(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 dilation(int index) const; + void set_dilation(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_dilation(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + dilation() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_dilation(); + + // optional .caffe.FillerParameter weight_filler = 7; + bool has_weight_filler() const; + private: + bool _internal_has_weight_filler() const; + public: + void clear_weight_filler(); + const ::caffe::FillerParameter& weight_filler() const; + ::caffe::FillerParameter* release_weight_filler(); + ::caffe::FillerParameter* mutable_weight_filler(); + void set_allocated_weight_filler(::caffe::FillerParameter* weight_filler); + private: + const ::caffe::FillerParameter& _internal_weight_filler() const; + ::caffe::FillerParameter* _internal_mutable_weight_filler(); + public: + void unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler); + ::caffe::FillerParameter* unsafe_arena_release_weight_filler(); + + // optional .caffe.FillerParameter bias_filler = 8; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional uint32 num_output = 1; + bool has_num_output() const; + private: + bool _internal_has_num_output() const; + public: + void clear_num_output(); + ::PROTOBUF_NAMESPACE_ID::uint32 num_output() const; + void set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num_output() const; + void _internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad_h = 9 [default = 0]; + bool has_pad_h() const; + private: + bool _internal_has_pad_h() const; + public: + void clear_pad_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad_h() const; + void set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad_h() const; + void _internal_set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad_w = 10 [default = 0]; + bool has_pad_w() const; + private: + bool _internal_has_pad_w() const; + public: + void clear_pad_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad_w() const; + void set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad_w() const; + void _internal_set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 kernel_h = 11; + bool has_kernel_h() const; + private: + bool _internal_has_kernel_h() const; + public: + void clear_kernel_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_h() const; + void set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_h() const; + void _internal_set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 kernel_w = 12; + bool has_kernel_w() const; + private: + bool _internal_has_kernel_w() const; + public: + void clear_kernel_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_w() const; + void set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_w() const; + void _internal_set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 stride_h = 13; + bool has_stride_h() const; + private: + bool _internal_has_stride_h() const; + public: + void clear_stride_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride_h() const; + void set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride_h() const; + void _internal_set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 stride_w = 14; + bool has_stride_w() const; + private: + bool _internal_has_stride_w() const; + public: + void clear_stride_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride_w() const; + void set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride_w() const; + void _internal_set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional .caffe.ConvolutionParameter.Engine engine = 15 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::ConvolutionParameter_Engine engine() const; + void set_engine(::caffe::ConvolutionParameter_Engine value); + private: + ::caffe::ConvolutionParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::ConvolutionParameter_Engine value); + public: + + // optional bool force_nd_im2col = 17 [default = false]; + bool has_force_nd_im2col() const; + private: + bool _internal_has_force_nd_im2col() const; + public: + void clear_force_nd_im2col(); + bool force_nd_im2col() const; + void set_force_nd_im2col(bool value); + private: + bool _internal_force_nd_im2col() const; + void _internal_set_force_nd_im2col(bool value); + public: + + // optional int32 axis = 16 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool bias_term = 2 [default = true]; + bool has_bias_term() const; + private: + bool _internal_has_bias_term() const; + public: + void clear_bias_term(); + bool bias_term() const; + void set_bias_term(bool value); + private: + bool _internal_bias_term() const; + void _internal_set_bias_term(bool value); + public: + + // optional uint32 group = 5 [default = 1]; + bool has_group() const; + private: + bool _internal_has_group() const; + public: + void clear_group(); + ::PROTOBUF_NAMESPACE_ID::uint32 group() const; + void set_group(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_group() const; + void _internal_set_group(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ConvolutionParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > pad_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > kernel_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > stride_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > dilation_; + ::caffe::FillerParameter* weight_filler_; + ::caffe::FillerParameter* bias_filler_; + ::PROTOBUF_NAMESPACE_ID::uint32 num_output_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_w_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_w_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_w_; + int engine_; + bool force_nd_im2col_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + bool bias_term_; + ::PROTOBUF_NAMESPACE_ID::uint32 group_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class CropParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.CropParameter) */ { + public: + inline CropParameter() : CropParameter(nullptr) {}; + virtual ~CropParameter(); + + CropParameter(const CropParameter& from); + CropParameter(CropParameter&& from) noexcept + : CropParameter() { + *this = ::std::move(from); + } + + inline CropParameter& operator=(const CropParameter& from) { + CopyFrom(from); + return *this; + } + inline CropParameter& operator=(CropParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const CropParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const CropParameter* internal_default_instance() { + return reinterpret_cast( + &_CropParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 22; + + friend void swap(CropParameter& a, CropParameter& b) { + a.Swap(&b); + } + inline void Swap(CropParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CropParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline CropParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + CropParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const CropParameter& from); + void MergeFrom(const CropParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(CropParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.CropParameter"; + } + protected: + explicit CropParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOffsetFieldNumber = 2, + kAxisFieldNumber = 1, + }; + // repeated uint32 offset = 2; + int offset_size() const; + private: + int _internal_offset_size() const; + public: + void clear_offset(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_offset(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_offset() const; + void _internal_add_offset(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_offset(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 offset(int index) const; + void set_offset(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_offset(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + offset() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_offset(); + + // optional int32 axis = 1 [default = 2]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.CropParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > offset_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class DataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.DataParameter) */ { + public: + inline DataParameter() : DataParameter(nullptr) {}; + virtual ~DataParameter(); + + DataParameter(const DataParameter& from); + DataParameter(DataParameter&& from) noexcept + : DataParameter() { + *this = ::std::move(from); + } + + inline DataParameter& operator=(const DataParameter& from) { + CopyFrom(from); + return *this; + } + inline DataParameter& operator=(DataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DataParameter* internal_default_instance() { + return reinterpret_cast( + &_DataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 23; + + friend void swap(DataParameter& a, DataParameter& b) { + a.Swap(&b); + } + inline void Swap(DataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + DataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DataParameter& from); + void MergeFrom(const DataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.DataParameter"; + } + protected: + explicit DataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef DataParameter_DB DB; + static constexpr DB LEVELDB = + DataParameter_DB_LEVELDB; + static constexpr DB LMDB = + DataParameter_DB_LMDB; + static inline bool DB_IsValid(int value) { + return DataParameter_DB_IsValid(value); + } + static constexpr DB DB_MIN = + DataParameter_DB_DB_MIN; + static constexpr DB DB_MAX = + DataParameter_DB_DB_MAX; + static constexpr int DB_ARRAYSIZE = + DataParameter_DB_DB_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + DB_descriptor() { + return DataParameter_DB_descriptor(); + } + template + static inline const std::string& DB_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DB_Name."); + return DataParameter_DB_Name(enum_t_value); + } + static inline bool DB_Parse(const std::string& name, + DB* value) { + return DataParameter_DB_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kSourceFieldNumber = 1, + kMeanFileFieldNumber = 3, + kBatchSizeFieldNumber = 4, + kCropSizeFieldNumber = 5, + kRandSkipFieldNumber = 7, + kMirrorFieldNumber = 6, + kForceEncodedColorFieldNumber = 9, + kBackendFieldNumber = 8, + kScaleFieldNumber = 2, + kPrefetchFieldNumber = 10, + }; + // optional string source = 1; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional string mean_file = 3; + bool has_mean_file() const; + private: + bool _internal_has_mean_file() const; + public: + void clear_mean_file(); + const std::string& mean_file() const; + void set_mean_file(const std::string& value); + void set_mean_file(std::string&& value); + void set_mean_file(const char* value); + void set_mean_file(const char* value, size_t size); + std::string* mutable_mean_file(); + std::string* release_mean_file(); + void set_allocated_mean_file(std::string* mean_file); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_mean_file(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_mean_file( + std::string* mean_file); + private: + const std::string& _internal_mean_file() const; + void _internal_set_mean_file(const std::string& value); + std::string* _internal_mutable_mean_file(); + public: + + // optional uint32 batch_size = 4; + bool has_batch_size() const; + private: + bool _internal_has_batch_size() const; + public: + void clear_batch_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size() const; + void set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batch_size() const; + void _internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 crop_size = 5 [default = 0]; + bool has_crop_size() const; + private: + bool _internal_has_crop_size() const; + public: + void clear_crop_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size() const; + void set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_crop_size() const; + void _internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 rand_skip = 7 [default = 0]; + bool has_rand_skip() const; + private: + bool _internal_has_rand_skip() const; + public: + void clear_rand_skip(); + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip() const; + void set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_rand_skip() const; + void _internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool mirror = 6 [default = false]; + bool has_mirror() const; + private: + bool _internal_has_mirror() const; + public: + void clear_mirror(); + bool mirror() const; + void set_mirror(bool value); + private: + bool _internal_mirror() const; + void _internal_set_mirror(bool value); + public: + + // optional bool force_encoded_color = 9 [default = false]; + bool has_force_encoded_color() const; + private: + bool _internal_has_force_encoded_color() const; + public: + void clear_force_encoded_color(); + bool force_encoded_color() const; + void set_force_encoded_color(bool value); + private: + bool _internal_force_encoded_color() const; + void _internal_set_force_encoded_color(bool value); + public: + + // optional .caffe.DataParameter.DB backend = 8 [default = LEVELDB]; + bool has_backend() const; + private: + bool _internal_has_backend() const; + public: + void clear_backend(); + ::caffe::DataParameter_DB backend() const; + void set_backend(::caffe::DataParameter_DB value); + private: + ::caffe::DataParameter_DB _internal_backend() const; + void _internal_set_backend(::caffe::DataParameter_DB value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // optional uint32 prefetch = 10 [default = 4]; + bool has_prefetch() const; + private: + bool _internal_has_prefetch() const; + public: + void clear_prefetch(); + ::PROTOBUF_NAMESPACE_ID::uint32 prefetch() const; + void set_prefetch(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_prefetch() const; + void _internal_set_prefetch(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.DataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr mean_file_; + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip_; + bool mirror_; + bool force_encoded_color_; + int backend_; + float scale_; + ::PROTOBUF_NAMESPACE_ID::uint32 prefetch_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class DropoutParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.DropoutParameter) */ { + public: + inline DropoutParameter() : DropoutParameter(nullptr) {}; + virtual ~DropoutParameter(); + + DropoutParameter(const DropoutParameter& from); + DropoutParameter(DropoutParameter&& from) noexcept + : DropoutParameter() { + *this = ::std::move(from); + } + + inline DropoutParameter& operator=(const DropoutParameter& from) { + CopyFrom(from); + return *this; + } + inline DropoutParameter& operator=(DropoutParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DropoutParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DropoutParameter* internal_default_instance() { + return reinterpret_cast( + &_DropoutParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 24; + + friend void swap(DropoutParameter& a, DropoutParameter& b) { + a.Swap(&b); + } + inline void Swap(DropoutParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DropoutParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DropoutParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + DropoutParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DropoutParameter& from); + void MergeFrom(const DropoutParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DropoutParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.DropoutParameter"; + } + protected: + explicit DropoutParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDropoutRatioFieldNumber = 1, + }; + // optional float dropout_ratio = 1 [default = 0.5]; + bool has_dropout_ratio() const; + private: + bool _internal_has_dropout_ratio() const; + public: + void clear_dropout_ratio(); + float dropout_ratio() const; + void set_dropout_ratio(float value); + private: + float _internal_dropout_ratio() const; + void _internal_set_dropout_ratio(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.DropoutParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float dropout_ratio_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class DummyDataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.DummyDataParameter) */ { + public: + inline DummyDataParameter() : DummyDataParameter(nullptr) {}; + virtual ~DummyDataParameter(); + + DummyDataParameter(const DummyDataParameter& from); + DummyDataParameter(DummyDataParameter&& from) noexcept + : DummyDataParameter() { + *this = ::std::move(from); + } + + inline DummyDataParameter& operator=(const DummyDataParameter& from) { + CopyFrom(from); + return *this; + } + inline DummyDataParameter& operator=(DummyDataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const DummyDataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const DummyDataParameter* internal_default_instance() { + return reinterpret_cast( + &_DummyDataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 25; + + friend void swap(DummyDataParameter& a, DummyDataParameter& b) { + a.Swap(&b); + } + inline void Swap(DummyDataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DummyDataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline DummyDataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + DummyDataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const DummyDataParameter& from); + void MergeFrom(const DummyDataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(DummyDataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.DummyDataParameter"; + } + protected: + explicit DummyDataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFillerFieldNumber = 1, + kNumFieldNumber = 2, + kChannelsFieldNumber = 3, + kHeightFieldNumber = 4, + kWidthFieldNumber = 5, + kShapeFieldNumber = 6, + }; + // repeated .caffe.FillerParameter data_filler = 1; + int data_filler_size() const; + private: + int _internal_data_filler_size() const; + public: + void clear_data_filler(); + ::caffe::FillerParameter* mutable_data_filler(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::FillerParameter >* + mutable_data_filler(); + private: + const ::caffe::FillerParameter& _internal_data_filler(int index) const; + ::caffe::FillerParameter* _internal_add_data_filler(); + public: + const ::caffe::FillerParameter& data_filler(int index) const; + ::caffe::FillerParameter* add_data_filler(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::FillerParameter >& + data_filler() const; + + // repeated uint32 num = 2; + int num_size() const; + private: + int _internal_num_size() const; + public: + void clear_num(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_num() const; + void _internal_add_num(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_num(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 num(int index) const; + void set_num(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_num(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + num() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_num(); + + // repeated uint32 channels = 3; + int channels_size() const; + private: + int _internal_channels_size() const; + public: + void clear_channels(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_channels(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_channels() const; + void _internal_add_channels(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_channels(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 channels(int index) const; + void set_channels(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_channels(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + channels() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_channels(); + + // repeated uint32 height = 4; + int height_size() const; + private: + int _internal_height_size() const; + public: + void clear_height(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_height(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_height() const; + void _internal_add_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_height(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 height(int index) const; + void set_height(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + height() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_height(); + + // repeated uint32 width = 5; + int width_size() const; + private: + int _internal_width_size() const; + public: + void clear_width(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_width(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_width() const; + void _internal_add_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_width(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 width(int index) const; + void set_width(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + width() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_width(); + + // repeated .caffe.BlobShape shape = 6; + int shape_size() const; + private: + int _internal_shape_size() const; + public: + void clear_shape(); + ::caffe::BlobShape* mutable_shape(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* + mutable_shape(); + private: + const ::caffe::BlobShape& _internal_shape(int index) const; + ::caffe::BlobShape* _internal_add_shape(); + public: + const ::caffe::BlobShape& shape(int index) const; + ::caffe::BlobShape* add_shape(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& + shape() const; + + // @@protoc_insertion_point(class_scope:caffe.DummyDataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::FillerParameter > data_filler_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > num_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > channels_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > height_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > width_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape > shape_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class EltwiseParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.EltwiseParameter) */ { + public: + inline EltwiseParameter() : EltwiseParameter(nullptr) {}; + virtual ~EltwiseParameter(); + + EltwiseParameter(const EltwiseParameter& from); + EltwiseParameter(EltwiseParameter&& from) noexcept + : EltwiseParameter() { + *this = ::std::move(from); + } + + inline EltwiseParameter& operator=(const EltwiseParameter& from) { + CopyFrom(from); + return *this; + } + inline EltwiseParameter& operator=(EltwiseParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const EltwiseParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const EltwiseParameter* internal_default_instance() { + return reinterpret_cast( + &_EltwiseParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 26; + + friend void swap(EltwiseParameter& a, EltwiseParameter& b) { + a.Swap(&b); + } + inline void Swap(EltwiseParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(EltwiseParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline EltwiseParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + EltwiseParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const EltwiseParameter& from); + void MergeFrom(const EltwiseParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(EltwiseParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.EltwiseParameter"; + } + protected: + explicit EltwiseParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef EltwiseParameter_EltwiseOp EltwiseOp; + static constexpr EltwiseOp PROD = + EltwiseParameter_EltwiseOp_PROD; + static constexpr EltwiseOp SUM = + EltwiseParameter_EltwiseOp_SUM; + static constexpr EltwiseOp MAX = + EltwiseParameter_EltwiseOp_MAX; + static inline bool EltwiseOp_IsValid(int value) { + return EltwiseParameter_EltwiseOp_IsValid(value); + } + static constexpr EltwiseOp EltwiseOp_MIN = + EltwiseParameter_EltwiseOp_EltwiseOp_MIN; + static constexpr EltwiseOp EltwiseOp_MAX = + EltwiseParameter_EltwiseOp_EltwiseOp_MAX; + static constexpr int EltwiseOp_ARRAYSIZE = + EltwiseParameter_EltwiseOp_EltwiseOp_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + EltwiseOp_descriptor() { + return EltwiseParameter_EltwiseOp_descriptor(); + } + template + static inline const std::string& EltwiseOp_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function EltwiseOp_Name."); + return EltwiseParameter_EltwiseOp_Name(enum_t_value); + } + static inline bool EltwiseOp_Parse(const std::string& name, + EltwiseOp* value) { + return EltwiseParameter_EltwiseOp_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kCoeffFieldNumber = 2, + kOperationFieldNumber = 1, + kStableProdGradFieldNumber = 3, + }; + // repeated float coeff = 2; + int coeff_size() const; + private: + int _internal_coeff_size() const; + public: + void clear_coeff(); + private: + float _internal_coeff(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_coeff() const; + void _internal_add_coeff(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_coeff(); + public: + float coeff(int index) const; + void set_coeff(int index, float value); + void add_coeff(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + coeff() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_coeff(); + + // optional .caffe.EltwiseParameter.EltwiseOp operation = 1 [default = SUM]; + bool has_operation() const; + private: + bool _internal_has_operation() const; + public: + void clear_operation(); + ::caffe::EltwiseParameter_EltwiseOp operation() const; + void set_operation(::caffe::EltwiseParameter_EltwiseOp value); + private: + ::caffe::EltwiseParameter_EltwiseOp _internal_operation() const; + void _internal_set_operation(::caffe::EltwiseParameter_EltwiseOp value); + public: + + // optional bool stable_prod_grad = 3 [default = true]; + bool has_stable_prod_grad() const; + private: + bool _internal_has_stable_prod_grad() const; + public: + void clear_stable_prod_grad(); + bool stable_prod_grad() const; + void set_stable_prod_grad(bool value); + private: + bool _internal_stable_prod_grad() const; + void _internal_set_stable_prod_grad(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.EltwiseParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > coeff_; + int operation_; + bool stable_prod_grad_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ELUParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ELUParameter) */ { + public: + inline ELUParameter() : ELUParameter(nullptr) {}; + virtual ~ELUParameter(); + + ELUParameter(const ELUParameter& from); + ELUParameter(ELUParameter&& from) noexcept + : ELUParameter() { + *this = ::std::move(from); + } + + inline ELUParameter& operator=(const ELUParameter& from) { + CopyFrom(from); + return *this; + } + inline ELUParameter& operator=(ELUParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ELUParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ELUParameter* internal_default_instance() { + return reinterpret_cast( + &_ELUParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 27; + + friend void swap(ELUParameter& a, ELUParameter& b) { + a.Swap(&b); + } + inline void Swap(ELUParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ELUParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ELUParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ELUParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ELUParameter& from); + void MergeFrom(const ELUParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ELUParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ELUParameter"; + } + protected: + explicit ELUParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAlphaFieldNumber = 1, + }; + // optional float alpha = 1 [default = 1]; + bool has_alpha() const; + private: + bool _internal_has_alpha() const; + public: + void clear_alpha(); + float alpha() const; + void set_alpha(float value); + private: + float _internal_alpha() const; + void _internal_set_alpha(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ELUParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float alpha_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class EmbedParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.EmbedParameter) */ { + public: + inline EmbedParameter() : EmbedParameter(nullptr) {}; + virtual ~EmbedParameter(); + + EmbedParameter(const EmbedParameter& from); + EmbedParameter(EmbedParameter&& from) noexcept + : EmbedParameter() { + *this = ::std::move(from); + } + + inline EmbedParameter& operator=(const EmbedParameter& from) { + CopyFrom(from); + return *this; + } + inline EmbedParameter& operator=(EmbedParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const EmbedParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const EmbedParameter* internal_default_instance() { + return reinterpret_cast( + &_EmbedParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 28; + + friend void swap(EmbedParameter& a, EmbedParameter& b) { + a.Swap(&b); + } + inline void Swap(EmbedParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(EmbedParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline EmbedParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + EmbedParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const EmbedParameter& from); + void MergeFrom(const EmbedParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(EmbedParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.EmbedParameter"; + } + protected: + explicit EmbedParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kWeightFillerFieldNumber = 4, + kBiasFillerFieldNumber = 5, + kNumOutputFieldNumber = 1, + kInputDimFieldNumber = 2, + kBiasTermFieldNumber = 3, + }; + // optional .caffe.FillerParameter weight_filler = 4; + bool has_weight_filler() const; + private: + bool _internal_has_weight_filler() const; + public: + void clear_weight_filler(); + const ::caffe::FillerParameter& weight_filler() const; + ::caffe::FillerParameter* release_weight_filler(); + ::caffe::FillerParameter* mutable_weight_filler(); + void set_allocated_weight_filler(::caffe::FillerParameter* weight_filler); + private: + const ::caffe::FillerParameter& _internal_weight_filler() const; + ::caffe::FillerParameter* _internal_mutable_weight_filler(); + public: + void unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler); + ::caffe::FillerParameter* unsafe_arena_release_weight_filler(); + + // optional .caffe.FillerParameter bias_filler = 5; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional uint32 num_output = 1; + bool has_num_output() const; + private: + bool _internal_has_num_output() const; + public: + void clear_num_output(); + ::PROTOBUF_NAMESPACE_ID::uint32 num_output() const; + void set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num_output() const; + void _internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 input_dim = 2; + bool has_input_dim() const; + private: + bool _internal_has_input_dim() const; + public: + void clear_input_dim(); + ::PROTOBUF_NAMESPACE_ID::uint32 input_dim() const; + void set_input_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_input_dim() const; + void _internal_set_input_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool bias_term = 3 [default = true]; + bool has_bias_term() const; + private: + bool _internal_has_bias_term() const; + public: + void clear_bias_term(); + bool bias_term() const; + void set_bias_term(bool value); + private: + bool _internal_bias_term() const; + void _internal_set_bias_term(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.EmbedParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* weight_filler_; + ::caffe::FillerParameter* bias_filler_; + ::PROTOBUF_NAMESPACE_ID::uint32 num_output_; + ::PROTOBUF_NAMESPACE_ID::uint32 input_dim_; + bool bias_term_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ExpParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ExpParameter) */ { + public: + inline ExpParameter() : ExpParameter(nullptr) {}; + virtual ~ExpParameter(); + + ExpParameter(const ExpParameter& from); + ExpParameter(ExpParameter&& from) noexcept + : ExpParameter() { + *this = ::std::move(from); + } + + inline ExpParameter& operator=(const ExpParameter& from) { + CopyFrom(from); + return *this; + } + inline ExpParameter& operator=(ExpParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ExpParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ExpParameter* internal_default_instance() { + return reinterpret_cast( + &_ExpParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 29; + + friend void swap(ExpParameter& a, ExpParameter& b) { + a.Swap(&b); + } + inline void Swap(ExpParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ExpParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ExpParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ExpParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ExpParameter& from); + void MergeFrom(const ExpParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ExpParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ExpParameter"; + } + protected: + explicit ExpParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShiftFieldNumber = 3, + kBaseFieldNumber = 1, + kScaleFieldNumber = 2, + }; + // optional float shift = 3 [default = 0]; + bool has_shift() const; + private: + bool _internal_has_shift() const; + public: + void clear_shift(); + float shift() const; + void set_shift(float value); + private: + float _internal_shift() const; + void _internal_set_shift(float value); + public: + + // optional float base = 1 [default = -1]; + bool has_base() const; + private: + bool _internal_has_base() const; + public: + void clear_base(); + float base() const; + void set_base(float value); + private: + float _internal_base() const; + void _internal_set_base(float value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ExpParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float shift_; + float base_; + float scale_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class FlattenParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.FlattenParameter) */ { + public: + inline FlattenParameter() : FlattenParameter(nullptr) {}; + virtual ~FlattenParameter(); + + FlattenParameter(const FlattenParameter& from); + FlattenParameter(FlattenParameter&& from) noexcept + : FlattenParameter() { + *this = ::std::move(from); + } + + inline FlattenParameter& operator=(const FlattenParameter& from) { + CopyFrom(from); + return *this; + } + inline FlattenParameter& operator=(FlattenParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const FlattenParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const FlattenParameter* internal_default_instance() { + return reinterpret_cast( + &_FlattenParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 30; + + friend void swap(FlattenParameter& a, FlattenParameter& b) { + a.Swap(&b); + } + inline void Swap(FlattenParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FlattenParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline FlattenParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + FlattenParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const FlattenParameter& from); + void MergeFrom(const FlattenParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(FlattenParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.FlattenParameter"; + } + protected: + explicit FlattenParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAxisFieldNumber = 1, + kEndAxisFieldNumber = 2, + }; + // optional int32 axis = 1 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 end_axis = 2 [default = -1]; + bool has_end_axis() const; + private: + bool _internal_has_end_axis() const; + public: + void clear_end_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 end_axis() const; + void set_end_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_end_axis() const; + void _internal_set_end_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.FlattenParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + ::PROTOBUF_NAMESPACE_ID::int32 end_axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class HDF5DataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.HDF5DataParameter) */ { + public: + inline HDF5DataParameter() : HDF5DataParameter(nullptr) {}; + virtual ~HDF5DataParameter(); + + HDF5DataParameter(const HDF5DataParameter& from); + HDF5DataParameter(HDF5DataParameter&& from) noexcept + : HDF5DataParameter() { + *this = ::std::move(from); + } + + inline HDF5DataParameter& operator=(const HDF5DataParameter& from) { + CopyFrom(from); + return *this; + } + inline HDF5DataParameter& operator=(HDF5DataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const HDF5DataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const HDF5DataParameter* internal_default_instance() { + return reinterpret_cast( + &_HDF5DataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 31; + + friend void swap(HDF5DataParameter& a, HDF5DataParameter& b) { + a.Swap(&b); + } + inline void Swap(HDF5DataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HDF5DataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline HDF5DataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + HDF5DataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const HDF5DataParameter& from); + void MergeFrom(const HDF5DataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HDF5DataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.HDF5DataParameter"; + } + protected: + explicit HDF5DataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSourceFieldNumber = 1, + kBatchSizeFieldNumber = 2, + kShuffleFieldNumber = 3, + }; + // optional string source = 1; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional uint32 batch_size = 2; + bool has_batch_size() const; + private: + bool _internal_has_batch_size() const; + public: + void clear_batch_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size() const; + void set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batch_size() const; + void _internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool shuffle = 3 [default = false]; + bool has_shuffle() const; + private: + bool _internal_has_shuffle() const; + public: + void clear_shuffle(); + bool shuffle() const; + void set_shuffle(bool value); + private: + bool _internal_shuffle() const; + void _internal_set_shuffle(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.HDF5DataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size_; + bool shuffle_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class HDF5OutputParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.HDF5OutputParameter) */ { + public: + inline HDF5OutputParameter() : HDF5OutputParameter(nullptr) {}; + virtual ~HDF5OutputParameter(); + + HDF5OutputParameter(const HDF5OutputParameter& from); + HDF5OutputParameter(HDF5OutputParameter&& from) noexcept + : HDF5OutputParameter() { + *this = ::std::move(from); + } + + inline HDF5OutputParameter& operator=(const HDF5OutputParameter& from) { + CopyFrom(from); + return *this; + } + inline HDF5OutputParameter& operator=(HDF5OutputParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const HDF5OutputParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const HDF5OutputParameter* internal_default_instance() { + return reinterpret_cast( + &_HDF5OutputParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 32; + + friend void swap(HDF5OutputParameter& a, HDF5OutputParameter& b) { + a.Swap(&b); + } + inline void Swap(HDF5OutputParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HDF5OutputParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline HDF5OutputParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + HDF5OutputParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const HDF5OutputParameter& from); + void MergeFrom(const HDF5OutputParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HDF5OutputParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.HDF5OutputParameter"; + } + protected: + explicit HDF5OutputParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFileNameFieldNumber = 1, + }; + // optional string file_name = 1; + bool has_file_name() const; + private: + bool _internal_has_file_name() const; + public: + void clear_file_name(); + const std::string& file_name() const; + void set_file_name(const std::string& value); + void set_file_name(std::string&& value); + void set_file_name(const char* value); + void set_file_name(const char* value, size_t size); + std::string* mutable_file_name(); + std::string* release_file_name(); + void set_allocated_file_name(std::string* file_name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_file_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_file_name( + std::string* file_name); + private: + const std::string& _internal_file_name() const; + void _internal_set_file_name(const std::string& value); + std::string* _internal_mutable_file_name(); + public: + + // @@protoc_insertion_point(class_scope:caffe.HDF5OutputParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr file_name_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class HingeLossParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.HingeLossParameter) */ { + public: + inline HingeLossParameter() : HingeLossParameter(nullptr) {}; + virtual ~HingeLossParameter(); + + HingeLossParameter(const HingeLossParameter& from); + HingeLossParameter(HingeLossParameter&& from) noexcept + : HingeLossParameter() { + *this = ::std::move(from); + } + + inline HingeLossParameter& operator=(const HingeLossParameter& from) { + CopyFrom(from); + return *this; + } + inline HingeLossParameter& operator=(HingeLossParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const HingeLossParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const HingeLossParameter* internal_default_instance() { + return reinterpret_cast( + &_HingeLossParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 33; + + friend void swap(HingeLossParameter& a, HingeLossParameter& b) { + a.Swap(&b); + } + inline void Swap(HingeLossParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HingeLossParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline HingeLossParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + HingeLossParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const HingeLossParameter& from); + void MergeFrom(const HingeLossParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HingeLossParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.HingeLossParameter"; + } + protected: + explicit HingeLossParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef HingeLossParameter_Norm Norm; + static constexpr Norm L1 = + HingeLossParameter_Norm_L1; + static constexpr Norm L2 = + HingeLossParameter_Norm_L2; + static inline bool Norm_IsValid(int value) { + return HingeLossParameter_Norm_IsValid(value); + } + static constexpr Norm Norm_MIN = + HingeLossParameter_Norm_Norm_MIN; + static constexpr Norm Norm_MAX = + HingeLossParameter_Norm_Norm_MAX; + static constexpr int Norm_ARRAYSIZE = + HingeLossParameter_Norm_Norm_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Norm_descriptor() { + return HingeLossParameter_Norm_descriptor(); + } + template + static inline const std::string& Norm_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Norm_Name."); + return HingeLossParameter_Norm_Name(enum_t_value); + } + static inline bool Norm_Parse(const std::string& name, + Norm* value) { + return HingeLossParameter_Norm_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kNormFieldNumber = 1, + }; + // optional .caffe.HingeLossParameter.Norm norm = 1 [default = L1]; + bool has_norm() const; + private: + bool _internal_has_norm() const; + public: + void clear_norm(); + ::caffe::HingeLossParameter_Norm norm() const; + void set_norm(::caffe::HingeLossParameter_Norm value); + private: + ::caffe::HingeLossParameter_Norm _internal_norm() const; + void _internal_set_norm(::caffe::HingeLossParameter_Norm value); + public: + + // @@protoc_insertion_point(class_scope:caffe.HingeLossParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int norm_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ImageDataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ImageDataParameter) */ { + public: + inline ImageDataParameter() : ImageDataParameter(nullptr) {}; + virtual ~ImageDataParameter(); + + ImageDataParameter(const ImageDataParameter& from); + ImageDataParameter(ImageDataParameter&& from) noexcept + : ImageDataParameter() { + *this = ::std::move(from); + } + + inline ImageDataParameter& operator=(const ImageDataParameter& from) { + CopyFrom(from); + return *this; + } + inline ImageDataParameter& operator=(ImageDataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ImageDataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ImageDataParameter* internal_default_instance() { + return reinterpret_cast( + &_ImageDataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 34; + + friend void swap(ImageDataParameter& a, ImageDataParameter& b) { + a.Swap(&b); + } + inline void Swap(ImageDataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ImageDataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ImageDataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ImageDataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ImageDataParameter& from); + void MergeFrom(const ImageDataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ImageDataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ImageDataParameter"; + } + protected: + explicit ImageDataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSourceFieldNumber = 1, + kMeanFileFieldNumber = 3, + kRootFolderFieldNumber = 12, + kCropSizeFieldNumber = 5, + kRandSkipFieldNumber = 7, + kShuffleFieldNumber = 8, + kMirrorFieldNumber = 6, + kNewHeightFieldNumber = 9, + kNewWidthFieldNumber = 10, + kIsColorFieldNumber = 11, + kScaleFieldNumber = 2, + kBatchSizeFieldNumber = 4, + }; + // optional string source = 1; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional string mean_file = 3; + bool has_mean_file() const; + private: + bool _internal_has_mean_file() const; + public: + void clear_mean_file(); + const std::string& mean_file() const; + void set_mean_file(const std::string& value); + void set_mean_file(std::string&& value); + void set_mean_file(const char* value); + void set_mean_file(const char* value, size_t size); + std::string* mutable_mean_file(); + std::string* release_mean_file(); + void set_allocated_mean_file(std::string* mean_file); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_mean_file(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_mean_file( + std::string* mean_file); + private: + const std::string& _internal_mean_file() const; + void _internal_set_mean_file(const std::string& value); + std::string* _internal_mutable_mean_file(); + public: + + // optional string root_folder = 12 [default = ""]; + bool has_root_folder() const; + private: + bool _internal_has_root_folder() const; + public: + void clear_root_folder(); + const std::string& root_folder() const; + void set_root_folder(const std::string& value); + void set_root_folder(std::string&& value); + void set_root_folder(const char* value); + void set_root_folder(const char* value, size_t size); + std::string* mutable_root_folder(); + std::string* release_root_folder(); + void set_allocated_root_folder(std::string* root_folder); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_root_folder(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_root_folder( + std::string* root_folder); + private: + const std::string& _internal_root_folder() const; + void _internal_set_root_folder(const std::string& value); + std::string* _internal_mutable_root_folder(); + public: + + // optional uint32 crop_size = 5 [default = 0]; + bool has_crop_size() const; + private: + bool _internal_has_crop_size() const; + public: + void clear_crop_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size() const; + void set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_crop_size() const; + void _internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 rand_skip = 7 [default = 0]; + bool has_rand_skip() const; + private: + bool _internal_has_rand_skip() const; + public: + void clear_rand_skip(); + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip() const; + void set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_rand_skip() const; + void _internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool shuffle = 8 [default = false]; + bool has_shuffle() const; + private: + bool _internal_has_shuffle() const; + public: + void clear_shuffle(); + bool shuffle() const; + void set_shuffle(bool value); + private: + bool _internal_shuffle() const; + void _internal_set_shuffle(bool value); + public: + + // optional bool mirror = 6 [default = false]; + bool has_mirror() const; + private: + bool _internal_has_mirror() const; + public: + void clear_mirror(); + bool mirror() const; + void set_mirror(bool value); + private: + bool _internal_mirror() const; + void _internal_set_mirror(bool value); + public: + + // optional uint32 new_height = 9 [default = 0]; + bool has_new_height() const; + private: + bool _internal_has_new_height() const; + public: + void clear_new_height(); + ::PROTOBUF_NAMESPACE_ID::uint32 new_height() const; + void set_new_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_new_height() const; + void _internal_set_new_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 new_width = 10 [default = 0]; + bool has_new_width() const; + private: + bool _internal_has_new_width() const; + public: + void clear_new_width(); + ::PROTOBUF_NAMESPACE_ID::uint32 new_width() const; + void set_new_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_new_width() const; + void _internal_set_new_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool is_color = 11 [default = true]; + bool has_is_color() const; + private: + bool _internal_has_is_color() const; + public: + void clear_is_color(); + bool is_color() const; + void set_is_color(bool value); + private: + bool _internal_is_color() const; + void _internal_set_is_color(bool value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // optional uint32 batch_size = 4 [default = 1]; + bool has_batch_size() const; + private: + bool _internal_has_batch_size() const; + public: + void clear_batch_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size() const; + void set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batch_size() const; + void _internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ImageDataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr mean_file_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_folder_; + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip_; + bool shuffle_; + bool mirror_; + ::PROTOBUF_NAMESPACE_ID::uint32 new_height_; + ::PROTOBUF_NAMESPACE_ID::uint32 new_width_; + bool is_color_; + float scale_; + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class InfogainLossParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.InfogainLossParameter) */ { + public: + inline InfogainLossParameter() : InfogainLossParameter(nullptr) {}; + virtual ~InfogainLossParameter(); + + InfogainLossParameter(const InfogainLossParameter& from); + InfogainLossParameter(InfogainLossParameter&& from) noexcept + : InfogainLossParameter() { + *this = ::std::move(from); + } + + inline InfogainLossParameter& operator=(const InfogainLossParameter& from) { + CopyFrom(from); + return *this; + } + inline InfogainLossParameter& operator=(InfogainLossParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const InfogainLossParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const InfogainLossParameter* internal_default_instance() { + return reinterpret_cast( + &_InfogainLossParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 35; + + friend void swap(InfogainLossParameter& a, InfogainLossParameter& b) { + a.Swap(&b); + } + inline void Swap(InfogainLossParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(InfogainLossParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline InfogainLossParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + InfogainLossParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const InfogainLossParameter& from); + void MergeFrom(const InfogainLossParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(InfogainLossParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.InfogainLossParameter"; + } + protected: + explicit InfogainLossParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSourceFieldNumber = 1, + kAxisFieldNumber = 2, + }; + // optional string source = 1; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional int32 axis = 2 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.InfogainLossParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class InnerProductParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.InnerProductParameter) */ { + public: + inline InnerProductParameter() : InnerProductParameter(nullptr) {}; + virtual ~InnerProductParameter(); + + InnerProductParameter(const InnerProductParameter& from); + InnerProductParameter(InnerProductParameter&& from) noexcept + : InnerProductParameter() { + *this = ::std::move(from); + } + + inline InnerProductParameter& operator=(const InnerProductParameter& from) { + CopyFrom(from); + return *this; + } + inline InnerProductParameter& operator=(InnerProductParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const InnerProductParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const InnerProductParameter* internal_default_instance() { + return reinterpret_cast( + &_InnerProductParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 36; + + friend void swap(InnerProductParameter& a, InnerProductParameter& b) { + a.Swap(&b); + } + inline void Swap(InnerProductParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(InnerProductParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline InnerProductParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + InnerProductParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const InnerProductParameter& from); + void MergeFrom(const InnerProductParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(InnerProductParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.InnerProductParameter"; + } + protected: + explicit InnerProductParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kWeightFillerFieldNumber = 3, + kBiasFillerFieldNumber = 4, + kNumOutputFieldNumber = 1, + kTransposeFieldNumber = 6, + kBiasTermFieldNumber = 2, + kAxisFieldNumber = 5, + }; + // optional .caffe.FillerParameter weight_filler = 3; + bool has_weight_filler() const; + private: + bool _internal_has_weight_filler() const; + public: + void clear_weight_filler(); + const ::caffe::FillerParameter& weight_filler() const; + ::caffe::FillerParameter* release_weight_filler(); + ::caffe::FillerParameter* mutable_weight_filler(); + void set_allocated_weight_filler(::caffe::FillerParameter* weight_filler); + private: + const ::caffe::FillerParameter& _internal_weight_filler() const; + ::caffe::FillerParameter* _internal_mutable_weight_filler(); + public: + void unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler); + ::caffe::FillerParameter* unsafe_arena_release_weight_filler(); + + // optional .caffe.FillerParameter bias_filler = 4; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional uint32 num_output = 1; + bool has_num_output() const; + private: + bool _internal_has_num_output() const; + public: + void clear_num_output(); + ::PROTOBUF_NAMESPACE_ID::uint32 num_output() const; + void set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num_output() const; + void _internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool transpose = 6 [default = false]; + bool has_transpose() const; + private: + bool _internal_has_transpose() const; + public: + void clear_transpose(); + bool transpose() const; + void set_transpose(bool value); + private: + bool _internal_transpose() const; + void _internal_set_transpose(bool value); + public: + + // optional bool bias_term = 2 [default = true]; + bool has_bias_term() const; + private: + bool _internal_has_bias_term() const; + public: + void clear_bias_term(); + bool bias_term() const; + void set_bias_term(bool value); + private: + bool _internal_bias_term() const; + void _internal_set_bias_term(bool value); + public: + + // optional int32 axis = 5 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.InnerProductParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* weight_filler_; + ::caffe::FillerParameter* bias_filler_; + ::PROTOBUF_NAMESPACE_ID::uint32 num_output_; + bool transpose_; + bool bias_term_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class InputParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.InputParameter) */ { + public: + inline InputParameter() : InputParameter(nullptr) {}; + virtual ~InputParameter(); + + InputParameter(const InputParameter& from); + InputParameter(InputParameter&& from) noexcept + : InputParameter() { + *this = ::std::move(from); + } + + inline InputParameter& operator=(const InputParameter& from) { + CopyFrom(from); + return *this; + } + inline InputParameter& operator=(InputParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const InputParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const InputParameter* internal_default_instance() { + return reinterpret_cast( + &_InputParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 37; + + friend void swap(InputParameter& a, InputParameter& b) { + a.Swap(&b); + } + inline void Swap(InputParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(InputParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline InputParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + InputParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const InputParameter& from); + void MergeFrom(const InputParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(InputParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.InputParameter"; + } + protected: + explicit InputParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShapeFieldNumber = 1, + }; + // repeated .caffe.BlobShape shape = 1; + int shape_size() const; + private: + int _internal_shape_size() const; + public: + void clear_shape(); + ::caffe::BlobShape* mutable_shape(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* + mutable_shape(); + private: + const ::caffe::BlobShape& _internal_shape(int index) const; + ::caffe::BlobShape* _internal_add_shape(); + public: + const ::caffe::BlobShape& shape(int index) const; + ::caffe::BlobShape* add_shape(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& + shape() const; + + // @@protoc_insertion_point(class_scope:caffe.InputParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape > shape_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class LogParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.LogParameter) */ { + public: + inline LogParameter() : LogParameter(nullptr) {}; + virtual ~LogParameter(); + + LogParameter(const LogParameter& from); + LogParameter(LogParameter&& from) noexcept + : LogParameter() { + *this = ::std::move(from); + } + + inline LogParameter& operator=(const LogParameter& from) { + CopyFrom(from); + return *this; + } + inline LogParameter& operator=(LogParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const LogParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const LogParameter* internal_default_instance() { + return reinterpret_cast( + &_LogParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 38; + + friend void swap(LogParameter& a, LogParameter& b) { + a.Swap(&b); + } + inline void Swap(LogParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LogParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline LogParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + LogParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const LogParameter& from); + void MergeFrom(const LogParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LogParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.LogParameter"; + } + protected: + explicit LogParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShiftFieldNumber = 3, + kBaseFieldNumber = 1, + kScaleFieldNumber = 2, + }; + // optional float shift = 3 [default = 0]; + bool has_shift() const; + private: + bool _internal_has_shift() const; + public: + void clear_shift(); + float shift() const; + void set_shift(float value); + private: + float _internal_shift() const; + void _internal_set_shift(float value); + public: + + // optional float base = 1 [default = -1]; + bool has_base() const; + private: + bool _internal_has_base() const; + public: + void clear_base(); + float base() const; + void set_base(float value); + private: + float _internal_base() const; + void _internal_set_base(float value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.LogParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float shift_; + float base_; + float scale_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class LRNParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.LRNParameter) */ { + public: + inline LRNParameter() : LRNParameter(nullptr) {}; + virtual ~LRNParameter(); + + LRNParameter(const LRNParameter& from); + LRNParameter(LRNParameter&& from) noexcept + : LRNParameter() { + *this = ::std::move(from); + } + + inline LRNParameter& operator=(const LRNParameter& from) { + CopyFrom(from); + return *this; + } + inline LRNParameter& operator=(LRNParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const LRNParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const LRNParameter* internal_default_instance() { + return reinterpret_cast( + &_LRNParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 39; + + friend void swap(LRNParameter& a, LRNParameter& b) { + a.Swap(&b); + } + inline void Swap(LRNParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(LRNParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline LRNParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + LRNParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const LRNParameter& from); + void MergeFrom(const LRNParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(LRNParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.LRNParameter"; + } + protected: + explicit LRNParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef LRNParameter_NormRegion NormRegion; + static constexpr NormRegion ACROSS_CHANNELS = + LRNParameter_NormRegion_ACROSS_CHANNELS; + static constexpr NormRegion WITHIN_CHANNEL = + LRNParameter_NormRegion_WITHIN_CHANNEL; + static inline bool NormRegion_IsValid(int value) { + return LRNParameter_NormRegion_IsValid(value); + } + static constexpr NormRegion NormRegion_MIN = + LRNParameter_NormRegion_NormRegion_MIN; + static constexpr NormRegion NormRegion_MAX = + LRNParameter_NormRegion_NormRegion_MAX; + static constexpr int NormRegion_ARRAYSIZE = + LRNParameter_NormRegion_NormRegion_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + NormRegion_descriptor() { + return LRNParameter_NormRegion_descriptor(); + } + template + static inline const std::string& NormRegion_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function NormRegion_Name."); + return LRNParameter_NormRegion_Name(enum_t_value); + } + static inline bool NormRegion_Parse(const std::string& name, + NormRegion* value) { + return LRNParameter_NormRegion_Parse(name, value); + } + + typedef LRNParameter_Engine Engine; + static constexpr Engine DEFAULT = + LRNParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + LRNParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + LRNParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return LRNParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + LRNParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + LRNParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + LRNParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return LRNParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return LRNParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return LRNParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kNormRegionFieldNumber = 4, + kEngineFieldNumber = 6, + kLocalSizeFieldNumber = 1, + kAlphaFieldNumber = 2, + kBetaFieldNumber = 3, + kKFieldNumber = 5, + }; + // optional .caffe.LRNParameter.NormRegion norm_region = 4 [default = ACROSS_CHANNELS]; + bool has_norm_region() const; + private: + bool _internal_has_norm_region() const; + public: + void clear_norm_region(); + ::caffe::LRNParameter_NormRegion norm_region() const; + void set_norm_region(::caffe::LRNParameter_NormRegion value); + private: + ::caffe::LRNParameter_NormRegion _internal_norm_region() const; + void _internal_set_norm_region(::caffe::LRNParameter_NormRegion value); + public: + + // optional .caffe.LRNParameter.Engine engine = 6 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::LRNParameter_Engine engine() const; + void set_engine(::caffe::LRNParameter_Engine value); + private: + ::caffe::LRNParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::LRNParameter_Engine value); + public: + + // optional uint32 local_size = 1 [default = 5]; + bool has_local_size() const; + private: + bool _internal_has_local_size() const; + public: + void clear_local_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 local_size() const; + void set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_local_size() const; + void _internal_set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional float alpha = 2 [default = 1]; + bool has_alpha() const; + private: + bool _internal_has_alpha() const; + public: + void clear_alpha(); + float alpha() const; + void set_alpha(float value); + private: + float _internal_alpha() const; + void _internal_set_alpha(float value); + public: + + // optional float beta = 3 [default = 0.75]; + bool has_beta() const; + private: + bool _internal_has_beta() const; + public: + void clear_beta(); + float beta() const; + void set_beta(float value); + private: + float _internal_beta() const; + void _internal_set_beta(float value); + public: + + // optional float k = 5 [default = 1]; + bool has_k() const; + private: + bool _internal_has_k() const; + public: + void clear_k(); + float k() const; + void set_k(float value); + private: + float _internal_k() const; + void _internal_set_k(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.LRNParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int norm_region_; + int engine_; + ::PROTOBUF_NAMESPACE_ID::uint32 local_size_; + float alpha_; + float beta_; + float k_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class MemoryDataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.MemoryDataParameter) */ { + public: + inline MemoryDataParameter() : MemoryDataParameter(nullptr) {}; + virtual ~MemoryDataParameter(); + + MemoryDataParameter(const MemoryDataParameter& from); + MemoryDataParameter(MemoryDataParameter&& from) noexcept + : MemoryDataParameter() { + *this = ::std::move(from); + } + + inline MemoryDataParameter& operator=(const MemoryDataParameter& from) { + CopyFrom(from); + return *this; + } + inline MemoryDataParameter& operator=(MemoryDataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const MemoryDataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const MemoryDataParameter* internal_default_instance() { + return reinterpret_cast( + &_MemoryDataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 40; + + friend void swap(MemoryDataParameter& a, MemoryDataParameter& b) { + a.Swap(&b); + } + inline void Swap(MemoryDataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MemoryDataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline MemoryDataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + MemoryDataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const MemoryDataParameter& from); + void MergeFrom(const MemoryDataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(MemoryDataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.MemoryDataParameter"; + } + protected: + explicit MemoryDataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBatchSizeFieldNumber = 1, + kChannelsFieldNumber = 2, + kHeightFieldNumber = 3, + kWidthFieldNumber = 4, + }; + // optional uint32 batch_size = 1; + bool has_batch_size() const; + private: + bool _internal_has_batch_size() const; + public: + void clear_batch_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size() const; + void set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batch_size() const; + void _internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 channels = 2; + bool has_channels() const; + private: + bool _internal_has_channels() const; + public: + void clear_channels(); + ::PROTOBUF_NAMESPACE_ID::uint32 channels() const; + void set_channels(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_channels() const; + void _internal_set_channels(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 height = 3; + bool has_height() const; + private: + bool _internal_has_height() const; + public: + void clear_height(); + ::PROTOBUF_NAMESPACE_ID::uint32 height() const; + void set_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_height() const; + void _internal_set_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 width = 4; + bool has_width() const; + private: + bool _internal_has_width() const; + public: + void clear_width(); + ::PROTOBUF_NAMESPACE_ID::uint32 width() const; + void set_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_width() const; + void _internal_set_width(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.MemoryDataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 channels_; + ::PROTOBUF_NAMESPACE_ID::uint32 height_; + ::PROTOBUF_NAMESPACE_ID::uint32 width_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class MVNParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.MVNParameter) */ { + public: + inline MVNParameter() : MVNParameter(nullptr) {}; + virtual ~MVNParameter(); + + MVNParameter(const MVNParameter& from); + MVNParameter(MVNParameter&& from) noexcept + : MVNParameter() { + *this = ::std::move(from); + } + + inline MVNParameter& operator=(const MVNParameter& from) { + CopyFrom(from); + return *this; + } + inline MVNParameter& operator=(MVNParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const MVNParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const MVNParameter* internal_default_instance() { + return reinterpret_cast( + &_MVNParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 41; + + friend void swap(MVNParameter& a, MVNParameter& b) { + a.Swap(&b); + } + inline void Swap(MVNParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MVNParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline MVNParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + MVNParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const MVNParameter& from); + void MergeFrom(const MVNParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(MVNParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.MVNParameter"; + } + protected: + explicit MVNParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAcrossChannelsFieldNumber = 2, + kNormalizeVarianceFieldNumber = 1, + kEpsFieldNumber = 3, + }; + // optional bool across_channels = 2 [default = false]; + bool has_across_channels() const; + private: + bool _internal_has_across_channels() const; + public: + void clear_across_channels(); + bool across_channels() const; + void set_across_channels(bool value); + private: + bool _internal_across_channels() const; + void _internal_set_across_channels(bool value); + public: + + // optional bool normalize_variance = 1 [default = true]; + bool has_normalize_variance() const; + private: + bool _internal_has_normalize_variance() const; + public: + void clear_normalize_variance(); + bool normalize_variance() const; + void set_normalize_variance(bool value); + private: + bool _internal_normalize_variance() const; + void _internal_set_normalize_variance(bool value); + public: + + // optional float eps = 3 [default = 1e-09]; + bool has_eps() const; + private: + bool _internal_has_eps() const; + public: + void clear_eps(); + float eps() const; + void set_eps(float value); + private: + float _internal_eps() const; + void _internal_set_eps(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.MVNParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool across_channels_; + bool normalize_variance_; + float eps_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ParameterParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ParameterParameter) */ { + public: + inline ParameterParameter() : ParameterParameter(nullptr) {}; + virtual ~ParameterParameter(); + + ParameterParameter(const ParameterParameter& from); + ParameterParameter(ParameterParameter&& from) noexcept + : ParameterParameter() { + *this = ::std::move(from); + } + + inline ParameterParameter& operator=(const ParameterParameter& from) { + CopyFrom(from); + return *this; + } + inline ParameterParameter& operator=(ParameterParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ParameterParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ParameterParameter* internal_default_instance() { + return reinterpret_cast( + &_ParameterParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 42; + + friend void swap(ParameterParameter& a, ParameterParameter& b) { + a.Swap(&b); + } + inline void Swap(ParameterParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ParameterParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ParameterParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ParameterParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ParameterParameter& from); + void MergeFrom(const ParameterParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ParameterParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ParameterParameter"; + } + protected: + explicit ParameterParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShapeFieldNumber = 1, + }; + // optional .caffe.BlobShape shape = 1; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::caffe::BlobShape& shape() const; + ::caffe::BlobShape* release_shape(); + ::caffe::BlobShape* mutable_shape(); + void set_allocated_shape(::caffe::BlobShape* shape); + private: + const ::caffe::BlobShape& _internal_shape() const; + ::caffe::BlobShape* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape); + ::caffe::BlobShape* unsafe_arena_release_shape(); + + // @@protoc_insertion_point(class_scope:caffe.ParameterParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::BlobShape* shape_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class PoolingParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.PoolingParameter) */ { + public: + inline PoolingParameter() : PoolingParameter(nullptr) {}; + virtual ~PoolingParameter(); + + PoolingParameter(const PoolingParameter& from); + PoolingParameter(PoolingParameter&& from) noexcept + : PoolingParameter() { + *this = ::std::move(from); + } + + inline PoolingParameter& operator=(const PoolingParameter& from) { + CopyFrom(from); + return *this; + } + inline PoolingParameter& operator=(PoolingParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const PoolingParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const PoolingParameter* internal_default_instance() { + return reinterpret_cast( + &_PoolingParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 43; + + friend void swap(PoolingParameter& a, PoolingParameter& b) { + a.Swap(&b); + } + inline void Swap(PoolingParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(PoolingParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline PoolingParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + PoolingParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const PoolingParameter& from); + void MergeFrom(const PoolingParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(PoolingParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.PoolingParameter"; + } + protected: + explicit PoolingParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef PoolingParameter_PoolMethod PoolMethod; + static constexpr PoolMethod MAX = + PoolingParameter_PoolMethod_MAX; + static constexpr PoolMethod AVE = + PoolingParameter_PoolMethod_AVE; + static constexpr PoolMethod STOCHASTIC = + PoolingParameter_PoolMethod_STOCHASTIC; + static inline bool PoolMethod_IsValid(int value) { + return PoolingParameter_PoolMethod_IsValid(value); + } + static constexpr PoolMethod PoolMethod_MIN = + PoolingParameter_PoolMethod_PoolMethod_MIN; + static constexpr PoolMethod PoolMethod_MAX = + PoolingParameter_PoolMethod_PoolMethod_MAX; + static constexpr int PoolMethod_ARRAYSIZE = + PoolingParameter_PoolMethod_PoolMethod_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + PoolMethod_descriptor() { + return PoolingParameter_PoolMethod_descriptor(); + } + template + static inline const std::string& PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolMethod_Name."); + return PoolingParameter_PoolMethod_Name(enum_t_value); + } + static inline bool PoolMethod_Parse(const std::string& name, + PoolMethod* value) { + return PoolingParameter_PoolMethod_Parse(name, value); + } + + typedef PoolingParameter_Engine Engine; + static constexpr Engine DEFAULT = + PoolingParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + PoolingParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + PoolingParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return PoolingParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + PoolingParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + PoolingParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + PoolingParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return PoolingParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return PoolingParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return PoolingParameter_Engine_Parse(name, value); + } + + typedef PoolingParameter_RoundMode RoundMode; + static constexpr RoundMode CEIL = + PoolingParameter_RoundMode_CEIL; + static constexpr RoundMode FLOOR = + PoolingParameter_RoundMode_FLOOR; + static inline bool RoundMode_IsValid(int value) { + return PoolingParameter_RoundMode_IsValid(value); + } + static constexpr RoundMode RoundMode_MIN = + PoolingParameter_RoundMode_RoundMode_MIN; + static constexpr RoundMode RoundMode_MAX = + PoolingParameter_RoundMode_RoundMode_MAX; + static constexpr int RoundMode_ARRAYSIZE = + PoolingParameter_RoundMode_RoundMode_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + RoundMode_descriptor() { + return PoolingParameter_RoundMode_descriptor(); + } + template + static inline const std::string& RoundMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function RoundMode_Name."); + return PoolingParameter_RoundMode_Name(enum_t_value); + } + static inline bool RoundMode_Parse(const std::string& name, + RoundMode* value) { + return PoolingParameter_RoundMode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kPoolFieldNumber = 1, + kKernelSizeFieldNumber = 2, + kPadFieldNumber = 4, + kKernelHFieldNumber = 5, + kKernelWFieldNumber = 6, + kStrideHFieldNumber = 7, + kStrideWFieldNumber = 8, + kPadHFieldNumber = 9, + kPadWFieldNumber = 10, + kEngineFieldNumber = 11, + kGlobalPoolingFieldNumber = 12, + kRoundModeFieldNumber = 13, + kStrideFieldNumber = 3, + }; + // optional .caffe.PoolingParameter.PoolMethod pool = 1 [default = MAX]; + bool has_pool() const; + private: + bool _internal_has_pool() const; + public: + void clear_pool(); + ::caffe::PoolingParameter_PoolMethod pool() const; + void set_pool(::caffe::PoolingParameter_PoolMethod value); + private: + ::caffe::PoolingParameter_PoolMethod _internal_pool() const; + void _internal_set_pool(::caffe::PoolingParameter_PoolMethod value); + public: + + // optional uint32 kernel_size = 2; + bool has_kernel_size() const; + private: + bool _internal_has_kernel_size() const; + public: + void clear_kernel_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_size() const; + void set_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_size() const; + void _internal_set_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad = 4 [default = 0]; + bool has_pad() const; + private: + bool _internal_has_pad() const; + public: + void clear_pad(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad() const; + void set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad() const; + void _internal_set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 kernel_h = 5; + bool has_kernel_h() const; + private: + bool _internal_has_kernel_h() const; + public: + void clear_kernel_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_h() const; + void set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_h() const; + void _internal_set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 kernel_w = 6; + bool has_kernel_w() const; + private: + bool _internal_has_kernel_w() const; + public: + void clear_kernel_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_w() const; + void set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernel_w() const; + void _internal_set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 stride_h = 7; + bool has_stride_h() const; + private: + bool _internal_has_stride_h() const; + public: + void clear_stride_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride_h() const; + void set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride_h() const; + void _internal_set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 stride_w = 8; + bool has_stride_w() const; + private: + bool _internal_has_stride_w() const; + public: + void clear_stride_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride_w() const; + void set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride_w() const; + void _internal_set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad_h = 9 [default = 0]; + bool has_pad_h() const; + private: + bool _internal_has_pad_h() const; + public: + void clear_pad_h(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad_h() const; + void set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad_h() const; + void _internal_set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad_w = 10 [default = 0]; + bool has_pad_w() const; + private: + bool _internal_has_pad_w() const; + public: + void clear_pad_w(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad_w() const; + void set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad_w() const; + void _internal_set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional .caffe.PoolingParameter.Engine engine = 11 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::PoolingParameter_Engine engine() const; + void set_engine(::caffe::PoolingParameter_Engine value); + private: + ::caffe::PoolingParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::PoolingParameter_Engine value); + public: + + // optional bool global_pooling = 12 [default = false]; + bool has_global_pooling() const; + private: + bool _internal_has_global_pooling() const; + public: + void clear_global_pooling(); + bool global_pooling() const; + void set_global_pooling(bool value); + private: + bool _internal_global_pooling() const; + void _internal_set_global_pooling(bool value); + public: + + // optional .caffe.PoolingParameter.RoundMode round_mode = 13 [default = CEIL]; + bool has_round_mode() const; + private: + bool _internal_has_round_mode() const; + public: + void clear_round_mode(); + ::caffe::PoolingParameter_RoundMode round_mode() const; + void set_round_mode(::caffe::PoolingParameter_RoundMode value); + private: + ::caffe::PoolingParameter_RoundMode _internal_round_mode() const; + void _internal_set_round_mode(::caffe::PoolingParameter_RoundMode value); + public: + + // optional uint32 stride = 3 [default = 1]; + bool has_stride() const; + private: + bool _internal_has_stride() const; + public: + void clear_stride(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride() const; + void set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride() const; + void _internal_set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.PoolingParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int pool_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernel_w_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_w_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_h_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_w_; + int engine_; + bool global_pooling_; + int round_mode_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class PowerParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.PowerParameter) */ { + public: + inline PowerParameter() : PowerParameter(nullptr) {}; + virtual ~PowerParameter(); + + PowerParameter(const PowerParameter& from); + PowerParameter(PowerParameter&& from) noexcept + : PowerParameter() { + *this = ::std::move(from); + } + + inline PowerParameter& operator=(const PowerParameter& from) { + CopyFrom(from); + return *this; + } + inline PowerParameter& operator=(PowerParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const PowerParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const PowerParameter* internal_default_instance() { + return reinterpret_cast( + &_PowerParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 44; + + friend void swap(PowerParameter& a, PowerParameter& b) { + a.Swap(&b); + } + inline void Swap(PowerParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(PowerParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline PowerParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + PowerParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const PowerParameter& from); + void MergeFrom(const PowerParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(PowerParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.PowerParameter"; + } + protected: + explicit PowerParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShiftFieldNumber = 3, + kPowerFieldNumber = 1, + kScaleFieldNumber = 2, + }; + // optional float shift = 3 [default = 0]; + bool has_shift() const; + private: + bool _internal_has_shift() const; + public: + void clear_shift(); + float shift() const; + void set_shift(float value); + private: + float _internal_shift() const; + void _internal_set_shift(float value); + public: + + // optional float power = 1 [default = 1]; + bool has_power() const; + private: + bool _internal_has_power() const; + public: + void clear_power(); + float power() const; + void set_power(float value); + private: + float _internal_power() const; + void _internal_set_power(float value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.PowerParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float shift_; + float power_; + float scale_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class PythonParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.PythonParameter) */ { + public: + inline PythonParameter() : PythonParameter(nullptr) {}; + virtual ~PythonParameter(); + + PythonParameter(const PythonParameter& from); + PythonParameter(PythonParameter&& from) noexcept + : PythonParameter() { + *this = ::std::move(from); + } + + inline PythonParameter& operator=(const PythonParameter& from) { + CopyFrom(from); + return *this; + } + inline PythonParameter& operator=(PythonParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const PythonParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const PythonParameter* internal_default_instance() { + return reinterpret_cast( + &_PythonParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 45; + + friend void swap(PythonParameter& a, PythonParameter& b) { + a.Swap(&b); + } + inline void Swap(PythonParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(PythonParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline PythonParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + PythonParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const PythonParameter& from); + void MergeFrom(const PythonParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(PythonParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.PythonParameter"; + } + protected: + explicit PythonParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kModuleFieldNumber = 1, + kLayerFieldNumber = 2, + kParamStrFieldNumber = 3, + kShareInParallelFieldNumber = 4, + }; + // optional string module = 1; + bool has_module() const; + private: + bool _internal_has_module() const; + public: + void clear_module(); + const std::string& module() const; + void set_module(const std::string& value); + void set_module(std::string&& value); + void set_module(const char* value); + void set_module(const char* value, size_t size); + std::string* mutable_module(); + std::string* release_module(); + void set_allocated_module(std::string* module); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_module(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_module( + std::string* module); + private: + const std::string& _internal_module() const; + void _internal_set_module(const std::string& value); + std::string* _internal_mutable_module(); + public: + + // optional string layer = 2; + bool has_layer() const; + private: + bool _internal_has_layer() const; + public: + void clear_layer(); + const std::string& layer() const; + void set_layer(const std::string& value); + void set_layer(std::string&& value); + void set_layer(const char* value); + void set_layer(const char* value, size_t size); + std::string* mutable_layer(); + std::string* release_layer(); + void set_allocated_layer(std::string* layer); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_layer(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_layer( + std::string* layer); + private: + const std::string& _internal_layer() const; + void _internal_set_layer(const std::string& value); + std::string* _internal_mutable_layer(); + public: + + // optional string param_str = 3 [default = ""]; + bool has_param_str() const; + private: + bool _internal_has_param_str() const; + public: + void clear_param_str(); + const std::string& param_str() const; + void set_param_str(const std::string& value); + void set_param_str(std::string&& value); + void set_param_str(const char* value); + void set_param_str(const char* value, size_t size); + std::string* mutable_param_str(); + std::string* release_param_str(); + void set_allocated_param_str(std::string* param_str); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_param_str(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_param_str( + std::string* param_str); + private: + const std::string& _internal_param_str() const; + void _internal_set_param_str(const std::string& value); + std::string* _internal_mutable_param_str(); + public: + + // optional bool share_in_parallel = 4 [default = false]; + bool has_share_in_parallel() const; + private: + bool _internal_has_share_in_parallel() const; + public: + void clear_share_in_parallel(); + bool share_in_parallel() const; + void set_share_in_parallel(bool value); + private: + bool _internal_share_in_parallel() const; + void _internal_set_share_in_parallel(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.PythonParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr module_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr layer_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr param_str_; + bool share_in_parallel_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class RecurrentParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.RecurrentParameter) */ { + public: + inline RecurrentParameter() : RecurrentParameter(nullptr) {}; + virtual ~RecurrentParameter(); + + RecurrentParameter(const RecurrentParameter& from); + RecurrentParameter(RecurrentParameter&& from) noexcept + : RecurrentParameter() { + *this = ::std::move(from); + } + + inline RecurrentParameter& operator=(const RecurrentParameter& from) { + CopyFrom(from); + return *this; + } + inline RecurrentParameter& operator=(RecurrentParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const RecurrentParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const RecurrentParameter* internal_default_instance() { + return reinterpret_cast( + &_RecurrentParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 46; + + friend void swap(RecurrentParameter& a, RecurrentParameter& b) { + a.Swap(&b); + } + inline void Swap(RecurrentParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(RecurrentParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline RecurrentParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + RecurrentParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const RecurrentParameter& from); + void MergeFrom(const RecurrentParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(RecurrentParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.RecurrentParameter"; + } + protected: + explicit RecurrentParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kWeightFillerFieldNumber = 2, + kBiasFillerFieldNumber = 3, + kNumOutputFieldNumber = 1, + kDebugInfoFieldNumber = 4, + kExposeHiddenFieldNumber = 5, + }; + // optional .caffe.FillerParameter weight_filler = 2; + bool has_weight_filler() const; + private: + bool _internal_has_weight_filler() const; + public: + void clear_weight_filler(); + const ::caffe::FillerParameter& weight_filler() const; + ::caffe::FillerParameter* release_weight_filler(); + ::caffe::FillerParameter* mutable_weight_filler(); + void set_allocated_weight_filler(::caffe::FillerParameter* weight_filler); + private: + const ::caffe::FillerParameter& _internal_weight_filler() const; + ::caffe::FillerParameter* _internal_mutable_weight_filler(); + public: + void unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler); + ::caffe::FillerParameter* unsafe_arena_release_weight_filler(); + + // optional .caffe.FillerParameter bias_filler = 3; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional uint32 num_output = 1 [default = 0]; + bool has_num_output() const; + private: + bool _internal_has_num_output() const; + public: + void clear_num_output(); + ::PROTOBUF_NAMESPACE_ID::uint32 num_output() const; + void set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num_output() const; + void _internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool debug_info = 4 [default = false]; + bool has_debug_info() const; + private: + bool _internal_has_debug_info() const; + public: + void clear_debug_info(); + bool debug_info() const; + void set_debug_info(bool value); + private: + bool _internal_debug_info() const; + void _internal_set_debug_info(bool value); + public: + + // optional bool expose_hidden = 5 [default = false]; + bool has_expose_hidden() const; + private: + bool _internal_has_expose_hidden() const; + public: + void clear_expose_hidden(); + bool expose_hidden() const; + void set_expose_hidden(bool value); + private: + bool _internal_expose_hidden() const; + void _internal_set_expose_hidden(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.RecurrentParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* weight_filler_; + ::caffe::FillerParameter* bias_filler_; + ::PROTOBUF_NAMESPACE_ID::uint32 num_output_; + bool debug_info_; + bool expose_hidden_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ReductionParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ReductionParameter) */ { + public: + inline ReductionParameter() : ReductionParameter(nullptr) {}; + virtual ~ReductionParameter(); + + ReductionParameter(const ReductionParameter& from); + ReductionParameter(ReductionParameter&& from) noexcept + : ReductionParameter() { + *this = ::std::move(from); + } + + inline ReductionParameter& operator=(const ReductionParameter& from) { + CopyFrom(from); + return *this; + } + inline ReductionParameter& operator=(ReductionParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ReductionParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ReductionParameter* internal_default_instance() { + return reinterpret_cast( + &_ReductionParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 47; + + friend void swap(ReductionParameter& a, ReductionParameter& b) { + a.Swap(&b); + } + inline void Swap(ReductionParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ReductionParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ReductionParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ReductionParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ReductionParameter& from); + void MergeFrom(const ReductionParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ReductionParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ReductionParameter"; + } + protected: + explicit ReductionParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef ReductionParameter_ReductionOp ReductionOp; + static constexpr ReductionOp SUM = + ReductionParameter_ReductionOp_SUM; + static constexpr ReductionOp ASUM = + ReductionParameter_ReductionOp_ASUM; + static constexpr ReductionOp SUMSQ = + ReductionParameter_ReductionOp_SUMSQ; + static constexpr ReductionOp MEAN = + ReductionParameter_ReductionOp_MEAN; + static inline bool ReductionOp_IsValid(int value) { + return ReductionParameter_ReductionOp_IsValid(value); + } + static constexpr ReductionOp ReductionOp_MIN = + ReductionParameter_ReductionOp_ReductionOp_MIN; + static constexpr ReductionOp ReductionOp_MAX = + ReductionParameter_ReductionOp_ReductionOp_MAX; + static constexpr int ReductionOp_ARRAYSIZE = + ReductionParameter_ReductionOp_ReductionOp_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + ReductionOp_descriptor() { + return ReductionParameter_ReductionOp_descriptor(); + } + template + static inline const std::string& ReductionOp_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ReductionOp_Name."); + return ReductionParameter_ReductionOp_Name(enum_t_value); + } + static inline bool ReductionOp_Parse(const std::string& name, + ReductionOp* value) { + return ReductionParameter_ReductionOp_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kAxisFieldNumber = 2, + kOperationFieldNumber = 1, + kCoeffFieldNumber = 3, + }; + // optional int32 axis = 2 [default = 0]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional .caffe.ReductionParameter.ReductionOp operation = 1 [default = SUM]; + bool has_operation() const; + private: + bool _internal_has_operation() const; + public: + void clear_operation(); + ::caffe::ReductionParameter_ReductionOp operation() const; + void set_operation(::caffe::ReductionParameter_ReductionOp value); + private: + ::caffe::ReductionParameter_ReductionOp _internal_operation() const; + void _internal_set_operation(::caffe::ReductionParameter_ReductionOp value); + public: + + // optional float coeff = 3 [default = 1]; + bool has_coeff() const; + private: + bool _internal_has_coeff() const; + public: + void clear_coeff(); + float coeff() const; + void set_coeff(float value); + private: + float _internal_coeff() const; + void _internal_set_coeff(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ReductionParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + int operation_; + float coeff_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ReLUParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ReLUParameter) */ { + public: + inline ReLUParameter() : ReLUParameter(nullptr) {}; + virtual ~ReLUParameter(); + + ReLUParameter(const ReLUParameter& from); + ReLUParameter(ReLUParameter&& from) noexcept + : ReLUParameter() { + *this = ::std::move(from); + } + + inline ReLUParameter& operator=(const ReLUParameter& from) { + CopyFrom(from); + return *this; + } + inline ReLUParameter& operator=(ReLUParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ReLUParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ReLUParameter* internal_default_instance() { + return reinterpret_cast( + &_ReLUParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 48; + + friend void swap(ReLUParameter& a, ReLUParameter& b) { + a.Swap(&b); + } + inline void Swap(ReLUParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ReLUParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ReLUParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ReLUParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ReLUParameter& from); + void MergeFrom(const ReLUParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ReLUParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ReLUParameter"; + } + protected: + explicit ReLUParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef ReLUParameter_Engine Engine; + static constexpr Engine DEFAULT = + ReLUParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + ReLUParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + ReLUParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return ReLUParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + ReLUParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + ReLUParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + ReLUParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return ReLUParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return ReLUParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return ReLUParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kNegativeSlopeFieldNumber = 1, + kEngineFieldNumber = 2, + }; + // optional float negative_slope = 1 [default = 0]; + bool has_negative_slope() const; + private: + bool _internal_has_negative_slope() const; + public: + void clear_negative_slope(); + float negative_slope() const; + void set_negative_slope(float value); + private: + float _internal_negative_slope() const; + void _internal_set_negative_slope(float value); + public: + + // optional .caffe.ReLUParameter.Engine engine = 2 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::ReLUParameter_Engine engine() const; + void set_engine(::caffe::ReLUParameter_Engine value); + private: + ::caffe::ReLUParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::ReLUParameter_Engine value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ReLUParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float negative_slope_; + int engine_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ReshapeParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ReshapeParameter) */ { + public: + inline ReshapeParameter() : ReshapeParameter(nullptr) {}; + virtual ~ReshapeParameter(); + + ReshapeParameter(const ReshapeParameter& from); + ReshapeParameter(ReshapeParameter&& from) noexcept + : ReshapeParameter() { + *this = ::std::move(from); + } + + inline ReshapeParameter& operator=(const ReshapeParameter& from) { + CopyFrom(from); + return *this; + } + inline ReshapeParameter& operator=(ReshapeParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ReshapeParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ReshapeParameter* internal_default_instance() { + return reinterpret_cast( + &_ReshapeParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 49; + + friend void swap(ReshapeParameter& a, ReshapeParameter& b) { + a.Swap(&b); + } + inline void Swap(ReshapeParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ReshapeParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ReshapeParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ReshapeParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ReshapeParameter& from); + void MergeFrom(const ReshapeParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ReshapeParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ReshapeParameter"; + } + protected: + explicit ReshapeParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShapeFieldNumber = 1, + kAxisFieldNumber = 2, + kNumAxesFieldNumber = 3, + }; + // optional .caffe.BlobShape shape = 1; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::caffe::BlobShape& shape() const; + ::caffe::BlobShape* release_shape(); + ::caffe::BlobShape* mutable_shape(); + void set_allocated_shape(::caffe::BlobShape* shape); + private: + const ::caffe::BlobShape& _internal_shape() const; + ::caffe::BlobShape* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape); + ::caffe::BlobShape* unsafe_arena_release_shape(); + + // optional int32 axis = 2 [default = 0]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 num_axes = 3 [default = -1]; + bool has_num_axes() const; + private: + bool _internal_has_num_axes() const; + public: + void clear_num_axes(); + ::PROTOBUF_NAMESPACE_ID::int32 num_axes() const; + void set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_num_axes() const; + void _internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ReshapeParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::BlobShape* shape_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + ::PROTOBUF_NAMESPACE_ID::int32 num_axes_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ScaleParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ScaleParameter) */ { + public: + inline ScaleParameter() : ScaleParameter(nullptr) {}; + virtual ~ScaleParameter(); + + ScaleParameter(const ScaleParameter& from); + ScaleParameter(ScaleParameter&& from) noexcept + : ScaleParameter() { + *this = ::std::move(from); + } + + inline ScaleParameter& operator=(const ScaleParameter& from) { + CopyFrom(from); + return *this; + } + inline ScaleParameter& operator=(ScaleParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ScaleParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ScaleParameter* internal_default_instance() { + return reinterpret_cast( + &_ScaleParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 50; + + friend void swap(ScaleParameter& a, ScaleParameter& b) { + a.Swap(&b); + } + inline void Swap(ScaleParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ScaleParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ScaleParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ScaleParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ScaleParameter& from); + void MergeFrom(const ScaleParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ScaleParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ScaleParameter"; + } + protected: + explicit ScaleParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFillerFieldNumber = 3, + kBiasFillerFieldNumber = 5, + kBiasTermFieldNumber = 4, + kAxisFieldNumber = 1, + kNumAxesFieldNumber = 2, + }; + // optional .caffe.FillerParameter filler = 3; + bool has_filler() const; + private: + bool _internal_has_filler() const; + public: + void clear_filler(); + const ::caffe::FillerParameter& filler() const; + ::caffe::FillerParameter* release_filler(); + ::caffe::FillerParameter* mutable_filler(); + void set_allocated_filler(::caffe::FillerParameter* filler); + private: + const ::caffe::FillerParameter& _internal_filler() const; + ::caffe::FillerParameter* _internal_mutable_filler(); + public: + void unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler); + ::caffe::FillerParameter* unsafe_arena_release_filler(); + + // optional .caffe.FillerParameter bias_filler = 5; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional bool bias_term = 4 [default = false]; + bool has_bias_term() const; + private: + bool _internal_has_bias_term() const; + public: + void clear_bias_term(); + bool bias_term() const; + void set_bias_term(bool value); + private: + bool _internal_bias_term() const; + void _internal_set_bias_term(bool value); + public: + + // optional int32 axis = 1 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 num_axes = 2 [default = 1]; + bool has_num_axes() const; + private: + bool _internal_has_num_axes() const; + public: + void clear_num_axes(); + ::PROTOBUF_NAMESPACE_ID::int32 num_axes() const; + void set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_num_axes() const; + void _internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ScaleParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* filler_; + ::caffe::FillerParameter* bias_filler_; + bool bias_term_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + ::PROTOBUF_NAMESPACE_ID::int32 num_axes_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SigmoidParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SigmoidParameter) */ { + public: + inline SigmoidParameter() : SigmoidParameter(nullptr) {}; + virtual ~SigmoidParameter(); + + SigmoidParameter(const SigmoidParameter& from); + SigmoidParameter(SigmoidParameter&& from) noexcept + : SigmoidParameter() { + *this = ::std::move(from); + } + + inline SigmoidParameter& operator=(const SigmoidParameter& from) { + CopyFrom(from); + return *this; + } + inline SigmoidParameter& operator=(SigmoidParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SigmoidParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SigmoidParameter* internal_default_instance() { + return reinterpret_cast( + &_SigmoidParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 51; + + friend void swap(SigmoidParameter& a, SigmoidParameter& b) { + a.Swap(&b); + } + inline void Swap(SigmoidParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SigmoidParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SigmoidParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SigmoidParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SigmoidParameter& from); + void MergeFrom(const SigmoidParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SigmoidParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SigmoidParameter"; + } + protected: + explicit SigmoidParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef SigmoidParameter_Engine Engine; + static constexpr Engine DEFAULT = + SigmoidParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + SigmoidParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + SigmoidParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return SigmoidParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + SigmoidParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + SigmoidParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + SigmoidParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return SigmoidParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return SigmoidParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return SigmoidParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kEngineFieldNumber = 1, + }; + // optional .caffe.SigmoidParameter.Engine engine = 1 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::SigmoidParameter_Engine engine() const; + void set_engine(::caffe::SigmoidParameter_Engine value); + private: + ::caffe::SigmoidParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::SigmoidParameter_Engine value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SigmoidParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int engine_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SliceParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SliceParameter) */ { + public: + inline SliceParameter() : SliceParameter(nullptr) {}; + virtual ~SliceParameter(); + + SliceParameter(const SliceParameter& from); + SliceParameter(SliceParameter&& from) noexcept + : SliceParameter() { + *this = ::std::move(from); + } + + inline SliceParameter& operator=(const SliceParameter& from) { + CopyFrom(from); + return *this; + } + inline SliceParameter& operator=(SliceParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SliceParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SliceParameter* internal_default_instance() { + return reinterpret_cast( + &_SliceParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 52; + + friend void swap(SliceParameter& a, SliceParameter& b) { + a.Swap(&b); + } + inline void Swap(SliceParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SliceParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SliceParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SliceParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SliceParameter& from); + void MergeFrom(const SliceParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SliceParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SliceParameter"; + } + protected: + explicit SliceParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSlicePointFieldNumber = 2, + kSliceDimFieldNumber = 1, + kAxisFieldNumber = 3, + }; + // repeated uint32 slice_point = 2; + int slice_point_size() const; + private: + int _internal_slice_point_size() const; + public: + void clear_slice_point(); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_slice_point(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + _internal_slice_point() const; + void _internal_add_slice_point(::PROTOBUF_NAMESPACE_ID::uint32 value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + _internal_mutable_slice_point(); + public: + ::PROTOBUF_NAMESPACE_ID::uint32 slice_point(int index) const; + void set_slice_point(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value); + void add_slice_point(::PROTOBUF_NAMESPACE_ID::uint32 value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& + slice_point() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* + mutable_slice_point(); + + // optional uint32 slice_dim = 1 [default = 1]; + bool has_slice_dim() const; + private: + bool _internal_has_slice_dim() const; + public: + void clear_slice_dim(); + ::PROTOBUF_NAMESPACE_ID::uint32 slice_dim() const; + void set_slice_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_slice_dim() const; + void _internal_set_slice_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional int32 axis = 3 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SliceParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 > slice_point_; + ::PROTOBUF_NAMESPACE_ID::uint32 slice_dim_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SoftmaxParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SoftmaxParameter) */ { + public: + inline SoftmaxParameter() : SoftmaxParameter(nullptr) {}; + virtual ~SoftmaxParameter(); + + SoftmaxParameter(const SoftmaxParameter& from); + SoftmaxParameter(SoftmaxParameter&& from) noexcept + : SoftmaxParameter() { + *this = ::std::move(from); + } + + inline SoftmaxParameter& operator=(const SoftmaxParameter& from) { + CopyFrom(from); + return *this; + } + inline SoftmaxParameter& operator=(SoftmaxParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SoftmaxParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SoftmaxParameter* internal_default_instance() { + return reinterpret_cast( + &_SoftmaxParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 53; + + friend void swap(SoftmaxParameter& a, SoftmaxParameter& b) { + a.Swap(&b); + } + inline void Swap(SoftmaxParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SoftmaxParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SoftmaxParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SoftmaxParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SoftmaxParameter& from); + void MergeFrom(const SoftmaxParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SoftmaxParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SoftmaxParameter"; + } + protected: + explicit SoftmaxParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef SoftmaxParameter_Engine Engine; + static constexpr Engine DEFAULT = + SoftmaxParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + SoftmaxParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + SoftmaxParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return SoftmaxParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + SoftmaxParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + SoftmaxParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + SoftmaxParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return SoftmaxParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return SoftmaxParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return SoftmaxParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kEngineFieldNumber = 1, + kAxisFieldNumber = 2, + }; + // optional .caffe.SoftmaxParameter.Engine engine = 1 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::SoftmaxParameter_Engine engine() const; + void set_engine(::caffe::SoftmaxParameter_Engine value); + private: + ::caffe::SoftmaxParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::SoftmaxParameter_Engine value); + public: + + // optional int32 axis = 2 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SoftmaxParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int engine_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SwishParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SwishParameter) */ { + public: + inline SwishParameter() : SwishParameter(nullptr) {}; + virtual ~SwishParameter(); + + SwishParameter(const SwishParameter& from); + SwishParameter(SwishParameter&& from) noexcept + : SwishParameter() { + *this = ::std::move(from); + } + + inline SwishParameter& operator=(const SwishParameter& from) { + CopyFrom(from); + return *this; + } + inline SwishParameter& operator=(SwishParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SwishParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SwishParameter* internal_default_instance() { + return reinterpret_cast( + &_SwishParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 54; + + friend void swap(SwishParameter& a, SwishParameter& b) { + a.Swap(&b); + } + inline void Swap(SwishParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SwishParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SwishParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SwishParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SwishParameter& from); + void MergeFrom(const SwishParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SwishParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SwishParameter"; + } + protected: + explicit SwishParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBetaFieldNumber = 1, + }; + // optional float beta = 1 [default = 1]; + bool has_beta() const; + private: + bool _internal_has_beta() const; + public: + void clear_beta(); + float beta() const; + void set_beta(float value); + private: + float _internal_beta() const; + void _internal_set_beta(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SwishParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float beta_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class TanHParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.TanHParameter) */ { + public: + inline TanHParameter() : TanHParameter(nullptr) {}; + virtual ~TanHParameter(); + + TanHParameter(const TanHParameter& from); + TanHParameter(TanHParameter&& from) noexcept + : TanHParameter() { + *this = ::std::move(from); + } + + inline TanHParameter& operator=(const TanHParameter& from) { + CopyFrom(from); + return *this; + } + inline TanHParameter& operator=(TanHParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const TanHParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const TanHParameter* internal_default_instance() { + return reinterpret_cast( + &_TanHParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 55; + + friend void swap(TanHParameter& a, TanHParameter& b) { + a.Swap(&b); + } + inline void Swap(TanHParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TanHParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline TanHParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + TanHParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const TanHParameter& from); + void MergeFrom(const TanHParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TanHParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.TanHParameter"; + } + protected: + explicit TanHParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef TanHParameter_Engine Engine; + static constexpr Engine DEFAULT = + TanHParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + TanHParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + TanHParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return TanHParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + TanHParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + TanHParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + TanHParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return TanHParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return TanHParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return TanHParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kEngineFieldNumber = 1, + }; + // optional .caffe.TanHParameter.Engine engine = 1 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::TanHParameter_Engine engine() const; + void set_engine(::caffe::TanHParameter_Engine value); + private: + ::caffe::TanHParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::TanHParameter_Engine value); + public: + + // @@protoc_insertion_point(class_scope:caffe.TanHParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int engine_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class TileParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.TileParameter) */ { + public: + inline TileParameter() : TileParameter(nullptr) {}; + virtual ~TileParameter(); + + TileParameter(const TileParameter& from); + TileParameter(TileParameter&& from) noexcept + : TileParameter() { + *this = ::std::move(from); + } + + inline TileParameter& operator=(const TileParameter& from) { + CopyFrom(from); + return *this; + } + inline TileParameter& operator=(TileParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const TileParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const TileParameter* internal_default_instance() { + return reinterpret_cast( + &_TileParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 56; + + friend void swap(TileParameter& a, TileParameter& b) { + a.Swap(&b); + } + inline void Swap(TileParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TileParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline TileParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + TileParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const TileParameter& from); + void MergeFrom(const TileParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TileParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.TileParameter"; + } + protected: + explicit TileParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTilesFieldNumber = 2, + kAxisFieldNumber = 1, + }; + // optional int32 tiles = 2; + bool has_tiles() const; + private: + bool _internal_has_tiles() const; + public: + void clear_tiles(); + ::PROTOBUF_NAMESPACE_ID::int32 tiles() const; + void set_tiles(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_tiles() const; + void _internal_set_tiles(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 axis = 1 [default = 1]; + bool has_axis() const; + private: + bool _internal_has_axis() const; + public: + void clear_axis(); + ::PROTOBUF_NAMESPACE_ID::int32 axis() const; + void set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_axis() const; + void _internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // @@protoc_insertion_point(class_scope:caffe.TileParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::int32 tiles_; + ::PROTOBUF_NAMESPACE_ID::int32 axis_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class ThresholdParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.ThresholdParameter) */ { + public: + inline ThresholdParameter() : ThresholdParameter(nullptr) {}; + virtual ~ThresholdParameter(); + + ThresholdParameter(const ThresholdParameter& from); + ThresholdParameter(ThresholdParameter&& from) noexcept + : ThresholdParameter() { + *this = ::std::move(from); + } + + inline ThresholdParameter& operator=(const ThresholdParameter& from) { + CopyFrom(from); + return *this; + } + inline ThresholdParameter& operator=(ThresholdParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const ThresholdParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const ThresholdParameter* internal_default_instance() { + return reinterpret_cast( + &_ThresholdParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 57; + + friend void swap(ThresholdParameter& a, ThresholdParameter& b) { + a.Swap(&b); + } + inline void Swap(ThresholdParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ThresholdParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline ThresholdParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + ThresholdParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const ThresholdParameter& from); + void MergeFrom(const ThresholdParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ThresholdParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.ThresholdParameter"; + } + protected: + explicit ThresholdParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kThresholdFieldNumber = 1, + }; + // optional float threshold = 1 [default = 0]; + bool has_threshold() const; + private: + bool _internal_has_threshold() const; + public: + void clear_threshold(); + float threshold() const; + void set_threshold(float value); + private: + float _internal_threshold() const; + void _internal_set_threshold(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.ThresholdParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + float threshold_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class WindowDataParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.WindowDataParameter) */ { + public: + inline WindowDataParameter() : WindowDataParameter(nullptr) {}; + virtual ~WindowDataParameter(); + + WindowDataParameter(const WindowDataParameter& from); + WindowDataParameter(WindowDataParameter&& from) noexcept + : WindowDataParameter() { + *this = ::std::move(from); + } + + inline WindowDataParameter& operator=(const WindowDataParameter& from) { + CopyFrom(from); + return *this; + } + inline WindowDataParameter& operator=(WindowDataParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const WindowDataParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const WindowDataParameter* internal_default_instance() { + return reinterpret_cast( + &_WindowDataParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 58; + + friend void swap(WindowDataParameter& a, WindowDataParameter& b) { + a.Swap(&b); + } + inline void Swap(WindowDataParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(WindowDataParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline WindowDataParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + WindowDataParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const WindowDataParameter& from); + void MergeFrom(const WindowDataParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(WindowDataParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.WindowDataParameter"; + } + protected: + explicit WindowDataParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSourceFieldNumber = 1, + kMeanFileFieldNumber = 3, + kCropModeFieldNumber = 11, + kRootFolderFieldNumber = 13, + kBatchSizeFieldNumber = 4, + kCropSizeFieldNumber = 5, + kMirrorFieldNumber = 6, + kCacheImagesFieldNumber = 12, + kContextPadFieldNumber = 10, + kScaleFieldNumber = 2, + kFgThresholdFieldNumber = 7, + kBgThresholdFieldNumber = 8, + kFgFractionFieldNumber = 9, + }; + // optional string source = 1; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional string mean_file = 3; + bool has_mean_file() const; + private: + bool _internal_has_mean_file() const; + public: + void clear_mean_file(); + const std::string& mean_file() const; + void set_mean_file(const std::string& value); + void set_mean_file(std::string&& value); + void set_mean_file(const char* value); + void set_mean_file(const char* value, size_t size); + std::string* mutable_mean_file(); + std::string* release_mean_file(); + void set_allocated_mean_file(std::string* mean_file); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_mean_file(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_mean_file( + std::string* mean_file); + private: + const std::string& _internal_mean_file() const; + void _internal_set_mean_file(const std::string& value); + std::string* _internal_mutable_mean_file(); + public: + + // optional string crop_mode = 11 [default = "warp"]; + bool has_crop_mode() const; + private: + bool _internal_has_crop_mode() const; + public: + void clear_crop_mode(); + const std::string& crop_mode() const; + void set_crop_mode(const std::string& value); + void set_crop_mode(std::string&& value); + void set_crop_mode(const char* value); + void set_crop_mode(const char* value, size_t size); + std::string* mutable_crop_mode(); + std::string* release_crop_mode(); + void set_allocated_crop_mode(std::string* crop_mode); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_crop_mode(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_crop_mode( + std::string* crop_mode); + private: + const std::string& _internal_crop_mode() const; + void _internal_set_crop_mode(const std::string& value); + std::string* _internal_mutable_crop_mode(); + public: + + // optional string root_folder = 13 [default = ""]; + bool has_root_folder() const; + private: + bool _internal_has_root_folder() const; + public: + void clear_root_folder(); + const std::string& root_folder() const; + void set_root_folder(const std::string& value); + void set_root_folder(std::string&& value); + void set_root_folder(const char* value); + void set_root_folder(const char* value, size_t size); + std::string* mutable_root_folder(); + std::string* release_root_folder(); + void set_allocated_root_folder(std::string* root_folder); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_root_folder(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_root_folder( + std::string* root_folder); + private: + const std::string& _internal_root_folder() const; + void _internal_set_root_folder(const std::string& value); + std::string* _internal_mutable_root_folder(); + public: + + // optional uint32 batch_size = 4; + bool has_batch_size() const; + private: + bool _internal_has_batch_size() const; + public: + void clear_batch_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size() const; + void set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batch_size() const; + void _internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 crop_size = 5 [default = 0]; + bool has_crop_size() const; + private: + bool _internal_has_crop_size() const; + public: + void clear_crop_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size() const; + void set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_crop_size() const; + void _internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool mirror = 6 [default = false]; + bool has_mirror() const; + private: + bool _internal_has_mirror() const; + public: + void clear_mirror(); + bool mirror() const; + void set_mirror(bool value); + private: + bool _internal_mirror() const; + void _internal_set_mirror(bool value); + public: + + // optional bool cache_images = 12 [default = false]; + bool has_cache_images() const; + private: + bool _internal_has_cache_images() const; + public: + void clear_cache_images(); + bool cache_images() const; + void set_cache_images(bool value); + private: + bool _internal_cache_images() const; + void _internal_set_cache_images(bool value); + public: + + // optional uint32 context_pad = 10 [default = 0]; + bool has_context_pad() const; + private: + bool _internal_has_context_pad() const; + public: + void clear_context_pad(); + ::PROTOBUF_NAMESPACE_ID::uint32 context_pad() const; + void set_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_context_pad() const; + void _internal_set_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional float scale = 2 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // optional float fg_threshold = 7 [default = 0.5]; + bool has_fg_threshold() const; + private: + bool _internal_has_fg_threshold() const; + public: + void clear_fg_threshold(); + float fg_threshold() const; + void set_fg_threshold(float value); + private: + float _internal_fg_threshold() const; + void _internal_set_fg_threshold(float value); + public: + + // optional float bg_threshold = 8 [default = 0.5]; + bool has_bg_threshold() const; + private: + bool _internal_has_bg_threshold() const; + public: + void clear_bg_threshold(); + float bg_threshold() const; + void set_bg_threshold(float value); + private: + float _internal_bg_threshold() const; + void _internal_set_bg_threshold(float value); + public: + + // optional float fg_fraction = 9 [default = 0.25]; + bool has_fg_fraction() const; + private: + bool _internal_has_fg_fraction() const; + public: + void clear_fg_fraction(); + float fg_fraction() const; + void set_fg_fraction(float value); + private: + float _internal_fg_fraction() const; + void _internal_set_fg_fraction(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.WindowDataParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr mean_file_; + public: + static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _i_give_permission_to_break_this_code_default_crop_mode_; + private: + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr crop_mode_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr root_folder_; + ::PROTOBUF_NAMESPACE_ID::uint32 batch_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 crop_size_; + bool mirror_; + bool cache_images_; + ::PROTOBUF_NAMESPACE_ID::uint32 context_pad_; + float scale_; + float fg_threshold_; + float bg_threshold_; + float fg_fraction_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class SPPParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.SPPParameter) */ { + public: + inline SPPParameter() : SPPParameter(nullptr) {}; + virtual ~SPPParameter(); + + SPPParameter(const SPPParameter& from); + SPPParameter(SPPParameter&& from) noexcept + : SPPParameter() { + *this = ::std::move(from); + } + + inline SPPParameter& operator=(const SPPParameter& from) { + CopyFrom(from); + return *this; + } + inline SPPParameter& operator=(SPPParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const SPPParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const SPPParameter* internal_default_instance() { + return reinterpret_cast( + &_SPPParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 59; + + friend void swap(SPPParameter& a, SPPParameter& b) { + a.Swap(&b); + } + inline void Swap(SPPParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SPPParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline SPPParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + SPPParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const SPPParameter& from); + void MergeFrom(const SPPParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(SPPParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.SPPParameter"; + } + protected: + explicit SPPParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef SPPParameter_PoolMethod PoolMethod; + static constexpr PoolMethod MAX = + SPPParameter_PoolMethod_MAX; + static constexpr PoolMethod AVE = + SPPParameter_PoolMethod_AVE; + static constexpr PoolMethod STOCHASTIC = + SPPParameter_PoolMethod_STOCHASTIC; + static inline bool PoolMethod_IsValid(int value) { + return SPPParameter_PoolMethod_IsValid(value); + } + static constexpr PoolMethod PoolMethod_MIN = + SPPParameter_PoolMethod_PoolMethod_MIN; + static constexpr PoolMethod PoolMethod_MAX = + SPPParameter_PoolMethod_PoolMethod_MAX; + static constexpr int PoolMethod_ARRAYSIZE = + SPPParameter_PoolMethod_PoolMethod_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + PoolMethod_descriptor() { + return SPPParameter_PoolMethod_descriptor(); + } + template + static inline const std::string& PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolMethod_Name."); + return SPPParameter_PoolMethod_Name(enum_t_value); + } + static inline bool PoolMethod_Parse(const std::string& name, + PoolMethod* value) { + return SPPParameter_PoolMethod_Parse(name, value); + } + + typedef SPPParameter_Engine Engine; + static constexpr Engine DEFAULT = + SPPParameter_Engine_DEFAULT; + static constexpr Engine CAFFE = + SPPParameter_Engine_CAFFE; + static constexpr Engine CUDNN = + SPPParameter_Engine_CUDNN; + static inline bool Engine_IsValid(int value) { + return SPPParameter_Engine_IsValid(value); + } + static constexpr Engine Engine_MIN = + SPPParameter_Engine_Engine_MIN; + static constexpr Engine Engine_MAX = + SPPParameter_Engine_Engine_MAX; + static constexpr int Engine_ARRAYSIZE = + SPPParameter_Engine_Engine_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Engine_descriptor() { + return SPPParameter_Engine_descriptor(); + } + template + static inline const std::string& Engine_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Engine_Name."); + return SPPParameter_Engine_Name(enum_t_value); + } + static inline bool Engine_Parse(const std::string& name, + Engine* value) { + return SPPParameter_Engine_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kPyramidHeightFieldNumber = 1, + kPoolFieldNumber = 2, + kEngineFieldNumber = 6, + }; + // optional uint32 pyramid_height = 1; + bool has_pyramid_height() const; + private: + bool _internal_has_pyramid_height() const; + public: + void clear_pyramid_height(); + ::PROTOBUF_NAMESPACE_ID::uint32 pyramid_height() const; + void set_pyramid_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pyramid_height() const; + void _internal_set_pyramid_height(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional .caffe.SPPParameter.PoolMethod pool = 2 [default = MAX]; + bool has_pool() const; + private: + bool _internal_has_pool() const; + public: + void clear_pool(); + ::caffe::SPPParameter_PoolMethod pool() const; + void set_pool(::caffe::SPPParameter_PoolMethod value); + private: + ::caffe::SPPParameter_PoolMethod _internal_pool() const; + void _internal_set_pool(::caffe::SPPParameter_PoolMethod value); + public: + + // optional .caffe.SPPParameter.Engine engine = 6 [default = DEFAULT]; + bool has_engine() const; + private: + bool _internal_has_engine() const; + public: + void clear_engine(); + ::caffe::SPPParameter_Engine engine() const; + void set_engine(::caffe::SPPParameter_Engine value); + private: + ::caffe::SPPParameter_Engine _internal_engine() const; + void _internal_set_engine(::caffe::SPPParameter_Engine value); + public: + + // @@protoc_insertion_point(class_scope:caffe.SPPParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::uint32 pyramid_height_; + int pool_; + int engine_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class V1LayerParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.V1LayerParameter) */ { + public: + inline V1LayerParameter() : V1LayerParameter(nullptr) {}; + virtual ~V1LayerParameter(); + + V1LayerParameter(const V1LayerParameter& from); + V1LayerParameter(V1LayerParameter&& from) noexcept + : V1LayerParameter() { + *this = ::std::move(from); + } + + inline V1LayerParameter& operator=(const V1LayerParameter& from) { + CopyFrom(from); + return *this; + } + inline V1LayerParameter& operator=(V1LayerParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const V1LayerParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const V1LayerParameter* internal_default_instance() { + return reinterpret_cast( + &_V1LayerParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 60; + + friend void swap(V1LayerParameter& a, V1LayerParameter& b) { + a.Swap(&b); + } + inline void Swap(V1LayerParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(V1LayerParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline V1LayerParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + V1LayerParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const V1LayerParameter& from); + void MergeFrom(const V1LayerParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(V1LayerParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.V1LayerParameter"; + } + protected: + explicit V1LayerParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef V1LayerParameter_LayerType LayerType; + static constexpr LayerType NONE = + V1LayerParameter_LayerType_NONE; + static constexpr LayerType ABSVAL = + V1LayerParameter_LayerType_ABSVAL; + static constexpr LayerType ACCURACY = + V1LayerParameter_LayerType_ACCURACY; + static constexpr LayerType ARGMAX = + V1LayerParameter_LayerType_ARGMAX; + static constexpr LayerType BNLL = + V1LayerParameter_LayerType_BNLL; + static constexpr LayerType CONCAT = + V1LayerParameter_LayerType_CONCAT; + static constexpr LayerType CONTRASTIVE_LOSS = + V1LayerParameter_LayerType_CONTRASTIVE_LOSS; + static constexpr LayerType CONVOLUTION = + V1LayerParameter_LayerType_CONVOLUTION; + static constexpr LayerType DATA = + V1LayerParameter_LayerType_DATA; + static constexpr LayerType DECONVOLUTION = + V1LayerParameter_LayerType_DECONVOLUTION; + static constexpr LayerType DROPOUT = + V1LayerParameter_LayerType_DROPOUT; + static constexpr LayerType DUMMY_DATA = + V1LayerParameter_LayerType_DUMMY_DATA; + static constexpr LayerType EUCLIDEAN_LOSS = + V1LayerParameter_LayerType_EUCLIDEAN_LOSS; + static constexpr LayerType ELTWISE = + V1LayerParameter_LayerType_ELTWISE; + static constexpr LayerType EXP = + V1LayerParameter_LayerType_EXP; + static constexpr LayerType FLATTEN = + V1LayerParameter_LayerType_FLATTEN; + static constexpr LayerType HDF5_DATA = + V1LayerParameter_LayerType_HDF5_DATA; + static constexpr LayerType HDF5_OUTPUT = + V1LayerParameter_LayerType_HDF5_OUTPUT; + static constexpr LayerType HINGE_LOSS = + V1LayerParameter_LayerType_HINGE_LOSS; + static constexpr LayerType IM2COL = + V1LayerParameter_LayerType_IM2COL; + static constexpr LayerType IMAGE_DATA = + V1LayerParameter_LayerType_IMAGE_DATA; + static constexpr LayerType INFOGAIN_LOSS = + V1LayerParameter_LayerType_INFOGAIN_LOSS; + static constexpr LayerType INNER_PRODUCT = + V1LayerParameter_LayerType_INNER_PRODUCT; + static constexpr LayerType LRN = + V1LayerParameter_LayerType_LRN; + static constexpr LayerType MEMORY_DATA = + V1LayerParameter_LayerType_MEMORY_DATA; + static constexpr LayerType MULTINOMIAL_LOGISTIC_LOSS = + V1LayerParameter_LayerType_MULTINOMIAL_LOGISTIC_LOSS; + static constexpr LayerType MVN = + V1LayerParameter_LayerType_MVN; + static constexpr LayerType POOLING = + V1LayerParameter_LayerType_POOLING; + static constexpr LayerType POWER = + V1LayerParameter_LayerType_POWER; + static constexpr LayerType RELU = + V1LayerParameter_LayerType_RELU; + static constexpr LayerType SIGMOID = + V1LayerParameter_LayerType_SIGMOID; + static constexpr LayerType SIGMOID_CROSS_ENTROPY_LOSS = + V1LayerParameter_LayerType_SIGMOID_CROSS_ENTROPY_LOSS; + static constexpr LayerType SILENCE = + V1LayerParameter_LayerType_SILENCE; + static constexpr LayerType SOFTMAX = + V1LayerParameter_LayerType_SOFTMAX; + static constexpr LayerType SOFTMAX_LOSS = + V1LayerParameter_LayerType_SOFTMAX_LOSS; + static constexpr LayerType SPLIT = + V1LayerParameter_LayerType_SPLIT; + static constexpr LayerType SLICE = + V1LayerParameter_LayerType_SLICE; + static constexpr LayerType TANH = + V1LayerParameter_LayerType_TANH; + static constexpr LayerType WINDOW_DATA = + V1LayerParameter_LayerType_WINDOW_DATA; + static constexpr LayerType THRESHOLD = + V1LayerParameter_LayerType_THRESHOLD; + static inline bool LayerType_IsValid(int value) { + return V1LayerParameter_LayerType_IsValid(value); + } + static constexpr LayerType LayerType_MIN = + V1LayerParameter_LayerType_LayerType_MIN; + static constexpr LayerType LayerType_MAX = + V1LayerParameter_LayerType_LayerType_MAX; + static constexpr int LayerType_ARRAYSIZE = + V1LayerParameter_LayerType_LayerType_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + LayerType_descriptor() { + return V1LayerParameter_LayerType_descriptor(); + } + template + static inline const std::string& LayerType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function LayerType_Name."); + return V1LayerParameter_LayerType_Name(enum_t_value); + } + static inline bool LayerType_Parse(const std::string& name, + LayerType* value) { + return V1LayerParameter_LayerType_Parse(name, value); + } + + typedef V1LayerParameter_DimCheckMode DimCheckMode; + static constexpr DimCheckMode STRICT = + V1LayerParameter_DimCheckMode_STRICT; + static constexpr DimCheckMode PERMISSIVE = + V1LayerParameter_DimCheckMode_PERMISSIVE; + static inline bool DimCheckMode_IsValid(int value) { + return V1LayerParameter_DimCheckMode_IsValid(value); + } + static constexpr DimCheckMode DimCheckMode_MIN = + V1LayerParameter_DimCheckMode_DimCheckMode_MIN; + static constexpr DimCheckMode DimCheckMode_MAX = + V1LayerParameter_DimCheckMode_DimCheckMode_MAX; + static constexpr int DimCheckMode_ARRAYSIZE = + V1LayerParameter_DimCheckMode_DimCheckMode_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + DimCheckMode_descriptor() { + return V1LayerParameter_DimCheckMode_descriptor(); + } + template + static inline const std::string& DimCheckMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DimCheckMode_Name."); + return V1LayerParameter_DimCheckMode_Name(enum_t_value); + } + static inline bool DimCheckMode_Parse(const std::string& name, + DimCheckMode* value) { + return V1LayerParameter_DimCheckMode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kBottomFieldNumber = 2, + kTopFieldNumber = 3, + kBlobsFieldNumber = 6, + kBlobsLrFieldNumber = 7, + kWeightDecayFieldNumber = 8, + kIncludeFieldNumber = 32, + kExcludeFieldNumber = 33, + kLossWeightFieldNumber = 35, + kParamFieldNumber = 1001, + kBlobShareModeFieldNumber = 1002, + kNameFieldNumber = 4, + kLayerFieldNumber = 1, + kConcatParamFieldNumber = 9, + kConvolutionParamFieldNumber = 10, + kDataParamFieldNumber = 11, + kDropoutParamFieldNumber = 12, + kHdf5DataParamFieldNumber = 13, + kHdf5OutputParamFieldNumber = 14, + kImageDataParamFieldNumber = 15, + kInfogainLossParamFieldNumber = 16, + kInnerProductParamFieldNumber = 17, + kLrnParamFieldNumber = 18, + kPoolingParamFieldNumber = 19, + kWindowDataParamFieldNumber = 20, + kPowerParamFieldNumber = 21, + kMemoryDataParamFieldNumber = 22, + kArgmaxParamFieldNumber = 23, + kEltwiseParamFieldNumber = 24, + kThresholdParamFieldNumber = 25, + kDummyDataParamFieldNumber = 26, + kAccuracyParamFieldNumber = 27, + kHingeLossParamFieldNumber = 29, + kReluParamFieldNumber = 30, + kSliceParamFieldNumber = 31, + kMvnParamFieldNumber = 34, + kTransformParamFieldNumber = 36, + kTanhParamFieldNumber = 37, + kSigmoidParamFieldNumber = 38, + kSoftmaxParamFieldNumber = 39, + kContrastiveLossParamFieldNumber = 40, + kExpParamFieldNumber = 41, + kLossParamFieldNumber = 42, + kTypeFieldNumber = 5, + }; + // repeated string bottom = 2; + int bottom_size() const; + private: + int _internal_bottom_size() const; + public: + void clear_bottom(); + const std::string& bottom(int index) const; + std::string* mutable_bottom(int index); + void set_bottom(int index, const std::string& value); + void set_bottom(int index, std::string&& value); + void set_bottom(int index, const char* value); + void set_bottom(int index, const char* value, size_t size); + std::string* add_bottom(); + void add_bottom(const std::string& value); + void add_bottom(std::string&& value); + void add_bottom(const char* value); + void add_bottom(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& bottom() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_bottom(); + private: + const std::string& _internal_bottom(int index) const; + std::string* _internal_add_bottom(); + public: + + // repeated string top = 3; + int top_size() const; + private: + int _internal_top_size() const; + public: + void clear_top(); + const std::string& top(int index) const; + std::string* mutable_top(int index); + void set_top(int index, const std::string& value); + void set_top(int index, std::string&& value); + void set_top(int index, const char* value); + void set_top(int index, const char* value, size_t size); + std::string* add_top(); + void add_top(const std::string& value); + void add_top(std::string&& value); + void add_top(const char* value); + void add_top(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& top() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_top(); + private: + const std::string& _internal_top(int index) const; + std::string* _internal_add_top(); + public: + + // repeated .caffe.BlobProto blobs = 6; + int blobs_size() const; + private: + int _internal_blobs_size() const; + public: + void clear_blobs(); + ::caffe::BlobProto* mutable_blobs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* + mutable_blobs(); + private: + const ::caffe::BlobProto& _internal_blobs(int index) const; + ::caffe::BlobProto* _internal_add_blobs(); + public: + const ::caffe::BlobProto& blobs(int index) const; + ::caffe::BlobProto* add_blobs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& + blobs() const; + + // repeated float blobs_lr = 7; + int blobs_lr_size() const; + private: + int _internal_blobs_lr_size() const; + public: + void clear_blobs_lr(); + private: + float _internal_blobs_lr(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_blobs_lr() const; + void _internal_add_blobs_lr(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_blobs_lr(); + public: + float blobs_lr(int index) const; + void set_blobs_lr(int index, float value); + void add_blobs_lr(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + blobs_lr() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_blobs_lr(); + + // repeated float weight_decay = 8; + int weight_decay_size() const; + private: + int _internal_weight_decay_size() const; + public: + void clear_weight_decay(); + private: + float _internal_weight_decay(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_weight_decay() const; + void _internal_add_weight_decay(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_weight_decay(); + public: + float weight_decay(int index) const; + void set_weight_decay(int index, float value); + void add_weight_decay(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + weight_decay() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_weight_decay(); + + // repeated .caffe.NetStateRule include = 32; + int include_size() const; + private: + int _internal_include_size() const; + public: + void clear_include(); + ::caffe::NetStateRule* mutable_include(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* + mutable_include(); + private: + const ::caffe::NetStateRule& _internal_include(int index) const; + ::caffe::NetStateRule* _internal_add_include(); + public: + const ::caffe::NetStateRule& include(int index) const; + ::caffe::NetStateRule* add_include(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& + include() const; + + // repeated .caffe.NetStateRule exclude = 33; + int exclude_size() const; + private: + int _internal_exclude_size() const; + public: + void clear_exclude(); + ::caffe::NetStateRule* mutable_exclude(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* + mutable_exclude(); + private: + const ::caffe::NetStateRule& _internal_exclude(int index) const; + ::caffe::NetStateRule* _internal_add_exclude(); + public: + const ::caffe::NetStateRule& exclude(int index) const; + ::caffe::NetStateRule* add_exclude(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& + exclude() const; + + // repeated float loss_weight = 35; + int loss_weight_size() const; + private: + int _internal_loss_weight_size() const; + public: + void clear_loss_weight(); + private: + float _internal_loss_weight(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_loss_weight() const; + void _internal_add_loss_weight(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_loss_weight(); + public: + float loss_weight(int index) const; + void set_loss_weight(int index, float value); + void add_loss_weight(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + loss_weight() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_loss_weight(); + + // repeated string param = 1001; + int param_size() const; + private: + int _internal_param_size() const; + public: + void clear_param(); + const std::string& param(int index) const; + std::string* mutable_param(int index); + void set_param(int index, const std::string& value); + void set_param(int index, std::string&& value); + void set_param(int index, const char* value); + void set_param(int index, const char* value, size_t size); + std::string* add_param(); + void add_param(const std::string& value); + void add_param(std::string&& value); + void add_param(const char* value); + void add_param(const char* value, size_t size); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& param() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* mutable_param(); + private: + const std::string& _internal_param(int index) const; + std::string* _internal_add_param(); + public: + + // repeated .caffe.V1LayerParameter.DimCheckMode blob_share_mode = 1002; + int blob_share_mode_size() const; + private: + int _internal_blob_share_mode_size() const; + public: + void clear_blob_share_mode(); + private: + ::caffe::V1LayerParameter_DimCheckMode _internal_blob_share_mode(int index) const; + void _internal_add_blob_share_mode(::caffe::V1LayerParameter_DimCheckMode value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_blob_share_mode(); + public: + ::caffe::V1LayerParameter_DimCheckMode blob_share_mode(int index) const; + void set_blob_share_mode(int index, ::caffe::V1LayerParameter_DimCheckMode value); + void add_blob_share_mode(::caffe::V1LayerParameter_DimCheckMode value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& blob_share_mode() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_blob_share_mode(); + + // optional string name = 4; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // optional .caffe.V0LayerParameter layer = 1; + bool has_layer() const; + private: + bool _internal_has_layer() const; + public: + void clear_layer(); + const ::caffe::V0LayerParameter& layer() const; + ::caffe::V0LayerParameter* release_layer(); + ::caffe::V0LayerParameter* mutable_layer(); + void set_allocated_layer(::caffe::V0LayerParameter* layer); + private: + const ::caffe::V0LayerParameter& _internal_layer() const; + ::caffe::V0LayerParameter* _internal_mutable_layer(); + public: + void unsafe_arena_set_allocated_layer( + ::caffe::V0LayerParameter* layer); + ::caffe::V0LayerParameter* unsafe_arena_release_layer(); + + // optional .caffe.ConcatParameter concat_param = 9; + bool has_concat_param() const; + private: + bool _internal_has_concat_param() const; + public: + void clear_concat_param(); + const ::caffe::ConcatParameter& concat_param() const; + ::caffe::ConcatParameter* release_concat_param(); + ::caffe::ConcatParameter* mutable_concat_param(); + void set_allocated_concat_param(::caffe::ConcatParameter* concat_param); + private: + const ::caffe::ConcatParameter& _internal_concat_param() const; + ::caffe::ConcatParameter* _internal_mutable_concat_param(); + public: + void unsafe_arena_set_allocated_concat_param( + ::caffe::ConcatParameter* concat_param); + ::caffe::ConcatParameter* unsafe_arena_release_concat_param(); + + // optional .caffe.ConvolutionParameter convolution_param = 10; + bool has_convolution_param() const; + private: + bool _internal_has_convolution_param() const; + public: + void clear_convolution_param(); + const ::caffe::ConvolutionParameter& convolution_param() const; + ::caffe::ConvolutionParameter* release_convolution_param(); + ::caffe::ConvolutionParameter* mutable_convolution_param(); + void set_allocated_convolution_param(::caffe::ConvolutionParameter* convolution_param); + private: + const ::caffe::ConvolutionParameter& _internal_convolution_param() const; + ::caffe::ConvolutionParameter* _internal_mutable_convolution_param(); + public: + void unsafe_arena_set_allocated_convolution_param( + ::caffe::ConvolutionParameter* convolution_param); + ::caffe::ConvolutionParameter* unsafe_arena_release_convolution_param(); + + // optional .caffe.DataParameter data_param = 11; + bool has_data_param() const; + private: + bool _internal_has_data_param() const; + public: + void clear_data_param(); + const ::caffe::DataParameter& data_param() const; + ::caffe::DataParameter* release_data_param(); + ::caffe::DataParameter* mutable_data_param(); + void set_allocated_data_param(::caffe::DataParameter* data_param); + private: + const ::caffe::DataParameter& _internal_data_param() const; + ::caffe::DataParameter* _internal_mutable_data_param(); + public: + void unsafe_arena_set_allocated_data_param( + ::caffe::DataParameter* data_param); + ::caffe::DataParameter* unsafe_arena_release_data_param(); + + // optional .caffe.DropoutParameter dropout_param = 12; + bool has_dropout_param() const; + private: + bool _internal_has_dropout_param() const; + public: + void clear_dropout_param(); + const ::caffe::DropoutParameter& dropout_param() const; + ::caffe::DropoutParameter* release_dropout_param(); + ::caffe::DropoutParameter* mutable_dropout_param(); + void set_allocated_dropout_param(::caffe::DropoutParameter* dropout_param); + private: + const ::caffe::DropoutParameter& _internal_dropout_param() const; + ::caffe::DropoutParameter* _internal_mutable_dropout_param(); + public: + void unsafe_arena_set_allocated_dropout_param( + ::caffe::DropoutParameter* dropout_param); + ::caffe::DropoutParameter* unsafe_arena_release_dropout_param(); + + // optional .caffe.HDF5DataParameter hdf5_data_param = 13; + bool has_hdf5_data_param() const; + private: + bool _internal_has_hdf5_data_param() const; + public: + void clear_hdf5_data_param(); + const ::caffe::HDF5DataParameter& hdf5_data_param() const; + ::caffe::HDF5DataParameter* release_hdf5_data_param(); + ::caffe::HDF5DataParameter* mutable_hdf5_data_param(); + void set_allocated_hdf5_data_param(::caffe::HDF5DataParameter* hdf5_data_param); + private: + const ::caffe::HDF5DataParameter& _internal_hdf5_data_param() const; + ::caffe::HDF5DataParameter* _internal_mutable_hdf5_data_param(); + public: + void unsafe_arena_set_allocated_hdf5_data_param( + ::caffe::HDF5DataParameter* hdf5_data_param); + ::caffe::HDF5DataParameter* unsafe_arena_release_hdf5_data_param(); + + // optional .caffe.HDF5OutputParameter hdf5_output_param = 14; + bool has_hdf5_output_param() const; + private: + bool _internal_has_hdf5_output_param() const; + public: + void clear_hdf5_output_param(); + const ::caffe::HDF5OutputParameter& hdf5_output_param() const; + ::caffe::HDF5OutputParameter* release_hdf5_output_param(); + ::caffe::HDF5OutputParameter* mutable_hdf5_output_param(); + void set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param); + private: + const ::caffe::HDF5OutputParameter& _internal_hdf5_output_param() const; + ::caffe::HDF5OutputParameter* _internal_mutable_hdf5_output_param(); + public: + void unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param); + ::caffe::HDF5OutputParameter* unsafe_arena_release_hdf5_output_param(); + + // optional .caffe.ImageDataParameter image_data_param = 15; + bool has_image_data_param() const; + private: + bool _internal_has_image_data_param() const; + public: + void clear_image_data_param(); + const ::caffe::ImageDataParameter& image_data_param() const; + ::caffe::ImageDataParameter* release_image_data_param(); + ::caffe::ImageDataParameter* mutable_image_data_param(); + void set_allocated_image_data_param(::caffe::ImageDataParameter* image_data_param); + private: + const ::caffe::ImageDataParameter& _internal_image_data_param() const; + ::caffe::ImageDataParameter* _internal_mutable_image_data_param(); + public: + void unsafe_arena_set_allocated_image_data_param( + ::caffe::ImageDataParameter* image_data_param); + ::caffe::ImageDataParameter* unsafe_arena_release_image_data_param(); + + // optional .caffe.InfogainLossParameter infogain_loss_param = 16; + bool has_infogain_loss_param() const; + private: + bool _internal_has_infogain_loss_param() const; + public: + void clear_infogain_loss_param(); + const ::caffe::InfogainLossParameter& infogain_loss_param() const; + ::caffe::InfogainLossParameter* release_infogain_loss_param(); + ::caffe::InfogainLossParameter* mutable_infogain_loss_param(); + void set_allocated_infogain_loss_param(::caffe::InfogainLossParameter* infogain_loss_param); + private: + const ::caffe::InfogainLossParameter& _internal_infogain_loss_param() const; + ::caffe::InfogainLossParameter* _internal_mutable_infogain_loss_param(); + public: + void unsafe_arena_set_allocated_infogain_loss_param( + ::caffe::InfogainLossParameter* infogain_loss_param); + ::caffe::InfogainLossParameter* unsafe_arena_release_infogain_loss_param(); + + // optional .caffe.InnerProductParameter inner_product_param = 17; + bool has_inner_product_param() const; + private: + bool _internal_has_inner_product_param() const; + public: + void clear_inner_product_param(); + const ::caffe::InnerProductParameter& inner_product_param() const; + ::caffe::InnerProductParameter* release_inner_product_param(); + ::caffe::InnerProductParameter* mutable_inner_product_param(); + void set_allocated_inner_product_param(::caffe::InnerProductParameter* inner_product_param); + private: + const ::caffe::InnerProductParameter& _internal_inner_product_param() const; + ::caffe::InnerProductParameter* _internal_mutable_inner_product_param(); + public: + void unsafe_arena_set_allocated_inner_product_param( + ::caffe::InnerProductParameter* inner_product_param); + ::caffe::InnerProductParameter* unsafe_arena_release_inner_product_param(); + + // optional .caffe.LRNParameter lrn_param = 18; + bool has_lrn_param() const; + private: + bool _internal_has_lrn_param() const; + public: + void clear_lrn_param(); + const ::caffe::LRNParameter& lrn_param() const; + ::caffe::LRNParameter* release_lrn_param(); + ::caffe::LRNParameter* mutable_lrn_param(); + void set_allocated_lrn_param(::caffe::LRNParameter* lrn_param); + private: + const ::caffe::LRNParameter& _internal_lrn_param() const; + ::caffe::LRNParameter* _internal_mutable_lrn_param(); + public: + void unsafe_arena_set_allocated_lrn_param( + ::caffe::LRNParameter* lrn_param); + ::caffe::LRNParameter* unsafe_arena_release_lrn_param(); + + // optional .caffe.PoolingParameter pooling_param = 19; + bool has_pooling_param() const; + private: + bool _internal_has_pooling_param() const; + public: + void clear_pooling_param(); + const ::caffe::PoolingParameter& pooling_param() const; + ::caffe::PoolingParameter* release_pooling_param(); + ::caffe::PoolingParameter* mutable_pooling_param(); + void set_allocated_pooling_param(::caffe::PoolingParameter* pooling_param); + private: + const ::caffe::PoolingParameter& _internal_pooling_param() const; + ::caffe::PoolingParameter* _internal_mutable_pooling_param(); + public: + void unsafe_arena_set_allocated_pooling_param( + ::caffe::PoolingParameter* pooling_param); + ::caffe::PoolingParameter* unsafe_arena_release_pooling_param(); + + // optional .caffe.WindowDataParameter window_data_param = 20; + bool has_window_data_param() const; + private: + bool _internal_has_window_data_param() const; + public: + void clear_window_data_param(); + const ::caffe::WindowDataParameter& window_data_param() const; + ::caffe::WindowDataParameter* release_window_data_param(); + ::caffe::WindowDataParameter* mutable_window_data_param(); + void set_allocated_window_data_param(::caffe::WindowDataParameter* window_data_param); + private: + const ::caffe::WindowDataParameter& _internal_window_data_param() const; + ::caffe::WindowDataParameter* _internal_mutable_window_data_param(); + public: + void unsafe_arena_set_allocated_window_data_param( + ::caffe::WindowDataParameter* window_data_param); + ::caffe::WindowDataParameter* unsafe_arena_release_window_data_param(); + + // optional .caffe.PowerParameter power_param = 21; + bool has_power_param() const; + private: + bool _internal_has_power_param() const; + public: + void clear_power_param(); + const ::caffe::PowerParameter& power_param() const; + ::caffe::PowerParameter* release_power_param(); + ::caffe::PowerParameter* mutable_power_param(); + void set_allocated_power_param(::caffe::PowerParameter* power_param); + private: + const ::caffe::PowerParameter& _internal_power_param() const; + ::caffe::PowerParameter* _internal_mutable_power_param(); + public: + void unsafe_arena_set_allocated_power_param( + ::caffe::PowerParameter* power_param); + ::caffe::PowerParameter* unsafe_arena_release_power_param(); + + // optional .caffe.MemoryDataParameter memory_data_param = 22; + bool has_memory_data_param() const; + private: + bool _internal_has_memory_data_param() const; + public: + void clear_memory_data_param(); + const ::caffe::MemoryDataParameter& memory_data_param() const; + ::caffe::MemoryDataParameter* release_memory_data_param(); + ::caffe::MemoryDataParameter* mutable_memory_data_param(); + void set_allocated_memory_data_param(::caffe::MemoryDataParameter* memory_data_param); + private: + const ::caffe::MemoryDataParameter& _internal_memory_data_param() const; + ::caffe::MemoryDataParameter* _internal_mutable_memory_data_param(); + public: + void unsafe_arena_set_allocated_memory_data_param( + ::caffe::MemoryDataParameter* memory_data_param); + ::caffe::MemoryDataParameter* unsafe_arena_release_memory_data_param(); + + // optional .caffe.ArgMaxParameter argmax_param = 23; + bool has_argmax_param() const; + private: + bool _internal_has_argmax_param() const; + public: + void clear_argmax_param(); + const ::caffe::ArgMaxParameter& argmax_param() const; + ::caffe::ArgMaxParameter* release_argmax_param(); + ::caffe::ArgMaxParameter* mutable_argmax_param(); + void set_allocated_argmax_param(::caffe::ArgMaxParameter* argmax_param); + private: + const ::caffe::ArgMaxParameter& _internal_argmax_param() const; + ::caffe::ArgMaxParameter* _internal_mutable_argmax_param(); + public: + void unsafe_arena_set_allocated_argmax_param( + ::caffe::ArgMaxParameter* argmax_param); + ::caffe::ArgMaxParameter* unsafe_arena_release_argmax_param(); + + // optional .caffe.EltwiseParameter eltwise_param = 24; + bool has_eltwise_param() const; + private: + bool _internal_has_eltwise_param() const; + public: + void clear_eltwise_param(); + const ::caffe::EltwiseParameter& eltwise_param() const; + ::caffe::EltwiseParameter* release_eltwise_param(); + ::caffe::EltwiseParameter* mutable_eltwise_param(); + void set_allocated_eltwise_param(::caffe::EltwiseParameter* eltwise_param); + private: + const ::caffe::EltwiseParameter& _internal_eltwise_param() const; + ::caffe::EltwiseParameter* _internal_mutable_eltwise_param(); + public: + void unsafe_arena_set_allocated_eltwise_param( + ::caffe::EltwiseParameter* eltwise_param); + ::caffe::EltwiseParameter* unsafe_arena_release_eltwise_param(); + + // optional .caffe.ThresholdParameter threshold_param = 25; + bool has_threshold_param() const; + private: + bool _internal_has_threshold_param() const; + public: + void clear_threshold_param(); + const ::caffe::ThresholdParameter& threshold_param() const; + ::caffe::ThresholdParameter* release_threshold_param(); + ::caffe::ThresholdParameter* mutable_threshold_param(); + void set_allocated_threshold_param(::caffe::ThresholdParameter* threshold_param); + private: + const ::caffe::ThresholdParameter& _internal_threshold_param() const; + ::caffe::ThresholdParameter* _internal_mutable_threshold_param(); + public: + void unsafe_arena_set_allocated_threshold_param( + ::caffe::ThresholdParameter* threshold_param); + ::caffe::ThresholdParameter* unsafe_arena_release_threshold_param(); + + // optional .caffe.DummyDataParameter dummy_data_param = 26; + bool has_dummy_data_param() const; + private: + bool _internal_has_dummy_data_param() const; + public: + void clear_dummy_data_param(); + const ::caffe::DummyDataParameter& dummy_data_param() const; + ::caffe::DummyDataParameter* release_dummy_data_param(); + ::caffe::DummyDataParameter* mutable_dummy_data_param(); + void set_allocated_dummy_data_param(::caffe::DummyDataParameter* dummy_data_param); + private: + const ::caffe::DummyDataParameter& _internal_dummy_data_param() const; + ::caffe::DummyDataParameter* _internal_mutable_dummy_data_param(); + public: + void unsafe_arena_set_allocated_dummy_data_param( + ::caffe::DummyDataParameter* dummy_data_param); + ::caffe::DummyDataParameter* unsafe_arena_release_dummy_data_param(); + + // optional .caffe.AccuracyParameter accuracy_param = 27; + bool has_accuracy_param() const; + private: + bool _internal_has_accuracy_param() const; + public: + void clear_accuracy_param(); + const ::caffe::AccuracyParameter& accuracy_param() const; + ::caffe::AccuracyParameter* release_accuracy_param(); + ::caffe::AccuracyParameter* mutable_accuracy_param(); + void set_allocated_accuracy_param(::caffe::AccuracyParameter* accuracy_param); + private: + const ::caffe::AccuracyParameter& _internal_accuracy_param() const; + ::caffe::AccuracyParameter* _internal_mutable_accuracy_param(); + public: + void unsafe_arena_set_allocated_accuracy_param( + ::caffe::AccuracyParameter* accuracy_param); + ::caffe::AccuracyParameter* unsafe_arena_release_accuracy_param(); + + // optional .caffe.HingeLossParameter hinge_loss_param = 29; + bool has_hinge_loss_param() const; + private: + bool _internal_has_hinge_loss_param() const; + public: + void clear_hinge_loss_param(); + const ::caffe::HingeLossParameter& hinge_loss_param() const; + ::caffe::HingeLossParameter* release_hinge_loss_param(); + ::caffe::HingeLossParameter* mutable_hinge_loss_param(); + void set_allocated_hinge_loss_param(::caffe::HingeLossParameter* hinge_loss_param); + private: + const ::caffe::HingeLossParameter& _internal_hinge_loss_param() const; + ::caffe::HingeLossParameter* _internal_mutable_hinge_loss_param(); + public: + void unsafe_arena_set_allocated_hinge_loss_param( + ::caffe::HingeLossParameter* hinge_loss_param); + ::caffe::HingeLossParameter* unsafe_arena_release_hinge_loss_param(); + + // optional .caffe.ReLUParameter relu_param = 30; + bool has_relu_param() const; + private: + bool _internal_has_relu_param() const; + public: + void clear_relu_param(); + const ::caffe::ReLUParameter& relu_param() const; + ::caffe::ReLUParameter* release_relu_param(); + ::caffe::ReLUParameter* mutable_relu_param(); + void set_allocated_relu_param(::caffe::ReLUParameter* relu_param); + private: + const ::caffe::ReLUParameter& _internal_relu_param() const; + ::caffe::ReLUParameter* _internal_mutable_relu_param(); + public: + void unsafe_arena_set_allocated_relu_param( + ::caffe::ReLUParameter* relu_param); + ::caffe::ReLUParameter* unsafe_arena_release_relu_param(); + + // optional .caffe.SliceParameter slice_param = 31; + bool has_slice_param() const; + private: + bool _internal_has_slice_param() const; + public: + void clear_slice_param(); + const ::caffe::SliceParameter& slice_param() const; + ::caffe::SliceParameter* release_slice_param(); + ::caffe::SliceParameter* mutable_slice_param(); + void set_allocated_slice_param(::caffe::SliceParameter* slice_param); + private: + const ::caffe::SliceParameter& _internal_slice_param() const; + ::caffe::SliceParameter* _internal_mutable_slice_param(); + public: + void unsafe_arena_set_allocated_slice_param( + ::caffe::SliceParameter* slice_param); + ::caffe::SliceParameter* unsafe_arena_release_slice_param(); + + // optional .caffe.MVNParameter mvn_param = 34; + bool has_mvn_param() const; + private: + bool _internal_has_mvn_param() const; + public: + void clear_mvn_param(); + const ::caffe::MVNParameter& mvn_param() const; + ::caffe::MVNParameter* release_mvn_param(); + ::caffe::MVNParameter* mutable_mvn_param(); + void set_allocated_mvn_param(::caffe::MVNParameter* mvn_param); + private: + const ::caffe::MVNParameter& _internal_mvn_param() const; + ::caffe::MVNParameter* _internal_mutable_mvn_param(); + public: + void unsafe_arena_set_allocated_mvn_param( + ::caffe::MVNParameter* mvn_param); + ::caffe::MVNParameter* unsafe_arena_release_mvn_param(); + + // optional .caffe.TransformationParameter transform_param = 36; + bool has_transform_param() const; + private: + bool _internal_has_transform_param() const; + public: + void clear_transform_param(); + const ::caffe::TransformationParameter& transform_param() const; + ::caffe::TransformationParameter* release_transform_param(); + ::caffe::TransformationParameter* mutable_transform_param(); + void set_allocated_transform_param(::caffe::TransformationParameter* transform_param); + private: + const ::caffe::TransformationParameter& _internal_transform_param() const; + ::caffe::TransformationParameter* _internal_mutable_transform_param(); + public: + void unsafe_arena_set_allocated_transform_param( + ::caffe::TransformationParameter* transform_param); + ::caffe::TransformationParameter* unsafe_arena_release_transform_param(); + + // optional .caffe.TanHParameter tanh_param = 37; + bool has_tanh_param() const; + private: + bool _internal_has_tanh_param() const; + public: + void clear_tanh_param(); + const ::caffe::TanHParameter& tanh_param() const; + ::caffe::TanHParameter* release_tanh_param(); + ::caffe::TanHParameter* mutable_tanh_param(); + void set_allocated_tanh_param(::caffe::TanHParameter* tanh_param); + private: + const ::caffe::TanHParameter& _internal_tanh_param() const; + ::caffe::TanHParameter* _internal_mutable_tanh_param(); + public: + void unsafe_arena_set_allocated_tanh_param( + ::caffe::TanHParameter* tanh_param); + ::caffe::TanHParameter* unsafe_arena_release_tanh_param(); + + // optional .caffe.SigmoidParameter sigmoid_param = 38; + bool has_sigmoid_param() const; + private: + bool _internal_has_sigmoid_param() const; + public: + void clear_sigmoid_param(); + const ::caffe::SigmoidParameter& sigmoid_param() const; + ::caffe::SigmoidParameter* release_sigmoid_param(); + ::caffe::SigmoidParameter* mutable_sigmoid_param(); + void set_allocated_sigmoid_param(::caffe::SigmoidParameter* sigmoid_param); + private: + const ::caffe::SigmoidParameter& _internal_sigmoid_param() const; + ::caffe::SigmoidParameter* _internal_mutable_sigmoid_param(); + public: + void unsafe_arena_set_allocated_sigmoid_param( + ::caffe::SigmoidParameter* sigmoid_param); + ::caffe::SigmoidParameter* unsafe_arena_release_sigmoid_param(); + + // optional .caffe.SoftmaxParameter softmax_param = 39; + bool has_softmax_param() const; + private: + bool _internal_has_softmax_param() const; + public: + void clear_softmax_param(); + const ::caffe::SoftmaxParameter& softmax_param() const; + ::caffe::SoftmaxParameter* release_softmax_param(); + ::caffe::SoftmaxParameter* mutable_softmax_param(); + void set_allocated_softmax_param(::caffe::SoftmaxParameter* softmax_param); + private: + const ::caffe::SoftmaxParameter& _internal_softmax_param() const; + ::caffe::SoftmaxParameter* _internal_mutable_softmax_param(); + public: + void unsafe_arena_set_allocated_softmax_param( + ::caffe::SoftmaxParameter* softmax_param); + ::caffe::SoftmaxParameter* unsafe_arena_release_softmax_param(); + + // optional .caffe.ContrastiveLossParameter contrastive_loss_param = 40; + bool has_contrastive_loss_param() const; + private: + bool _internal_has_contrastive_loss_param() const; + public: + void clear_contrastive_loss_param(); + const ::caffe::ContrastiveLossParameter& contrastive_loss_param() const; + ::caffe::ContrastiveLossParameter* release_contrastive_loss_param(); + ::caffe::ContrastiveLossParameter* mutable_contrastive_loss_param(); + void set_allocated_contrastive_loss_param(::caffe::ContrastiveLossParameter* contrastive_loss_param); + private: + const ::caffe::ContrastiveLossParameter& _internal_contrastive_loss_param() const; + ::caffe::ContrastiveLossParameter* _internal_mutable_contrastive_loss_param(); + public: + void unsafe_arena_set_allocated_contrastive_loss_param( + ::caffe::ContrastiveLossParameter* contrastive_loss_param); + ::caffe::ContrastiveLossParameter* unsafe_arena_release_contrastive_loss_param(); + + // optional .caffe.ExpParameter exp_param = 41; + bool has_exp_param() const; + private: + bool _internal_has_exp_param() const; + public: + void clear_exp_param(); + const ::caffe::ExpParameter& exp_param() const; + ::caffe::ExpParameter* release_exp_param(); + ::caffe::ExpParameter* mutable_exp_param(); + void set_allocated_exp_param(::caffe::ExpParameter* exp_param); + private: + const ::caffe::ExpParameter& _internal_exp_param() const; + ::caffe::ExpParameter* _internal_mutable_exp_param(); + public: + void unsafe_arena_set_allocated_exp_param( + ::caffe::ExpParameter* exp_param); + ::caffe::ExpParameter* unsafe_arena_release_exp_param(); + + // optional .caffe.LossParameter loss_param = 42; + bool has_loss_param() const; + private: + bool _internal_has_loss_param() const; + public: + void clear_loss_param(); + const ::caffe::LossParameter& loss_param() const; + ::caffe::LossParameter* release_loss_param(); + ::caffe::LossParameter* mutable_loss_param(); + void set_allocated_loss_param(::caffe::LossParameter* loss_param); + private: + const ::caffe::LossParameter& _internal_loss_param() const; + ::caffe::LossParameter* _internal_mutable_loss_param(); + public: + void unsafe_arena_set_allocated_loss_param( + ::caffe::LossParameter* loss_param); + ::caffe::LossParameter* unsafe_arena_release_loss_param(); + + // optional .caffe.V1LayerParameter.LayerType type = 5; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + ::caffe::V1LayerParameter_LayerType type() const; + void set_type(::caffe::V1LayerParameter_LayerType value); + private: + ::caffe::V1LayerParameter_LayerType _internal_type() const; + void _internal_set_type(::caffe::V1LayerParameter_LayerType value); + public: + + // @@protoc_insertion_point(class_scope:caffe.V1LayerParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<2> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField bottom_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField top_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto > blobs_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > blobs_lr_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > weight_decay_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule > include_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule > exclude_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > loss_weight_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField param_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField blob_share_mode_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::caffe::V0LayerParameter* layer_; + ::caffe::ConcatParameter* concat_param_; + ::caffe::ConvolutionParameter* convolution_param_; + ::caffe::DataParameter* data_param_; + ::caffe::DropoutParameter* dropout_param_; + ::caffe::HDF5DataParameter* hdf5_data_param_; + ::caffe::HDF5OutputParameter* hdf5_output_param_; + ::caffe::ImageDataParameter* image_data_param_; + ::caffe::InfogainLossParameter* infogain_loss_param_; + ::caffe::InnerProductParameter* inner_product_param_; + ::caffe::LRNParameter* lrn_param_; + ::caffe::PoolingParameter* pooling_param_; + ::caffe::WindowDataParameter* window_data_param_; + ::caffe::PowerParameter* power_param_; + ::caffe::MemoryDataParameter* memory_data_param_; + ::caffe::ArgMaxParameter* argmax_param_; + ::caffe::EltwiseParameter* eltwise_param_; + ::caffe::ThresholdParameter* threshold_param_; + ::caffe::DummyDataParameter* dummy_data_param_; + ::caffe::AccuracyParameter* accuracy_param_; + ::caffe::HingeLossParameter* hinge_loss_param_; + ::caffe::ReLUParameter* relu_param_; + ::caffe::SliceParameter* slice_param_; + ::caffe::MVNParameter* mvn_param_; + ::caffe::TransformationParameter* transform_param_; + ::caffe::TanHParameter* tanh_param_; + ::caffe::SigmoidParameter* sigmoid_param_; + ::caffe::SoftmaxParameter* softmax_param_; + ::caffe::ContrastiveLossParameter* contrastive_loss_param_; + ::caffe::ExpParameter* exp_param_; + ::caffe::LossParameter* loss_param_; + int type_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class V0LayerParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.V0LayerParameter) */ { + public: + inline V0LayerParameter() : V0LayerParameter(nullptr) {}; + virtual ~V0LayerParameter(); + + V0LayerParameter(const V0LayerParameter& from); + V0LayerParameter(V0LayerParameter&& from) noexcept + : V0LayerParameter() { + *this = ::std::move(from); + } + + inline V0LayerParameter& operator=(const V0LayerParameter& from) { + CopyFrom(from); + return *this; + } + inline V0LayerParameter& operator=(V0LayerParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const V0LayerParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const V0LayerParameter* internal_default_instance() { + return reinterpret_cast( + &_V0LayerParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 61; + + friend void swap(V0LayerParameter& a, V0LayerParameter& b) { + a.Swap(&b); + } + inline void Swap(V0LayerParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(V0LayerParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline V0LayerParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + V0LayerParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const V0LayerParameter& from); + void MergeFrom(const V0LayerParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(V0LayerParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.V0LayerParameter"; + } + protected: + explicit V0LayerParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + typedef V0LayerParameter_PoolMethod PoolMethod; + static constexpr PoolMethod MAX = + V0LayerParameter_PoolMethod_MAX; + static constexpr PoolMethod AVE = + V0LayerParameter_PoolMethod_AVE; + static constexpr PoolMethod STOCHASTIC = + V0LayerParameter_PoolMethod_STOCHASTIC; + static inline bool PoolMethod_IsValid(int value) { + return V0LayerParameter_PoolMethod_IsValid(value); + } + static constexpr PoolMethod PoolMethod_MIN = + V0LayerParameter_PoolMethod_PoolMethod_MIN; + static constexpr PoolMethod PoolMethod_MAX = + V0LayerParameter_PoolMethod_PoolMethod_MAX; + static constexpr int PoolMethod_ARRAYSIZE = + V0LayerParameter_PoolMethod_PoolMethod_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + PoolMethod_descriptor() { + return V0LayerParameter_PoolMethod_descriptor(); + } + template + static inline const std::string& PoolMethod_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function PoolMethod_Name."); + return V0LayerParameter_PoolMethod_Name(enum_t_value); + } + static inline bool PoolMethod_Parse(const std::string& name, + PoolMethod* value) { + return V0LayerParameter_PoolMethod_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kBlobsFieldNumber = 50, + kBlobsLrFieldNumber = 51, + kWeightDecayFieldNumber = 52, + kNameFieldNumber = 1, + kTypeFieldNumber = 2, + kSourceFieldNumber = 16, + kMeanfileFieldNumber = 18, + kDetCropModeFieldNumber = 59, + kWeightFillerFieldNumber = 5, + kBiasFillerFieldNumber = 6, + kHdf5OutputParamFieldNumber = 1001, + kNumOutputFieldNumber = 3, + kPadFieldNumber = 7, + kKernelsizeFieldNumber = 8, + kPoolFieldNumber = 11, + kBatchsizeFieldNumber = 19, + kCropsizeFieldNumber = 20, + kNewWidthFieldNumber = 63, + kMirrorFieldNumber = 21, + kShuffleImagesFieldNumber = 64, + kRandSkipFieldNumber = 53, + kDetContextPadFieldNumber = 58, + kNewNumFieldNumber = 60, + kNewChannelsFieldNumber = 61, + kNewHeightFieldNumber = 62, + kConcatDimFieldNumber = 65, + kBiastermFieldNumber = 4, + kGroupFieldNumber = 9, + kStrideFieldNumber = 10, + kDropoutRatioFieldNumber = 12, + kLocalSizeFieldNumber = 13, + kAlphaFieldNumber = 14, + kBetaFieldNumber = 15, + kScaleFieldNumber = 17, + kKFieldNumber = 22, + kDetFgThresholdFieldNumber = 54, + kDetBgThresholdFieldNumber = 55, + kDetFgFractionFieldNumber = 56, + }; + // repeated .caffe.BlobProto blobs = 50; + int blobs_size() const; + private: + int _internal_blobs_size() const; + public: + void clear_blobs(); + ::caffe::BlobProto* mutable_blobs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* + mutable_blobs(); + private: + const ::caffe::BlobProto& _internal_blobs(int index) const; + ::caffe::BlobProto* _internal_add_blobs(); + public: + const ::caffe::BlobProto& blobs(int index) const; + ::caffe::BlobProto* add_blobs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& + blobs() const; + + // repeated float blobs_lr = 51; + int blobs_lr_size() const; + private: + int _internal_blobs_lr_size() const; + public: + void clear_blobs_lr(); + private: + float _internal_blobs_lr(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_blobs_lr() const; + void _internal_add_blobs_lr(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_blobs_lr(); + public: + float blobs_lr(int index) const; + void set_blobs_lr(int index, float value); + void add_blobs_lr(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + blobs_lr() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_blobs_lr(); + + // repeated float weight_decay = 52; + int weight_decay_size() const; + private: + int _internal_weight_decay_size() const; + public: + void clear_weight_decay(); + private: + float _internal_weight_decay(int index) const; + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + _internal_weight_decay() const; + void _internal_add_weight_decay(float value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + _internal_mutable_weight_decay(); + public: + float weight_decay(int index) const; + void set_weight_decay(int index, float value); + void add_weight_decay(float value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& + weight_decay() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* + mutable_weight_decay(); + + // optional string name = 1; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + const std::string& name() const; + void set_name(const std::string& value); + void set_name(std::string&& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + std::string* mutable_name(); + std::string* release_name(); + void set_allocated_name(std::string* name); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_name(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_name( + std::string* name); + private: + const std::string& _internal_name() const; + void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // optional string type = 2; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + const std::string& type() const; + void set_type(const std::string& value); + void set_type(std::string&& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + std::string* mutable_type(); + std::string* release_type(); + void set_allocated_type(std::string* type); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_type(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_type( + std::string* type); + private: + const std::string& _internal_type() const; + void _internal_set_type(const std::string& value); + std::string* _internal_mutable_type(); + public: + + // optional string source = 16; + bool has_source() const; + private: + bool _internal_has_source() const; + public: + void clear_source(); + const std::string& source() const; + void set_source(const std::string& value); + void set_source(std::string&& value); + void set_source(const char* value); + void set_source(const char* value, size_t size); + std::string* mutable_source(); + std::string* release_source(); + void set_allocated_source(std::string* source); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_source(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_source( + std::string* source); + private: + const std::string& _internal_source() const; + void _internal_set_source(const std::string& value); + std::string* _internal_mutable_source(); + public: + + // optional string meanfile = 18; + bool has_meanfile() const; + private: + bool _internal_has_meanfile() const; + public: + void clear_meanfile(); + const std::string& meanfile() const; + void set_meanfile(const std::string& value); + void set_meanfile(std::string&& value); + void set_meanfile(const char* value); + void set_meanfile(const char* value, size_t size); + std::string* mutable_meanfile(); + std::string* release_meanfile(); + void set_allocated_meanfile(std::string* meanfile); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_meanfile(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_meanfile( + std::string* meanfile); + private: + const std::string& _internal_meanfile() const; + void _internal_set_meanfile(const std::string& value); + std::string* _internal_mutable_meanfile(); + public: + + // optional string det_crop_mode = 59 [default = "warp"]; + bool has_det_crop_mode() const; + private: + bool _internal_has_det_crop_mode() const; + public: + void clear_det_crop_mode(); + const std::string& det_crop_mode() const; + void set_det_crop_mode(const std::string& value); + void set_det_crop_mode(std::string&& value); + void set_det_crop_mode(const char* value); + void set_det_crop_mode(const char* value, size_t size); + std::string* mutable_det_crop_mode(); + std::string* release_det_crop_mode(); + void set_allocated_det_crop_mode(std::string* det_crop_mode); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + std::string* unsafe_arena_release_det_crop_mode(); + GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" + " string fields are deprecated and will be removed in a" + " future release.") + void unsafe_arena_set_allocated_det_crop_mode( + std::string* det_crop_mode); + private: + const std::string& _internal_det_crop_mode() const; + void _internal_set_det_crop_mode(const std::string& value); + std::string* _internal_mutable_det_crop_mode(); + public: + + // optional .caffe.FillerParameter weight_filler = 5; + bool has_weight_filler() const; + private: + bool _internal_has_weight_filler() const; + public: + void clear_weight_filler(); + const ::caffe::FillerParameter& weight_filler() const; + ::caffe::FillerParameter* release_weight_filler(); + ::caffe::FillerParameter* mutable_weight_filler(); + void set_allocated_weight_filler(::caffe::FillerParameter* weight_filler); + private: + const ::caffe::FillerParameter& _internal_weight_filler() const; + ::caffe::FillerParameter* _internal_mutable_weight_filler(); + public: + void unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler); + ::caffe::FillerParameter* unsafe_arena_release_weight_filler(); + + // optional .caffe.FillerParameter bias_filler = 6; + bool has_bias_filler() const; + private: + bool _internal_has_bias_filler() const; + public: + void clear_bias_filler(); + const ::caffe::FillerParameter& bias_filler() const; + ::caffe::FillerParameter* release_bias_filler(); + ::caffe::FillerParameter* mutable_bias_filler(); + void set_allocated_bias_filler(::caffe::FillerParameter* bias_filler); + private: + const ::caffe::FillerParameter& _internal_bias_filler() const; + ::caffe::FillerParameter* _internal_mutable_bias_filler(); + public: + void unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler); + ::caffe::FillerParameter* unsafe_arena_release_bias_filler(); + + // optional .caffe.HDF5OutputParameter hdf5_output_param = 1001; + bool has_hdf5_output_param() const; + private: + bool _internal_has_hdf5_output_param() const; + public: + void clear_hdf5_output_param(); + const ::caffe::HDF5OutputParameter& hdf5_output_param() const; + ::caffe::HDF5OutputParameter* release_hdf5_output_param(); + ::caffe::HDF5OutputParameter* mutable_hdf5_output_param(); + void set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param); + private: + const ::caffe::HDF5OutputParameter& _internal_hdf5_output_param() const; + ::caffe::HDF5OutputParameter* _internal_mutable_hdf5_output_param(); + public: + void unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param); + ::caffe::HDF5OutputParameter* unsafe_arena_release_hdf5_output_param(); + + // optional uint32 num_output = 3; + bool has_num_output() const; + private: + bool _internal_has_num_output() const; + public: + void clear_num_output(); + ::PROTOBUF_NAMESPACE_ID::uint32 num_output() const; + void set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_num_output() const; + void _internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 pad = 7 [default = 0]; + bool has_pad() const; + private: + bool _internal_has_pad() const; + public: + void clear_pad(); + ::PROTOBUF_NAMESPACE_ID::uint32 pad() const; + void set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_pad() const; + void _internal_set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 kernelsize = 8; + bool has_kernelsize() const; + private: + bool _internal_has_kernelsize() const; + public: + void clear_kernelsize(); + ::PROTOBUF_NAMESPACE_ID::uint32 kernelsize() const; + void set_kernelsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_kernelsize() const; + void _internal_set_kernelsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional .caffe.V0LayerParameter.PoolMethod pool = 11 [default = MAX]; + bool has_pool() const; + private: + bool _internal_has_pool() const; + public: + void clear_pool(); + ::caffe::V0LayerParameter_PoolMethod pool() const; + void set_pool(::caffe::V0LayerParameter_PoolMethod value); + private: + ::caffe::V0LayerParameter_PoolMethod _internal_pool() const; + void _internal_set_pool(::caffe::V0LayerParameter_PoolMethod value); + public: + + // optional uint32 batchsize = 19; + bool has_batchsize() const; + private: + bool _internal_has_batchsize() const; + public: + void clear_batchsize(); + ::PROTOBUF_NAMESPACE_ID::uint32 batchsize() const; + void set_batchsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_batchsize() const; + void _internal_set_batchsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 cropsize = 20 [default = 0]; + bool has_cropsize() const; + private: + bool _internal_has_cropsize() const; + public: + void clear_cropsize(); + ::PROTOBUF_NAMESPACE_ID::uint32 cropsize() const; + void set_cropsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_cropsize() const; + void _internal_set_cropsize(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional int32 new_width = 63 [default = 0]; + bool has_new_width() const; + private: + bool _internal_has_new_width() const; + public: + void clear_new_width(); + ::PROTOBUF_NAMESPACE_ID::int32 new_width() const; + void set_new_width(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_new_width() const; + void _internal_set_new_width(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional bool mirror = 21 [default = false]; + bool has_mirror() const; + private: + bool _internal_has_mirror() const; + public: + void clear_mirror(); + bool mirror() const; + void set_mirror(bool value); + private: + bool _internal_mirror() const; + void _internal_set_mirror(bool value); + public: + + // optional bool shuffle_images = 64 [default = false]; + bool has_shuffle_images() const; + private: + bool _internal_has_shuffle_images() const; + public: + void clear_shuffle_images(); + bool shuffle_images() const; + void set_shuffle_images(bool value); + private: + bool _internal_shuffle_images() const; + void _internal_set_shuffle_images(bool value); + public: + + // optional uint32 rand_skip = 53 [default = 0]; + bool has_rand_skip() const; + private: + bool _internal_has_rand_skip() const; + public: + void clear_rand_skip(); + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip() const; + void set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_rand_skip() const; + void _internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 det_context_pad = 58 [default = 0]; + bool has_det_context_pad() const; + private: + bool _internal_has_det_context_pad() const; + public: + void clear_det_context_pad(); + ::PROTOBUF_NAMESPACE_ID::uint32 det_context_pad() const; + void set_det_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_det_context_pad() const; + void _internal_set_det_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional int32 new_num = 60 [default = 0]; + bool has_new_num() const; + private: + bool _internal_has_new_num() const; + public: + void clear_new_num(); + ::PROTOBUF_NAMESPACE_ID::int32 new_num() const; + void set_new_num(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_new_num() const; + void _internal_set_new_num(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 new_channels = 61 [default = 0]; + bool has_new_channels() const; + private: + bool _internal_has_new_channels() const; + public: + void clear_new_channels(); + ::PROTOBUF_NAMESPACE_ID::int32 new_channels() const; + void set_new_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_new_channels() const; + void _internal_set_new_channels(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional int32 new_height = 62 [default = 0]; + bool has_new_height() const; + private: + bool _internal_has_new_height() const; + public: + void clear_new_height(); + ::PROTOBUF_NAMESPACE_ID::int32 new_height() const; + void set_new_height(::PROTOBUF_NAMESPACE_ID::int32 value); + private: + ::PROTOBUF_NAMESPACE_ID::int32 _internal_new_height() const; + void _internal_set_new_height(::PROTOBUF_NAMESPACE_ID::int32 value); + public: + + // optional uint32 concat_dim = 65 [default = 1]; + bool has_concat_dim() const; + private: + bool _internal_has_concat_dim() const; + public: + void clear_concat_dim(); + ::PROTOBUF_NAMESPACE_ID::uint32 concat_dim() const; + void set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_concat_dim() const; + void _internal_set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional bool biasterm = 4 [default = true]; + bool has_biasterm() const; + private: + bool _internal_has_biasterm() const; + public: + void clear_biasterm(); + bool biasterm() const; + void set_biasterm(bool value); + private: + bool _internal_biasterm() const; + void _internal_set_biasterm(bool value); + public: + + // optional uint32 group = 9 [default = 1]; + bool has_group() const; + private: + bool _internal_has_group() const; + public: + void clear_group(); + ::PROTOBUF_NAMESPACE_ID::uint32 group() const; + void set_group(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_group() const; + void _internal_set_group(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional uint32 stride = 10 [default = 1]; + bool has_stride() const; + private: + bool _internal_has_stride() const; + public: + void clear_stride(); + ::PROTOBUF_NAMESPACE_ID::uint32 stride() const; + void set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_stride() const; + void _internal_set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional float dropout_ratio = 12 [default = 0.5]; + bool has_dropout_ratio() const; + private: + bool _internal_has_dropout_ratio() const; + public: + void clear_dropout_ratio(); + float dropout_ratio() const; + void set_dropout_ratio(float value); + private: + float _internal_dropout_ratio() const; + void _internal_set_dropout_ratio(float value); + public: + + // optional uint32 local_size = 13 [default = 5]; + bool has_local_size() const; + private: + bool _internal_has_local_size() const; + public: + void clear_local_size(); + ::PROTOBUF_NAMESPACE_ID::uint32 local_size() const; + void set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint32 _internal_local_size() const; + void _internal_set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value); + public: + + // optional float alpha = 14 [default = 1]; + bool has_alpha() const; + private: + bool _internal_has_alpha() const; + public: + void clear_alpha(); + float alpha() const; + void set_alpha(float value); + private: + float _internal_alpha() const; + void _internal_set_alpha(float value); + public: + + // optional float beta = 15 [default = 0.75]; + bool has_beta() const; + private: + bool _internal_has_beta() const; + public: + void clear_beta(); + float beta() const; + void set_beta(float value); + private: + float _internal_beta() const; + void _internal_set_beta(float value); + public: + + // optional float scale = 17 [default = 1]; + bool has_scale() const; + private: + bool _internal_has_scale() const; + public: + void clear_scale(); + float scale() const; + void set_scale(float value); + private: + float _internal_scale() const; + void _internal_set_scale(float value); + public: + + // optional float k = 22 [default = 1]; + bool has_k() const; + private: + bool _internal_has_k() const; + public: + void clear_k(); + float k() const; + void set_k(float value); + private: + float _internal_k() const; + void _internal_set_k(float value); + public: + + // optional float det_fg_threshold = 54 [default = 0.5]; + bool has_det_fg_threshold() const; + private: + bool _internal_has_det_fg_threshold() const; + public: + void clear_det_fg_threshold(); + float det_fg_threshold() const; + void set_det_fg_threshold(float value); + private: + float _internal_det_fg_threshold() const; + void _internal_set_det_fg_threshold(float value); + public: + + // optional float det_bg_threshold = 55 [default = 0.5]; + bool has_det_bg_threshold() const; + private: + bool _internal_has_det_bg_threshold() const; + public: + void clear_det_bg_threshold(); + float det_bg_threshold() const; + void set_det_bg_threshold(float value); + private: + float _internal_det_bg_threshold() const; + void _internal_set_det_bg_threshold(float value); + public: + + // optional float det_fg_fraction = 56 [default = 0.25]; + bool has_det_fg_fraction() const; + private: + bool _internal_has_det_fg_fraction() const; + public: + void clear_det_fg_fraction(); + float det_fg_fraction() const; + void set_det_fg_fraction(float value); + private: + float _internal_det_fg_fraction() const; + void _internal_set_det_fg_fraction(float value); + public: + + // @@protoc_insertion_point(class_scope:caffe.V0LayerParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<2> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto > blobs_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > blobs_lr_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > weight_decay_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr meanfile_; + public: + static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _i_give_permission_to_break_this_code_default_det_crop_mode_; + private: + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr det_crop_mode_; + ::caffe::FillerParameter* weight_filler_; + ::caffe::FillerParameter* bias_filler_; + ::caffe::HDF5OutputParameter* hdf5_output_param_; + ::PROTOBUF_NAMESPACE_ID::uint32 num_output_; + ::PROTOBUF_NAMESPACE_ID::uint32 pad_; + ::PROTOBUF_NAMESPACE_ID::uint32 kernelsize_; + int pool_; + ::PROTOBUF_NAMESPACE_ID::uint32 batchsize_; + ::PROTOBUF_NAMESPACE_ID::uint32 cropsize_; + ::PROTOBUF_NAMESPACE_ID::int32 new_width_; + bool mirror_; + bool shuffle_images_; + ::PROTOBUF_NAMESPACE_ID::uint32 rand_skip_; + ::PROTOBUF_NAMESPACE_ID::uint32 det_context_pad_; + ::PROTOBUF_NAMESPACE_ID::int32 new_num_; + ::PROTOBUF_NAMESPACE_ID::int32 new_channels_; + ::PROTOBUF_NAMESPACE_ID::int32 new_height_; + ::PROTOBUF_NAMESPACE_ID::uint32 concat_dim_; + bool biasterm_; + ::PROTOBUF_NAMESPACE_ID::uint32 group_; + ::PROTOBUF_NAMESPACE_ID::uint32 stride_; + float dropout_ratio_; + ::PROTOBUF_NAMESPACE_ID::uint32 local_size_; + float alpha_; + float beta_; + float scale_; + float k_; + float det_fg_threshold_; + float det_bg_threshold_; + float det_fg_fraction_; + friend struct ::TableStruct_caffe_2eproto; +}; +// ------------------------------------------------------------------- + +class PReLUParameter PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:caffe.PReLUParameter) */ { + public: + inline PReLUParameter() : PReLUParameter(nullptr) {}; + virtual ~PReLUParameter(); + + PReLUParameter(const PReLUParameter& from); + PReLUParameter(PReLUParameter&& from) noexcept + : PReLUParameter() { + *this = ::std::move(from); + } + + inline PReLUParameter& operator=(const PReLUParameter& from) { + CopyFrom(from); + return *this; + } + inline PReLUParameter& operator=(PReLUParameter&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const PReLUParameter& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const PReLUParameter* internal_default_instance() { + return reinterpret_cast( + &_PReLUParameter_default_instance_); + } + static constexpr int kIndexInFileMessages = + 62; + + friend void swap(PReLUParameter& a, PReLUParameter& b) { + a.Swap(&b); + } + inline void Swap(PReLUParameter* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(PReLUParameter* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline PReLUParameter* New() const final { + return CreateMaybeMessage(nullptr); + } + + PReLUParameter* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const PReLUParameter& from); + void MergeFrom(const PReLUParameter& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(PReLUParameter* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "caffe.PReLUParameter"; + } + protected: + explicit PReLUParameter(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_caffe_2eproto); + return ::descriptor_table_caffe_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFillerFieldNumber = 1, + kChannelSharedFieldNumber = 2, + }; + // optional .caffe.FillerParameter filler = 1; + bool has_filler() const; + private: + bool _internal_has_filler() const; + public: + void clear_filler(); + const ::caffe::FillerParameter& filler() const; + ::caffe::FillerParameter* release_filler(); + ::caffe::FillerParameter* mutable_filler(); + void set_allocated_filler(::caffe::FillerParameter* filler); + private: + const ::caffe::FillerParameter& _internal_filler() const; + ::caffe::FillerParameter* _internal_mutable_filler(); + public: + void unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler); + ::caffe::FillerParameter* unsafe_arena_release_filler(); + + // optional bool channel_shared = 2 [default = false]; + bool has_channel_shared() const; + private: + bool _internal_has_channel_shared() const; + public: + void clear_channel_shared(); + bool channel_shared() const; + void set_channel_shared(bool value); + private: + bool _internal_channel_shared() const; + void _internal_set_channel_shared(bool value); + public: + + // @@protoc_insertion_point(class_scope:caffe.PReLUParameter) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::caffe::FillerParameter* filler_; + bool channel_shared_; + friend struct ::TableStruct_caffe_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// BlobShape + +// repeated int64 dim = 1 [packed = true]; +inline int BlobShape::_internal_dim_size() const { + return dim_.size(); +} +inline int BlobShape::dim_size() const { + return _internal_dim_size(); +} +inline void BlobShape::clear_dim() { + dim_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::int64 BlobShape::_internal_dim(int index) const { + return dim_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::int64 BlobShape::dim(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobShape.dim) + return _internal_dim(index); +} +inline void BlobShape::set_dim(int index, ::PROTOBUF_NAMESPACE_ID::int64 value) { + dim_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.BlobShape.dim) +} +inline void BlobShape::_internal_add_dim(::PROTOBUF_NAMESPACE_ID::int64 value) { + dim_.Add(value); +} +inline void BlobShape::add_dim(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_add_dim(value); + // @@protoc_insertion_point(field_add:caffe.BlobShape.dim) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& +BlobShape::_internal_dim() const { + return dim_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >& +BlobShape::dim() const { + // @@protoc_insertion_point(field_list:caffe.BlobShape.dim) + return _internal_dim(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* +BlobShape::_internal_mutable_dim() { + return &dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int64 >* +BlobShape::mutable_dim() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobShape.dim) + return _internal_mutable_dim(); +} + +// ------------------------------------------------------------------- + +// BlobProto + +// optional .caffe.BlobShape shape = 7; +inline bool BlobProto::_internal_has_shape() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || shape_ != nullptr); + return value; +} +inline bool BlobProto::has_shape() const { + return _internal_has_shape(); +} +inline void BlobProto::clear_shape() { + if (shape_ != nullptr) shape_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::BlobShape& BlobProto::_internal_shape() const { + const ::caffe::BlobShape* p = shape_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_BlobShape_default_instance_); +} +inline const ::caffe::BlobShape& BlobProto::shape() const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.shape) + return _internal_shape(); +} +inline void BlobProto::unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape_); + } + shape_ = shape; + if (shape) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.BlobProto.shape) +} +inline ::caffe::BlobShape* BlobProto::release_shape() { + auto temp = unsafe_arena_release_shape(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::BlobShape* BlobProto::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:caffe.BlobProto.shape) + _has_bits_[0] &= ~0x00000001u; + ::caffe::BlobShape* temp = shape_; + shape_ = nullptr; + return temp; +} +inline ::caffe::BlobShape* BlobProto::_internal_mutable_shape() { + _has_bits_[0] |= 0x00000001u; + if (shape_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::BlobShape>(GetArena()); + shape_ = p; + } + return shape_; +} +inline ::caffe::BlobShape* BlobProto::mutable_shape() { + // @@protoc_insertion_point(field_mutable:caffe.BlobProto.shape) + return _internal_mutable_shape(); +} +inline void BlobProto::set_allocated_shape(::caffe::BlobShape* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete shape_; + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(shape); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:caffe.BlobProto.shape) +} + +// repeated float data = 5 [packed = true]; +inline int BlobProto::_internal_data_size() const { + return data_.size(); +} +inline int BlobProto::data_size() const { + return _internal_data_size(); +} +inline void BlobProto::clear_data() { + data_.Clear(); +} +inline float BlobProto::_internal_data(int index) const { + return data_.Get(index); +} +inline float BlobProto::data(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.data) + return _internal_data(index); +} +inline void BlobProto::set_data(int index, float value) { + data_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.data) +} +inline void BlobProto::_internal_add_data(float value) { + data_.Add(value); +} +inline void BlobProto::add_data(float value) { + _internal_add_data(value); + // @@protoc_insertion_point(field_add:caffe.BlobProto.data) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +BlobProto::_internal_data() const { + return data_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +BlobProto::data() const { + // @@protoc_insertion_point(field_list:caffe.BlobProto.data) + return _internal_data(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +BlobProto::_internal_mutable_data() { + return &data_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +BlobProto::mutable_data() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobProto.data) + return _internal_mutable_data(); +} + +// repeated float diff = 6 [packed = true]; +inline int BlobProto::_internal_diff_size() const { + return diff_.size(); +} +inline int BlobProto::diff_size() const { + return _internal_diff_size(); +} +inline void BlobProto::clear_diff() { + diff_.Clear(); +} +inline float BlobProto::_internal_diff(int index) const { + return diff_.Get(index); +} +inline float BlobProto::diff(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.diff) + return _internal_diff(index); +} +inline void BlobProto::set_diff(int index, float value) { + diff_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.diff) +} +inline void BlobProto::_internal_add_diff(float value) { + diff_.Add(value); +} +inline void BlobProto::add_diff(float value) { + _internal_add_diff(value); + // @@protoc_insertion_point(field_add:caffe.BlobProto.diff) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +BlobProto::_internal_diff() const { + return diff_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +BlobProto::diff() const { + // @@protoc_insertion_point(field_list:caffe.BlobProto.diff) + return _internal_diff(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +BlobProto::_internal_mutable_diff() { + return &diff_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +BlobProto::mutable_diff() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobProto.diff) + return _internal_mutable_diff(); +} + +// repeated double double_data = 8 [packed = true]; +inline int BlobProto::_internal_double_data_size() const { + return double_data_.size(); +} +inline int BlobProto::double_data_size() const { + return _internal_double_data_size(); +} +inline void BlobProto::clear_double_data() { + double_data_.Clear(); +} +inline double BlobProto::_internal_double_data(int index) const { + return double_data_.Get(index); +} +inline double BlobProto::double_data(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.double_data) + return _internal_double_data(index); +} +inline void BlobProto::set_double_data(int index, double value) { + double_data_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.double_data) +} +inline void BlobProto::_internal_add_double_data(double value) { + double_data_.Add(value); +} +inline void BlobProto::add_double_data(double value) { + _internal_add_double_data(value); + // @@protoc_insertion_point(field_add:caffe.BlobProto.double_data) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& +BlobProto::_internal_double_data() const { + return double_data_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& +BlobProto::double_data() const { + // @@protoc_insertion_point(field_list:caffe.BlobProto.double_data) + return _internal_double_data(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* +BlobProto::_internal_mutable_double_data() { + return &double_data_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* +BlobProto::mutable_double_data() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobProto.double_data) + return _internal_mutable_double_data(); +} + +// repeated double double_diff = 9 [packed = true]; +inline int BlobProto::_internal_double_diff_size() const { + return double_diff_.size(); +} +inline int BlobProto::double_diff_size() const { + return _internal_double_diff_size(); +} +inline void BlobProto::clear_double_diff() { + double_diff_.Clear(); +} +inline double BlobProto::_internal_double_diff(int index) const { + return double_diff_.Get(index); +} +inline double BlobProto::double_diff(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.double_diff) + return _internal_double_diff(index); +} +inline void BlobProto::set_double_diff(int index, double value) { + double_diff_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.double_diff) +} +inline void BlobProto::_internal_add_double_diff(double value) { + double_diff_.Add(value); +} +inline void BlobProto::add_double_diff(double value) { + _internal_add_double_diff(value); + // @@protoc_insertion_point(field_add:caffe.BlobProto.double_diff) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& +BlobProto::_internal_double_diff() const { + return double_diff_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& +BlobProto::double_diff() const { + // @@protoc_insertion_point(field_list:caffe.BlobProto.double_diff) + return _internal_double_diff(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* +BlobProto::_internal_mutable_double_diff() { + return &double_diff_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* +BlobProto::mutable_double_diff() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobProto.double_diff) + return _internal_mutable_double_diff(); +} + +// optional int32 num = 1 [default = 0]; +inline bool BlobProto::_internal_has_num() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool BlobProto::has_num() const { + return _internal_has_num(); +} +inline void BlobProto::clear_num() { + num_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::_internal_num() const { + return num_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::num() const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.num) + return _internal_num(); +} +inline void BlobProto::_internal_set_num(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + num_ = value; +} +inline void BlobProto::set_num(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_num(value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.num) +} + +// optional int32 channels = 2 [default = 0]; +inline bool BlobProto::_internal_has_channels() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool BlobProto::has_channels() const { + return _internal_has_channels(); +} +inline void BlobProto::clear_channels() { + channels_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::_internal_channels() const { + return channels_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::channels() const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.channels) + return _internal_channels(); +} +inline void BlobProto::_internal_set_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + channels_ = value; +} +inline void BlobProto::set_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_channels(value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.channels) +} + +// optional int32 height = 3 [default = 0]; +inline bool BlobProto::_internal_has_height() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool BlobProto::has_height() const { + return _internal_has_height(); +} +inline void BlobProto::clear_height() { + height_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::_internal_height() const { + return height_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::height() const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.height) + return _internal_height(); +} +inline void BlobProto::_internal_set_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000008u; + height_ = value; +} +inline void BlobProto::set_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_height(value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.height) +} + +// optional int32 width = 4 [default = 0]; +inline bool BlobProto::_internal_has_width() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool BlobProto::has_width() const { + return _internal_has_width(); +} +inline void BlobProto::clear_width() { + width_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::_internal_width() const { + return width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BlobProto::width() const { + // @@protoc_insertion_point(field_get:caffe.BlobProto.width) + return _internal_width(); +} +inline void BlobProto::_internal_set_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000010u; + width_ = value; +} +inline void BlobProto::set_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_width(value); + // @@protoc_insertion_point(field_set:caffe.BlobProto.width) +} + +// ------------------------------------------------------------------- + +// BlobProtoVector + +// repeated .caffe.BlobProto blobs = 1; +inline int BlobProtoVector::_internal_blobs_size() const { + return blobs_.size(); +} +inline int BlobProtoVector::blobs_size() const { + return _internal_blobs_size(); +} +inline void BlobProtoVector::clear_blobs() { + blobs_.Clear(); +} +inline ::caffe::BlobProto* BlobProtoVector::mutable_blobs(int index) { + // @@protoc_insertion_point(field_mutable:caffe.BlobProtoVector.blobs) + return blobs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* +BlobProtoVector::mutable_blobs() { + // @@protoc_insertion_point(field_mutable_list:caffe.BlobProtoVector.blobs) + return &blobs_; +} +inline const ::caffe::BlobProto& BlobProtoVector::_internal_blobs(int index) const { + return blobs_.Get(index); +} +inline const ::caffe::BlobProto& BlobProtoVector::blobs(int index) const { + // @@protoc_insertion_point(field_get:caffe.BlobProtoVector.blobs) + return _internal_blobs(index); +} +inline ::caffe::BlobProto* BlobProtoVector::_internal_add_blobs() { + return blobs_.Add(); +} +inline ::caffe::BlobProto* BlobProtoVector::add_blobs() { + // @@protoc_insertion_point(field_add:caffe.BlobProtoVector.blobs) + return _internal_add_blobs(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& +BlobProtoVector::blobs() const { + // @@protoc_insertion_point(field_list:caffe.BlobProtoVector.blobs) + return blobs_; +} + +// ------------------------------------------------------------------- + +// Datum + +// optional int32 channels = 1; +inline bool Datum::_internal_has_channels() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool Datum::has_channels() const { + return _internal_has_channels(); +} +inline void Datum::clear_channels() { + channels_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::_internal_channels() const { + return channels_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::channels() const { + // @@protoc_insertion_point(field_get:caffe.Datum.channels) + return _internal_channels(); +} +inline void Datum::_internal_set_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + channels_ = value; +} +inline void Datum::set_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_channels(value); + // @@protoc_insertion_point(field_set:caffe.Datum.channels) +} + +// optional int32 height = 2; +inline bool Datum::_internal_has_height() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool Datum::has_height() const { + return _internal_has_height(); +} +inline void Datum::clear_height() { + height_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::_internal_height() const { + return height_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::height() const { + // @@protoc_insertion_point(field_get:caffe.Datum.height) + return _internal_height(); +} +inline void Datum::_internal_set_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + height_ = value; +} +inline void Datum::set_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_height(value); + // @@protoc_insertion_point(field_set:caffe.Datum.height) +} + +// optional int32 width = 3; +inline bool Datum::_internal_has_width() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool Datum::has_width() const { + return _internal_has_width(); +} +inline void Datum::clear_width() { + width_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::_internal_width() const { + return width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::width() const { + // @@protoc_insertion_point(field_get:caffe.Datum.width) + return _internal_width(); +} +inline void Datum::_internal_set_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000008u; + width_ = value; +} +inline void Datum::set_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_width(value); + // @@protoc_insertion_point(field_set:caffe.Datum.width) +} + +// optional bytes data = 4; +inline bool Datum::_internal_has_data() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool Datum::has_data() const { + return _internal_has_data(); +} +inline void Datum::clear_data() { + data_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& Datum::data() const { + // @@protoc_insertion_point(field_get:caffe.Datum.data) + return _internal_data(); +} +inline void Datum::set_data(const std::string& value) { + _internal_set_data(value); + // @@protoc_insertion_point(field_set:caffe.Datum.data) +} +inline std::string* Datum::mutable_data() { + // @@protoc_insertion_point(field_mutable:caffe.Datum.data) + return _internal_mutable_data(); +} +inline const std::string& Datum::_internal_data() const { + return data_.Get(); +} +inline void Datum::_internal_set_data(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void Datum::set_data(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + data_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.Datum.data) +} +inline void Datum::set_data(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.Datum.data) +} +inline void Datum::set_data(const void* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.Datum.data) +} +inline std::string* Datum::_internal_mutable_data() { + _has_bits_[0] |= 0x00000001u; + return data_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* Datum::release_data() { + // @@protoc_insertion_point(field_release:caffe.Datum.data) + if (!_internal_has_data()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return data_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void Datum::set_allocated_data(std::string* data) { + if (data != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.Datum.data) +} +inline std::string* Datum::unsafe_arena_release_data() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.Datum.data) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return data_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void Datum::unsafe_arena_set_allocated_data( + std::string* data) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (data != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + data_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + data, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.Datum.data) +} + +// optional int32 label = 5; +inline bool Datum::_internal_has_label() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool Datum::has_label() const { + return _internal_has_label(); +} +inline void Datum::clear_label() { + label_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::_internal_label() const { + return label_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 Datum::label() const { + // @@protoc_insertion_point(field_get:caffe.Datum.label) + return _internal_label(); +} +inline void Datum::_internal_set_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000010u; + label_ = value; +} +inline void Datum::set_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_label(value); + // @@protoc_insertion_point(field_set:caffe.Datum.label) +} + +// repeated float float_data = 6; +inline int Datum::_internal_float_data_size() const { + return float_data_.size(); +} +inline int Datum::float_data_size() const { + return _internal_float_data_size(); +} +inline void Datum::clear_float_data() { + float_data_.Clear(); +} +inline float Datum::_internal_float_data(int index) const { + return float_data_.Get(index); +} +inline float Datum::float_data(int index) const { + // @@protoc_insertion_point(field_get:caffe.Datum.float_data) + return _internal_float_data(index); +} +inline void Datum::set_float_data(int index, float value) { + float_data_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.Datum.float_data) +} +inline void Datum::_internal_add_float_data(float value) { + float_data_.Add(value); +} +inline void Datum::add_float_data(float value) { + _internal_add_float_data(value); + // @@protoc_insertion_point(field_add:caffe.Datum.float_data) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +Datum::_internal_float_data() const { + return float_data_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +Datum::float_data() const { + // @@protoc_insertion_point(field_list:caffe.Datum.float_data) + return _internal_float_data(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +Datum::_internal_mutable_float_data() { + return &float_data_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +Datum::mutable_float_data() { + // @@protoc_insertion_point(field_mutable_list:caffe.Datum.float_data) + return _internal_mutable_float_data(); +} + +// optional bool encoded = 7 [default = false]; +inline bool Datum::_internal_has_encoded() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool Datum::has_encoded() const { + return _internal_has_encoded(); +} +inline void Datum::clear_encoded() { + encoded_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool Datum::_internal_encoded() const { + return encoded_; +} +inline bool Datum::encoded() const { + // @@protoc_insertion_point(field_get:caffe.Datum.encoded) + return _internal_encoded(); +} +inline void Datum::_internal_set_encoded(bool value) { + _has_bits_[0] |= 0x00000020u; + encoded_ = value; +} +inline void Datum::set_encoded(bool value) { + _internal_set_encoded(value); + // @@protoc_insertion_point(field_set:caffe.Datum.encoded) +} + +// ------------------------------------------------------------------- + +// FillerParameter + +// optional string type = 1 [default = "constant"]; +inline bool FillerParameter::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FillerParameter::has_type() const { + return _internal_has_type(); +} +inline void FillerParameter::clear_type() { + type_.ClearToDefault(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& FillerParameter::type() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.type) + return _internal_type(); +} +inline void FillerParameter::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.type) +} +inline std::string* FillerParameter::mutable_type() { + // @@protoc_insertion_point(field_mutable:caffe.FillerParameter.type) + return _internal_mutable_type(); +} +inline const std::string& FillerParameter::_internal_type() const { + return type_.Get(); +} +inline void FillerParameter::_internal_set_type(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + type_.Set(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), value, GetArena()); +} +inline void FillerParameter::set_type(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + type_.Set( + &::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.FillerParameter.type) +} +inline void FillerParameter::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + type_.Set(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.FillerParameter.type) +} +inline void FillerParameter::set_type(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + type_.Set(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.FillerParameter.type) +} +inline std::string* FillerParameter::_internal_mutable_type() { + _has_bits_[0] |= 0x00000001u; + return type_.Mutable(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); +} +inline std::string* FillerParameter::release_type() { + // @@protoc_insertion_point(field_release:caffe.FillerParameter.type) + if (!_internal_has_type()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return type_.ReleaseNonDefault(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); +} +inline void FillerParameter::set_allocated_type(std::string* type) { + if (type != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + type_.SetAllocated(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.FillerParameter.type) +} +inline std::string* FillerParameter::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.FillerParameter.type) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return type_.UnsafeArenaRelease(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), + GetArena()); +} +inline void FillerParameter::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (type != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + type_.UnsafeArenaSetAllocated(&::caffe::FillerParameter::_i_give_permission_to_break_this_code_default_type_.get(), + type, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.FillerParameter.type) +} + +// optional float value = 2 [default = 0]; +inline bool FillerParameter::_internal_has_value() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FillerParameter::has_value() const { + return _internal_has_value(); +} +inline void FillerParameter::clear_value() { + value_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline float FillerParameter::_internal_value() const { + return value_; +} +inline float FillerParameter::value() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.value) + return _internal_value(); +} +inline void FillerParameter::_internal_set_value(float value) { + _has_bits_[0] |= 0x00000002u; + value_ = value; +} +inline void FillerParameter::set_value(float value) { + _internal_set_value(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.value) +} + +// optional float min = 3 [default = 0]; +inline bool FillerParameter::_internal_has_min() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool FillerParameter::has_min() const { + return _internal_has_min(); +} +inline void FillerParameter::clear_min() { + min_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline float FillerParameter::_internal_min() const { + return min_; +} +inline float FillerParameter::min() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.min) + return _internal_min(); +} +inline void FillerParameter::_internal_set_min(float value) { + _has_bits_[0] |= 0x00000004u; + min_ = value; +} +inline void FillerParameter::set_min(float value) { + _internal_set_min(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.min) +} + +// optional float max = 4 [default = 1]; +inline bool FillerParameter::_internal_has_max() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool FillerParameter::has_max() const { + return _internal_has_max(); +} +inline void FillerParameter::clear_max() { + max_ = 1; + _has_bits_[0] &= ~0x00000040u; +} +inline float FillerParameter::_internal_max() const { + return max_; +} +inline float FillerParameter::max() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.max) + return _internal_max(); +} +inline void FillerParameter::_internal_set_max(float value) { + _has_bits_[0] |= 0x00000040u; + max_ = value; +} +inline void FillerParameter::set_max(float value) { + _internal_set_max(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.max) +} + +// optional float mean = 5 [default = 0]; +inline bool FillerParameter::_internal_has_mean() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool FillerParameter::has_mean() const { + return _internal_has_mean(); +} +inline void FillerParameter::clear_mean() { + mean_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline float FillerParameter::_internal_mean() const { + return mean_; +} +inline float FillerParameter::mean() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.mean) + return _internal_mean(); +} +inline void FillerParameter::_internal_set_mean(float value) { + _has_bits_[0] |= 0x00000008u; + mean_ = value; +} +inline void FillerParameter::set_mean(float value) { + _internal_set_mean(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.mean) +} + +// optional float std = 6 [default = 1]; +inline bool FillerParameter::_internal_has_std() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool FillerParameter::has_std() const { + return _internal_has_std(); +} +inline void FillerParameter::clear_std() { + std_ = 1; + _has_bits_[0] &= ~0x00000080u; +} +inline float FillerParameter::_internal_std() const { + return std_; +} +inline float FillerParameter::std() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.std) + return _internal_std(); +} +inline void FillerParameter::_internal_set_std(float value) { + _has_bits_[0] |= 0x00000080u; + std_ = value; +} +inline void FillerParameter::set_std(float value) { + _internal_set_std(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.std) +} + +// optional int32 sparse = 7 [default = -1]; +inline bool FillerParameter::_internal_has_sparse() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool FillerParameter::has_sparse() const { + return _internal_has_sparse(); +} +inline void FillerParameter::clear_sparse() { + sparse_ = -1; + _has_bits_[0] &= ~0x00000020u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FillerParameter::_internal_sparse() const { + return sparse_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FillerParameter::sparse() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.sparse) + return _internal_sparse(); +} +inline void FillerParameter::_internal_set_sparse(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000020u; + sparse_ = value; +} +inline void FillerParameter::set_sparse(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_sparse(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.sparse) +} + +// optional .caffe.FillerParameter.VarianceNorm variance_norm = 8 [default = FAN_IN]; +inline bool FillerParameter::_internal_has_variance_norm() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool FillerParameter::has_variance_norm() const { + return _internal_has_variance_norm(); +} +inline void FillerParameter::clear_variance_norm() { + variance_norm_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::caffe::FillerParameter_VarianceNorm FillerParameter::_internal_variance_norm() const { + return static_cast< ::caffe::FillerParameter_VarianceNorm >(variance_norm_); +} +inline ::caffe::FillerParameter_VarianceNorm FillerParameter::variance_norm() const { + // @@protoc_insertion_point(field_get:caffe.FillerParameter.variance_norm) + return _internal_variance_norm(); +} +inline void FillerParameter::_internal_set_variance_norm(::caffe::FillerParameter_VarianceNorm value) { + assert(::caffe::FillerParameter_VarianceNorm_IsValid(value)); + _has_bits_[0] |= 0x00000010u; + variance_norm_ = value; +} +inline void FillerParameter::set_variance_norm(::caffe::FillerParameter_VarianceNorm value) { + _internal_set_variance_norm(value); + // @@protoc_insertion_point(field_set:caffe.FillerParameter.variance_norm) +} + +// ------------------------------------------------------------------- + +// NetParameter + +// optional string name = 1; +inline bool NetParameter::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool NetParameter::has_name() const { + return _internal_has_name(); +} +inline void NetParameter::clear_name() { + name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& NetParameter::name() const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.name) + return _internal_name(); +} +inline void NetParameter::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:caffe.NetParameter.name) +} +inline std::string* NetParameter::mutable_name() { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.name) + return _internal_mutable_name(); +} +inline const std::string& NetParameter::_internal_name() const { + return name_.Get(); +} +inline void NetParameter::_internal_set_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void NetParameter::set_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.NetParameter.name) +} +inline void NetParameter::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.NetParameter.name) +} +inline void NetParameter::set_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.NetParameter.name) +} +inline std::string* NetParameter::_internal_mutable_name() { + _has_bits_[0] |= 0x00000001u; + return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* NetParameter::release_name() { + // @@protoc_insertion_point(field_release:caffe.NetParameter.name) + if (!_internal_has_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void NetParameter::set_allocated_name(std::string* name) { + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.NetParameter.name) +} +inline std::string* NetParameter::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.NetParameter.name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void NetParameter::unsafe_arena_set_allocated_name( + std::string* name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.NetParameter.name) +} + +// repeated string input = 3; +inline int NetParameter::_internal_input_size() const { + return input_.size(); +} +inline int NetParameter::input_size() const { + return _internal_input_size(); +} +inline void NetParameter::clear_input() { + input_.Clear(); +} +inline std::string* NetParameter::add_input() { + // @@protoc_insertion_point(field_add_mutable:caffe.NetParameter.input) + return _internal_add_input(); +} +inline const std::string& NetParameter::_internal_input(int index) const { + return input_.Get(index); +} +inline const std::string& NetParameter::input(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.input) + return _internal_input(index); +} +inline std::string* NetParameter::mutable_input(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.input) + return input_.Mutable(index); +} +inline void NetParameter::set_input(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.NetParameter.input) + input_.Mutable(index)->assign(value); +} +inline void NetParameter::set_input(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.NetParameter.input) + input_.Mutable(index)->assign(std::move(value)); +} +inline void NetParameter::set_input(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + input_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.NetParameter.input) +} +inline void NetParameter::set_input(int index, const char* value, size_t size) { + input_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.NetParameter.input) +} +inline std::string* NetParameter::_internal_add_input() { + return input_.Add(); +} +inline void NetParameter::add_input(const std::string& value) { + input_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.NetParameter.input) +} +inline void NetParameter::add_input(std::string&& value) { + input_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.NetParameter.input) +} +inline void NetParameter::add_input(const char* value) { + GOOGLE_DCHECK(value != nullptr); + input_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.NetParameter.input) +} +inline void NetParameter::add_input(const char* value, size_t size) { + input_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.NetParameter.input) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +NetParameter::input() const { + // @@protoc_insertion_point(field_list:caffe.NetParameter.input) + return input_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +NetParameter::mutable_input() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetParameter.input) + return &input_; +} + +// repeated .caffe.BlobShape input_shape = 8; +inline int NetParameter::_internal_input_shape_size() const { + return input_shape_.size(); +} +inline int NetParameter::input_shape_size() const { + return _internal_input_shape_size(); +} +inline void NetParameter::clear_input_shape() { + input_shape_.Clear(); +} +inline ::caffe::BlobShape* NetParameter::mutable_input_shape(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.input_shape) + return input_shape_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* +NetParameter::mutable_input_shape() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetParameter.input_shape) + return &input_shape_; +} +inline const ::caffe::BlobShape& NetParameter::_internal_input_shape(int index) const { + return input_shape_.Get(index); +} +inline const ::caffe::BlobShape& NetParameter::input_shape(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.input_shape) + return _internal_input_shape(index); +} +inline ::caffe::BlobShape* NetParameter::_internal_add_input_shape() { + return input_shape_.Add(); +} +inline ::caffe::BlobShape* NetParameter::add_input_shape() { + // @@protoc_insertion_point(field_add:caffe.NetParameter.input_shape) + return _internal_add_input_shape(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& +NetParameter::input_shape() const { + // @@protoc_insertion_point(field_list:caffe.NetParameter.input_shape) + return input_shape_; +} + +// repeated int32 input_dim = 4; +inline int NetParameter::_internal_input_dim_size() const { + return input_dim_.size(); +} +inline int NetParameter::input_dim_size() const { + return _internal_input_dim_size(); +} +inline void NetParameter::clear_input_dim() { + input_dim_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetParameter::_internal_input_dim(int index) const { + return input_dim_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetParameter::input_dim(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.input_dim) + return _internal_input_dim(index); +} +inline void NetParameter::set_input_dim(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { + input_dim_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.NetParameter.input_dim) +} +inline void NetParameter::_internal_add_input_dim(::PROTOBUF_NAMESPACE_ID::int32 value) { + input_dim_.Add(value); +} +inline void NetParameter::add_input_dim(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_input_dim(value); + // @@protoc_insertion_point(field_add:caffe.NetParameter.input_dim) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +NetParameter::_internal_input_dim() const { + return input_dim_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +NetParameter::input_dim() const { + // @@protoc_insertion_point(field_list:caffe.NetParameter.input_dim) + return _internal_input_dim(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +NetParameter::_internal_mutable_input_dim() { + return &input_dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +NetParameter::mutable_input_dim() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetParameter.input_dim) + return _internal_mutable_input_dim(); +} + +// optional bool force_backward = 5 [default = false]; +inline bool NetParameter::_internal_has_force_backward() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool NetParameter::has_force_backward() const { + return _internal_has_force_backward(); +} +inline void NetParameter::clear_force_backward() { + force_backward_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool NetParameter::_internal_force_backward() const { + return force_backward_; +} +inline bool NetParameter::force_backward() const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.force_backward) + return _internal_force_backward(); +} +inline void NetParameter::_internal_set_force_backward(bool value) { + _has_bits_[0] |= 0x00000004u; + force_backward_ = value; +} +inline void NetParameter::set_force_backward(bool value) { + _internal_set_force_backward(value); + // @@protoc_insertion_point(field_set:caffe.NetParameter.force_backward) +} + +// optional .caffe.NetState state = 6; +inline bool NetParameter::_internal_has_state() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || state_ != nullptr); + return value; +} +inline bool NetParameter::has_state() const { + return _internal_has_state(); +} +inline void NetParameter::clear_state() { + if (state_ != nullptr) state_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::NetState& NetParameter::_internal_state() const { + const ::caffe::NetState* p = state_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_NetState_default_instance_); +} +inline const ::caffe::NetState& NetParameter::state() const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.state) + return _internal_state(); +} +inline void NetParameter::unsafe_arena_set_allocated_state( + ::caffe::NetState* state) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(state_); + } + state_ = state; + if (state) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.NetParameter.state) +} +inline ::caffe::NetState* NetParameter::release_state() { + auto temp = unsafe_arena_release_state(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::NetState* NetParameter::unsafe_arena_release_state() { + // @@protoc_insertion_point(field_release:caffe.NetParameter.state) + _has_bits_[0] &= ~0x00000002u; + ::caffe::NetState* temp = state_; + state_ = nullptr; + return temp; +} +inline ::caffe::NetState* NetParameter::_internal_mutable_state() { + _has_bits_[0] |= 0x00000002u; + if (state_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::NetState>(GetArena()); + state_ = p; + } + return state_; +} +inline ::caffe::NetState* NetParameter::mutable_state() { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.state) + return _internal_mutable_state(); +} +inline void NetParameter::set_allocated_state(::caffe::NetState* state) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete state_; + } + if (state) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(state); + if (message_arena != submessage_arena) { + state = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, state, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + state_ = state; + // @@protoc_insertion_point(field_set_allocated:caffe.NetParameter.state) +} + +// optional bool debug_info = 7 [default = false]; +inline bool NetParameter::_internal_has_debug_info() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool NetParameter::has_debug_info() const { + return _internal_has_debug_info(); +} +inline void NetParameter::clear_debug_info() { + debug_info_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool NetParameter::_internal_debug_info() const { + return debug_info_; +} +inline bool NetParameter::debug_info() const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.debug_info) + return _internal_debug_info(); +} +inline void NetParameter::_internal_set_debug_info(bool value) { + _has_bits_[0] |= 0x00000008u; + debug_info_ = value; +} +inline void NetParameter::set_debug_info(bool value) { + _internal_set_debug_info(value); + // @@protoc_insertion_point(field_set:caffe.NetParameter.debug_info) +} + +// repeated .caffe.LayerParameter layer = 100; +inline int NetParameter::_internal_layer_size() const { + return layer_.size(); +} +inline int NetParameter::layer_size() const { + return _internal_layer_size(); +} +inline void NetParameter::clear_layer() { + layer_.Clear(); +} +inline ::caffe::LayerParameter* NetParameter::mutable_layer(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.layer) + return layer_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::LayerParameter >* +NetParameter::mutable_layer() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetParameter.layer) + return &layer_; +} +inline const ::caffe::LayerParameter& NetParameter::_internal_layer(int index) const { + return layer_.Get(index); +} +inline const ::caffe::LayerParameter& NetParameter::layer(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.layer) + return _internal_layer(index); +} +inline ::caffe::LayerParameter* NetParameter::_internal_add_layer() { + return layer_.Add(); +} +inline ::caffe::LayerParameter* NetParameter::add_layer() { + // @@protoc_insertion_point(field_add:caffe.NetParameter.layer) + return _internal_add_layer(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::LayerParameter >& +NetParameter::layer() const { + // @@protoc_insertion_point(field_list:caffe.NetParameter.layer) + return layer_; +} + +// repeated .caffe.V1LayerParameter layers = 2; +inline int NetParameter::_internal_layers_size() const { + return layers_.size(); +} +inline int NetParameter::layers_size() const { + return _internal_layers_size(); +} +inline void NetParameter::clear_layers() { + layers_.Clear(); +} +inline ::caffe::V1LayerParameter* NetParameter::mutable_layers(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetParameter.layers) + return layers_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::V1LayerParameter >* +NetParameter::mutable_layers() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetParameter.layers) + return &layers_; +} +inline const ::caffe::V1LayerParameter& NetParameter::_internal_layers(int index) const { + return layers_.Get(index); +} +inline const ::caffe::V1LayerParameter& NetParameter::layers(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetParameter.layers) + return _internal_layers(index); +} +inline ::caffe::V1LayerParameter* NetParameter::_internal_add_layers() { + return layers_.Add(); +} +inline ::caffe::V1LayerParameter* NetParameter::add_layers() { + // @@protoc_insertion_point(field_add:caffe.NetParameter.layers) + return _internal_add_layers(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::V1LayerParameter >& +NetParameter::layers() const { + // @@protoc_insertion_point(field_list:caffe.NetParameter.layers) + return layers_; +} + +// ------------------------------------------------------------------- + +// SolverParameter + +// optional string net = 24; +inline bool SolverParameter::_internal_has_net() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SolverParameter::has_net() const { + return _internal_has_net(); +} +inline void SolverParameter::clear_net() { + net_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000008u; +} +inline const std::string& SolverParameter::net() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.net) + return _internal_net(); +} +inline void SolverParameter::set_net(const std::string& value) { + _internal_set_net(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.net) +} +inline std::string* SolverParameter::mutable_net() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.net) + return _internal_mutable_net(); +} +inline const std::string& SolverParameter::_internal_net() const { + return net_.Get(); +} +inline void SolverParameter::_internal_set_net(const std::string& value) { + _has_bits_[0] |= 0x00000008u; + net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void SolverParameter::set_net(std::string&& value) { + _has_bits_[0] |= 0x00000008u; + net_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.net) +} +inline void SolverParameter::set_net(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000008u; + net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.net) +} +inline void SolverParameter::set_net(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000008u; + net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.net) +} +inline std::string* SolverParameter::_internal_mutable_net() { + _has_bits_[0] |= 0x00000008u; + return net_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* SolverParameter::release_net() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.net) + if (!_internal_has_net()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000008u; + return net_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void SolverParameter::set_allocated_net(std::string* net) { + if (net != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + net_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), net, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.net) +} +inline std::string* SolverParameter::unsafe_arena_release_net() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.net) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000008u; + return net_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_net( + std::string* net) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (net != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + net_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + net, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.net) +} + +// optional .caffe.NetParameter net_param = 25; +inline bool SolverParameter::_internal_has_net_param() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || net_param_ != nullptr); + return value; +} +inline bool SolverParameter::has_net_param() const { + return _internal_has_net_param(); +} +inline void SolverParameter::clear_net_param() { + if (net_param_ != nullptr) net_param_->Clear(); + _has_bits_[0] &= ~0x00000080u; +} +inline const ::caffe::NetParameter& SolverParameter::_internal_net_param() const { + const ::caffe::NetParameter* p = net_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_NetParameter_default_instance_); +} +inline const ::caffe::NetParameter& SolverParameter::net_param() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.net_param) + return _internal_net_param(); +} +inline void SolverParameter::unsafe_arena_set_allocated_net_param( + ::caffe::NetParameter* net_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(net_param_); + } + net_param_ = net_param; + if (net_param) { + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.net_param) +} +inline ::caffe::NetParameter* SolverParameter::release_net_param() { + auto temp = unsafe_arena_release_net_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::NetParameter* SolverParameter::unsafe_arena_release_net_param() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.net_param) + _has_bits_[0] &= ~0x00000080u; + ::caffe::NetParameter* temp = net_param_; + net_param_ = nullptr; + return temp; +} +inline ::caffe::NetParameter* SolverParameter::_internal_mutable_net_param() { + _has_bits_[0] |= 0x00000080u; + if (net_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::NetParameter>(GetArena()); + net_param_ = p; + } + return net_param_; +} +inline ::caffe::NetParameter* SolverParameter::mutable_net_param() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.net_param) + return _internal_mutable_net_param(); +} +inline void SolverParameter::set_allocated_net_param(::caffe::NetParameter* net_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete net_param_; + } + if (net_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(net_param); + if (message_arena != submessage_arena) { + net_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, net_param, submessage_arena); + } + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + net_param_ = net_param; + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.net_param) +} + +// optional string train_net = 1; +inline bool SolverParameter::_internal_has_train_net() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SolverParameter::has_train_net() const { + return _internal_has_train_net(); +} +inline void SolverParameter::clear_train_net() { + train_net_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SolverParameter::train_net() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.train_net) + return _internal_train_net(); +} +inline void SolverParameter::set_train_net(const std::string& value) { + _internal_set_train_net(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.train_net) +} +inline std::string* SolverParameter::mutable_train_net() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.train_net) + return _internal_mutable_train_net(); +} +inline const std::string& SolverParameter::_internal_train_net() const { + return train_net_.Get(); +} +inline void SolverParameter::_internal_set_train_net(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + train_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void SolverParameter::set_train_net(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + train_net_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.train_net) +} +inline void SolverParameter::set_train_net(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + train_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.train_net) +} +inline void SolverParameter::set_train_net(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + train_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.train_net) +} +inline std::string* SolverParameter::_internal_mutable_train_net() { + _has_bits_[0] |= 0x00000001u; + return train_net_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* SolverParameter::release_train_net() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.train_net) + if (!_internal_has_train_net()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return train_net_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void SolverParameter::set_allocated_train_net(std::string* train_net) { + if (train_net != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + train_net_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), train_net, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.train_net) +} +inline std::string* SolverParameter::unsafe_arena_release_train_net() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.train_net) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return train_net_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_train_net( + std::string* train_net) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (train_net != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + train_net_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + train_net, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.train_net) +} + +// repeated string test_net = 2; +inline int SolverParameter::_internal_test_net_size() const { + return test_net_.size(); +} +inline int SolverParameter::test_net_size() const { + return _internal_test_net_size(); +} +inline void SolverParameter::clear_test_net() { + test_net_.Clear(); +} +inline std::string* SolverParameter::add_test_net() { + // @@protoc_insertion_point(field_add_mutable:caffe.SolverParameter.test_net) + return _internal_add_test_net(); +} +inline const std::string& SolverParameter::_internal_test_net(int index) const { + return test_net_.Get(index); +} +inline const std::string& SolverParameter::test_net(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_net) + return _internal_test_net(index); +} +inline std::string* SolverParameter::mutable_test_net(int index) { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.test_net) + return test_net_.Mutable(index); +} +inline void SolverParameter::set_test_net(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_net) + test_net_.Mutable(index)->assign(value); +} +inline void SolverParameter::set_test_net(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_net) + test_net_.Mutable(index)->assign(std::move(value)); +} +inline void SolverParameter::set_test_net(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + test_net_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.test_net) +} +inline void SolverParameter::set_test_net(int index, const char* value, size_t size) { + test_net_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.test_net) +} +inline std::string* SolverParameter::_internal_add_test_net() { + return test_net_.Add(); +} +inline void SolverParameter::add_test_net(const std::string& value) { + test_net_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.test_net) +} +inline void SolverParameter::add_test_net(std::string&& value) { + test_net_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.test_net) +} +inline void SolverParameter::add_test_net(const char* value) { + GOOGLE_DCHECK(value != nullptr); + test_net_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.SolverParameter.test_net) +} +inline void SolverParameter::add_test_net(const char* value, size_t size) { + test_net_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.SolverParameter.test_net) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +SolverParameter::test_net() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.test_net) + return test_net_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +SolverParameter::mutable_test_net() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.test_net) + return &test_net_; +} + +// optional .caffe.NetParameter train_net_param = 21; +inline bool SolverParameter::_internal_has_train_net_param() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || train_net_param_ != nullptr); + return value; +} +inline bool SolverParameter::has_train_net_param() const { + return _internal_has_train_net_param(); +} +inline void SolverParameter::clear_train_net_param() { + if (train_net_param_ != nullptr) train_net_param_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::caffe::NetParameter& SolverParameter::_internal_train_net_param() const { + const ::caffe::NetParameter* p = train_net_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_NetParameter_default_instance_); +} +inline const ::caffe::NetParameter& SolverParameter::train_net_param() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.train_net_param) + return _internal_train_net_param(); +} +inline void SolverParameter::unsafe_arena_set_allocated_train_net_param( + ::caffe::NetParameter* train_net_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(train_net_param_); + } + train_net_param_ = train_net_param; + if (train_net_param) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.train_net_param) +} +inline ::caffe::NetParameter* SolverParameter::release_train_net_param() { + auto temp = unsafe_arena_release_train_net_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::NetParameter* SolverParameter::unsafe_arena_release_train_net_param() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.train_net_param) + _has_bits_[0] &= ~0x00000040u; + ::caffe::NetParameter* temp = train_net_param_; + train_net_param_ = nullptr; + return temp; +} +inline ::caffe::NetParameter* SolverParameter::_internal_mutable_train_net_param() { + _has_bits_[0] |= 0x00000040u; + if (train_net_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::NetParameter>(GetArena()); + train_net_param_ = p; + } + return train_net_param_; +} +inline ::caffe::NetParameter* SolverParameter::mutable_train_net_param() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.train_net_param) + return _internal_mutable_train_net_param(); +} +inline void SolverParameter::set_allocated_train_net_param(::caffe::NetParameter* train_net_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete train_net_param_; + } + if (train_net_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(train_net_param); + if (message_arena != submessage_arena) { + train_net_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, train_net_param, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + train_net_param_ = train_net_param; + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.train_net_param) +} + +// repeated .caffe.NetParameter test_net_param = 22; +inline int SolverParameter::_internal_test_net_param_size() const { + return test_net_param_.size(); +} +inline int SolverParameter::test_net_param_size() const { + return _internal_test_net_param_size(); +} +inline void SolverParameter::clear_test_net_param() { + test_net_param_.Clear(); +} +inline ::caffe::NetParameter* SolverParameter::mutable_test_net_param(int index) { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.test_net_param) + return test_net_param_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetParameter >* +SolverParameter::mutable_test_net_param() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.test_net_param) + return &test_net_param_; +} +inline const ::caffe::NetParameter& SolverParameter::_internal_test_net_param(int index) const { + return test_net_param_.Get(index); +} +inline const ::caffe::NetParameter& SolverParameter::test_net_param(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_net_param) + return _internal_test_net_param(index); +} +inline ::caffe::NetParameter* SolverParameter::_internal_add_test_net_param() { + return test_net_param_.Add(); +} +inline ::caffe::NetParameter* SolverParameter::add_test_net_param() { + // @@protoc_insertion_point(field_add:caffe.SolverParameter.test_net_param) + return _internal_add_test_net_param(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetParameter >& +SolverParameter::test_net_param() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.test_net_param) + return test_net_param_; +} + +// optional .caffe.NetState train_state = 26; +inline bool SolverParameter::_internal_has_train_state() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || train_state_ != nullptr); + return value; +} +inline bool SolverParameter::has_train_state() const { + return _internal_has_train_state(); +} +inline void SolverParameter::clear_train_state() { + if (train_state_ != nullptr) train_state_->Clear(); + _has_bits_[0] &= ~0x00000100u; +} +inline const ::caffe::NetState& SolverParameter::_internal_train_state() const { + const ::caffe::NetState* p = train_state_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_NetState_default_instance_); +} +inline const ::caffe::NetState& SolverParameter::train_state() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.train_state) + return _internal_train_state(); +} +inline void SolverParameter::unsafe_arena_set_allocated_train_state( + ::caffe::NetState* train_state) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(train_state_); + } + train_state_ = train_state; + if (train_state) { + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.train_state) +} +inline ::caffe::NetState* SolverParameter::release_train_state() { + auto temp = unsafe_arena_release_train_state(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::NetState* SolverParameter::unsafe_arena_release_train_state() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.train_state) + _has_bits_[0] &= ~0x00000100u; + ::caffe::NetState* temp = train_state_; + train_state_ = nullptr; + return temp; +} +inline ::caffe::NetState* SolverParameter::_internal_mutable_train_state() { + _has_bits_[0] |= 0x00000100u; + if (train_state_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::NetState>(GetArena()); + train_state_ = p; + } + return train_state_; +} +inline ::caffe::NetState* SolverParameter::mutable_train_state() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.train_state) + return _internal_mutable_train_state(); +} +inline void SolverParameter::set_allocated_train_state(::caffe::NetState* train_state) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete train_state_; + } + if (train_state) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(train_state); + if (message_arena != submessage_arena) { + train_state = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, train_state, submessage_arena); + } + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + train_state_ = train_state; + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.train_state) +} + +// repeated .caffe.NetState test_state = 27; +inline int SolverParameter::_internal_test_state_size() const { + return test_state_.size(); +} +inline int SolverParameter::test_state_size() const { + return _internal_test_state_size(); +} +inline void SolverParameter::clear_test_state() { + test_state_.Clear(); +} +inline ::caffe::NetState* SolverParameter::mutable_test_state(int index) { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.test_state) + return test_state_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetState >* +SolverParameter::mutable_test_state() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.test_state) + return &test_state_; +} +inline const ::caffe::NetState& SolverParameter::_internal_test_state(int index) const { + return test_state_.Get(index); +} +inline const ::caffe::NetState& SolverParameter::test_state(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_state) + return _internal_test_state(index); +} +inline ::caffe::NetState* SolverParameter::_internal_add_test_state() { + return test_state_.Add(); +} +inline ::caffe::NetState* SolverParameter::add_test_state() { + // @@protoc_insertion_point(field_add:caffe.SolverParameter.test_state) + return _internal_add_test_state(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetState >& +SolverParameter::test_state() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.test_state) + return test_state_; +} + +// repeated int32 test_iter = 3; +inline int SolverParameter::_internal_test_iter_size() const { + return test_iter_.size(); +} +inline int SolverParameter::test_iter_size() const { + return _internal_test_iter_size(); +} +inline void SolverParameter::clear_test_iter() { + test_iter_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_test_iter(int index) const { + return test_iter_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::test_iter(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_iter) + return _internal_test_iter(index); +} +inline void SolverParameter::set_test_iter(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { + test_iter_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_iter) +} +inline void SolverParameter::_internal_add_test_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + test_iter_.Add(value); +} +inline void SolverParameter::add_test_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_test_iter(value); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.test_iter) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SolverParameter::_internal_test_iter() const { + return test_iter_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SolverParameter::test_iter() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.test_iter) + return _internal_test_iter(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SolverParameter::_internal_mutable_test_iter() { + return &test_iter_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SolverParameter::mutable_test_iter() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.test_iter) + return _internal_mutable_test_iter(); +} + +// optional int32 test_interval = 4 [default = 0]; +inline bool SolverParameter::_internal_has_test_interval() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool SolverParameter::has_test_interval() const { + return _internal_has_test_interval(); +} +inline void SolverParameter::clear_test_interval() { + test_interval_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_test_interval() const { + return test_interval_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::test_interval() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_interval) + return _internal_test_interval(); +} +inline void SolverParameter::_internal_set_test_interval(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000200u; + test_interval_ = value; +} +inline void SolverParameter::set_test_interval(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_test_interval(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_interval) +} + +// optional bool test_compute_loss = 19 [default = false]; +inline bool SolverParameter::_internal_has_test_compute_loss() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + return value; +} +inline bool SolverParameter::has_test_compute_loss() const { + return _internal_has_test_compute_loss(); +} +inline void SolverParameter::clear_test_compute_loss() { + test_compute_loss_ = false; + _has_bits_[0] &= ~0x00100000u; +} +inline bool SolverParameter::_internal_test_compute_loss() const { + return test_compute_loss_; +} +inline bool SolverParameter::test_compute_loss() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_compute_loss) + return _internal_test_compute_loss(); +} +inline void SolverParameter::_internal_set_test_compute_loss(bool value) { + _has_bits_[0] |= 0x00100000u; + test_compute_loss_ = value; +} +inline void SolverParameter::set_test_compute_loss(bool value) { + _internal_set_test_compute_loss(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_compute_loss) +} + +// optional bool test_initialization = 32 [default = true]; +inline bool SolverParameter::_internal_has_test_initialization() const { + bool value = (_has_bits_[0] & 0x20000000u) != 0; + return value; +} +inline bool SolverParameter::has_test_initialization() const { + return _internal_has_test_initialization(); +} +inline void SolverParameter::clear_test_initialization() { + test_initialization_ = true; + _has_bits_[0] &= ~0x20000000u; +} +inline bool SolverParameter::_internal_test_initialization() const { + return test_initialization_; +} +inline bool SolverParameter::test_initialization() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.test_initialization) + return _internal_test_initialization(); +} +inline void SolverParameter::_internal_set_test_initialization(bool value) { + _has_bits_[0] |= 0x20000000u; + test_initialization_ = value; +} +inline void SolverParameter::set_test_initialization(bool value) { + _internal_set_test_initialization(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.test_initialization) +} + +// optional float base_lr = 5; +inline bool SolverParameter::_internal_has_base_lr() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool SolverParameter::has_base_lr() const { + return _internal_has_base_lr(); +} +inline void SolverParameter::clear_base_lr() { + base_lr_ = 0; + _has_bits_[0] &= ~0x00000400u; +} +inline float SolverParameter::_internal_base_lr() const { + return base_lr_; +} +inline float SolverParameter::base_lr() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.base_lr) + return _internal_base_lr(); +} +inline void SolverParameter::_internal_set_base_lr(float value) { + _has_bits_[0] |= 0x00000400u; + base_lr_ = value; +} +inline void SolverParameter::set_base_lr(float value) { + _internal_set_base_lr(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.base_lr) +} + +// optional int32 display = 6; +inline bool SolverParameter::_internal_has_display() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool SolverParameter::has_display() const { + return _internal_has_display(); +} +inline void SolverParameter::clear_display() { + display_ = 0; + _has_bits_[0] &= ~0x00000800u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_display() const { + return display_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::display() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.display) + return _internal_display(); +} +inline void SolverParameter::_internal_set_display(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000800u; + display_ = value; +} +inline void SolverParameter::set_display(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_display(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.display) +} + +// optional int32 average_loss = 33 [default = 1]; +inline bool SolverParameter::_internal_has_average_loss() const { + bool value = (_has_bits_[0] & 0x10000000u) != 0; + return value; +} +inline bool SolverParameter::has_average_loss() const { + return _internal_has_average_loss(); +} +inline void SolverParameter::clear_average_loss() { + average_loss_ = 1; + _has_bits_[0] &= ~0x10000000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_average_loss() const { + return average_loss_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::average_loss() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.average_loss) + return _internal_average_loss(); +} +inline void SolverParameter::_internal_set_average_loss(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x10000000u; + average_loss_ = value; +} +inline void SolverParameter::set_average_loss(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_average_loss(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.average_loss) +} + +// optional int32 max_iter = 7; +inline bool SolverParameter::_internal_has_max_iter() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool SolverParameter::has_max_iter() const { + return _internal_has_max_iter(); +} +inline void SolverParameter::clear_max_iter() { + max_iter_ = 0; + _has_bits_[0] &= ~0x00001000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_max_iter() const { + return max_iter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::max_iter() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.max_iter) + return _internal_max_iter(); +} +inline void SolverParameter::_internal_set_max_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00001000u; + max_iter_ = value; +} +inline void SolverParameter::set_max_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_max_iter(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.max_iter) +} + +// optional int32 iter_size = 36 [default = 1]; +inline bool SolverParameter::_internal_has_iter_size() const { + bool value = (_has_bits_[1] & 0x00000002u) != 0; + return value; +} +inline bool SolverParameter::has_iter_size() const { + return _internal_has_iter_size(); +} +inline void SolverParameter::clear_iter_size() { + iter_size_ = 1; + _has_bits_[1] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_iter_size() const { + return iter_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::iter_size() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.iter_size) + return _internal_iter_size(); +} +inline void SolverParameter::_internal_set_iter_size(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[1] |= 0x00000002u; + iter_size_ = value; +} +inline void SolverParameter::set_iter_size(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_iter_size(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.iter_size) +} + +// optional string lr_policy = 8; +inline bool SolverParameter::_internal_has_lr_policy() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SolverParameter::has_lr_policy() const { + return _internal_has_lr_policy(); +} +inline void SolverParameter::clear_lr_policy() { + lr_policy_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& SolverParameter::lr_policy() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.lr_policy) + return _internal_lr_policy(); +} +inline void SolverParameter::set_lr_policy(const std::string& value) { + _internal_set_lr_policy(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.lr_policy) +} +inline std::string* SolverParameter::mutable_lr_policy() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.lr_policy) + return _internal_mutable_lr_policy(); +} +inline const std::string& SolverParameter::_internal_lr_policy() const { + return lr_policy_.Get(); +} +inline void SolverParameter::_internal_set_lr_policy(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + lr_policy_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void SolverParameter::set_lr_policy(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + lr_policy_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.lr_policy) +} +inline void SolverParameter::set_lr_policy(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + lr_policy_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.lr_policy) +} +inline void SolverParameter::set_lr_policy(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + lr_policy_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.lr_policy) +} +inline std::string* SolverParameter::_internal_mutable_lr_policy() { + _has_bits_[0] |= 0x00000002u; + return lr_policy_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* SolverParameter::release_lr_policy() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.lr_policy) + if (!_internal_has_lr_policy()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return lr_policy_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void SolverParameter::set_allocated_lr_policy(std::string* lr_policy) { + if (lr_policy != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + lr_policy_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), lr_policy, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.lr_policy) +} +inline std::string* SolverParameter::unsafe_arena_release_lr_policy() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.lr_policy) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return lr_policy_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_lr_policy( + std::string* lr_policy) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (lr_policy != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + lr_policy_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + lr_policy, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.lr_policy) +} + +// optional float gamma = 9; +inline bool SolverParameter::_internal_has_gamma() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + return value; +} +inline bool SolverParameter::has_gamma() const { + return _internal_has_gamma(); +} +inline void SolverParameter::clear_gamma() { + gamma_ = 0; + _has_bits_[0] &= ~0x00002000u; +} +inline float SolverParameter::_internal_gamma() const { + return gamma_; +} +inline float SolverParameter::gamma() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.gamma) + return _internal_gamma(); +} +inline void SolverParameter::_internal_set_gamma(float value) { + _has_bits_[0] |= 0x00002000u; + gamma_ = value; +} +inline void SolverParameter::set_gamma(float value) { + _internal_set_gamma(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.gamma) +} + +// optional float power = 10; +inline bool SolverParameter::_internal_has_power() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + return value; +} +inline bool SolverParameter::has_power() const { + return _internal_has_power(); +} +inline void SolverParameter::clear_power() { + power_ = 0; + _has_bits_[0] &= ~0x00004000u; +} +inline float SolverParameter::_internal_power() const { + return power_; +} +inline float SolverParameter::power() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.power) + return _internal_power(); +} +inline void SolverParameter::_internal_set_power(float value) { + _has_bits_[0] |= 0x00004000u; + power_ = value; +} +inline void SolverParameter::set_power(float value) { + _internal_set_power(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.power) +} + +// optional float momentum = 11; +inline bool SolverParameter::_internal_has_momentum() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + return value; +} +inline bool SolverParameter::has_momentum() const { + return _internal_has_momentum(); +} +inline void SolverParameter::clear_momentum() { + momentum_ = 0; + _has_bits_[0] &= ~0x00008000u; +} +inline float SolverParameter::_internal_momentum() const { + return momentum_; +} +inline float SolverParameter::momentum() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.momentum) + return _internal_momentum(); +} +inline void SolverParameter::_internal_set_momentum(float value) { + _has_bits_[0] |= 0x00008000u; + momentum_ = value; +} +inline void SolverParameter::set_momentum(float value) { + _internal_set_momentum(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.momentum) +} + +// optional float weight_decay = 12; +inline bool SolverParameter::_internal_has_weight_decay() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + return value; +} +inline bool SolverParameter::has_weight_decay() const { + return _internal_has_weight_decay(); +} +inline void SolverParameter::clear_weight_decay() { + weight_decay_ = 0; + _has_bits_[0] &= ~0x00010000u; +} +inline float SolverParameter::_internal_weight_decay() const { + return weight_decay_; +} +inline float SolverParameter::weight_decay() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.weight_decay) + return _internal_weight_decay(); +} +inline void SolverParameter::_internal_set_weight_decay(float value) { + _has_bits_[0] |= 0x00010000u; + weight_decay_ = value; +} +inline void SolverParameter::set_weight_decay(float value) { + _internal_set_weight_decay(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.weight_decay) +} + +// optional string regularization_type = 29 [default = "L2"]; +inline bool SolverParameter::_internal_has_regularization_type() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SolverParameter::has_regularization_type() const { + return _internal_has_regularization_type(); +} +inline void SolverParameter::clear_regularization_type() { + regularization_type_.ClearToDefault(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), GetArena()); + _has_bits_[0] &= ~0x00000010u; +} +inline const std::string& SolverParameter::regularization_type() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.regularization_type) + return _internal_regularization_type(); +} +inline void SolverParameter::set_regularization_type(const std::string& value) { + _internal_set_regularization_type(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.regularization_type) +} +inline std::string* SolverParameter::mutable_regularization_type() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.regularization_type) + return _internal_mutable_regularization_type(); +} +inline const std::string& SolverParameter::_internal_regularization_type() const { + return regularization_type_.Get(); +} +inline void SolverParameter::_internal_set_regularization_type(const std::string& value) { + _has_bits_[0] |= 0x00000010u; + regularization_type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), value, GetArena()); +} +inline void SolverParameter::set_regularization_type(std::string&& value) { + _has_bits_[0] |= 0x00000010u; + regularization_type_.Set( + &::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.regularization_type) +} +inline void SolverParameter::set_regularization_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000010u; + regularization_type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.regularization_type) +} +inline void SolverParameter::set_regularization_type(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000010u; + regularization_type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.regularization_type) +} +inline std::string* SolverParameter::_internal_mutable_regularization_type() { + _has_bits_[0] |= 0x00000010u; + return regularization_type_.Mutable(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), GetArena()); +} +inline std::string* SolverParameter::release_regularization_type() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.regularization_type) + if (!_internal_has_regularization_type()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000010u; + return regularization_type_.ReleaseNonDefault(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), GetArena()); +} +inline void SolverParameter::set_allocated_regularization_type(std::string* regularization_type) { + if (regularization_type != nullptr) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + regularization_type_.SetAllocated(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), regularization_type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.regularization_type) +} +inline std::string* SolverParameter::unsafe_arena_release_regularization_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.regularization_type) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000010u; + return regularization_type_.UnsafeArenaRelease(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_regularization_type( + std::string* regularization_type) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (regularization_type != nullptr) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + regularization_type_.UnsafeArenaSetAllocated(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_regularization_type_.get(), + regularization_type, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.regularization_type) +} + +// optional int32 stepsize = 13; +inline bool SolverParameter::_internal_has_stepsize() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + return value; +} +inline bool SolverParameter::has_stepsize() const { + return _internal_has_stepsize(); +} +inline void SolverParameter::clear_stepsize() { + stepsize_ = 0; + _has_bits_[0] &= ~0x00020000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_stepsize() const { + return stepsize_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::stepsize() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.stepsize) + return _internal_stepsize(); +} +inline void SolverParameter::_internal_set_stepsize(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00020000u; + stepsize_ = value; +} +inline void SolverParameter::set_stepsize(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_stepsize(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.stepsize) +} + +// repeated int32 stepvalue = 34; +inline int SolverParameter::_internal_stepvalue_size() const { + return stepvalue_.size(); +} +inline int SolverParameter::stepvalue_size() const { + return _internal_stepvalue_size(); +} +inline void SolverParameter::clear_stepvalue() { + stepvalue_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_stepvalue(int index) const { + return stepvalue_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::stepvalue(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.stepvalue) + return _internal_stepvalue(index); +} +inline void SolverParameter::set_stepvalue(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) { + stepvalue_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.stepvalue) +} +inline void SolverParameter::_internal_add_stepvalue(::PROTOBUF_NAMESPACE_ID::int32 value) { + stepvalue_.Add(value); +} +inline void SolverParameter::add_stepvalue(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_add_stepvalue(value); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.stepvalue) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SolverParameter::_internal_stepvalue() const { + return stepvalue_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >& +SolverParameter::stepvalue() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.stepvalue) + return _internal_stepvalue(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SolverParameter::_internal_mutable_stepvalue() { + return &stepvalue_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >* +SolverParameter::mutable_stepvalue() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.stepvalue) + return _internal_mutable_stepvalue(); +} + +// optional float clip_gradients = 35 [default = -1]; +inline bool SolverParameter::_internal_has_clip_gradients() const { + bool value = (_has_bits_[1] & 0x00000001u) != 0; + return value; +} +inline bool SolverParameter::has_clip_gradients() const { + return _internal_has_clip_gradients(); +} +inline void SolverParameter::clear_clip_gradients() { + clip_gradients_ = -1; + _has_bits_[1] &= ~0x00000001u; +} +inline float SolverParameter::_internal_clip_gradients() const { + return clip_gradients_; +} +inline float SolverParameter::clip_gradients() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.clip_gradients) + return _internal_clip_gradients(); +} +inline void SolverParameter::_internal_set_clip_gradients(float value) { + _has_bits_[1] |= 0x00000001u; + clip_gradients_ = value; +} +inline void SolverParameter::set_clip_gradients(float value) { + _internal_set_clip_gradients(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.clip_gradients) +} + +// optional int32 snapshot = 14 [default = 0]; +inline bool SolverParameter::_internal_has_snapshot() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + return value; +} +inline bool SolverParameter::has_snapshot() const { + return _internal_has_snapshot(); +} +inline void SolverParameter::clear_snapshot() { + snapshot_ = 0; + _has_bits_[0] &= ~0x00040000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_snapshot() const { + return snapshot_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::snapshot() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.snapshot) + return _internal_snapshot(); +} +inline void SolverParameter::_internal_set_snapshot(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00040000u; + snapshot_ = value; +} +inline void SolverParameter::set_snapshot(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_snapshot(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.snapshot) +} + +// optional string snapshot_prefix = 15; +inline bool SolverParameter::_internal_has_snapshot_prefix() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SolverParameter::has_snapshot_prefix() const { + return _internal_has_snapshot_prefix(); +} +inline void SolverParameter::clear_snapshot_prefix() { + snapshot_prefix_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& SolverParameter::snapshot_prefix() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.snapshot_prefix) + return _internal_snapshot_prefix(); +} +inline void SolverParameter::set_snapshot_prefix(const std::string& value) { + _internal_set_snapshot_prefix(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.snapshot_prefix) +} +inline std::string* SolverParameter::mutable_snapshot_prefix() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.snapshot_prefix) + return _internal_mutable_snapshot_prefix(); +} +inline const std::string& SolverParameter::_internal_snapshot_prefix() const { + return snapshot_prefix_.Get(); +} +inline void SolverParameter::_internal_set_snapshot_prefix(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + snapshot_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void SolverParameter::set_snapshot_prefix(std::string&& value) { + _has_bits_[0] |= 0x00000004u; + snapshot_prefix_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.snapshot_prefix) +} +inline void SolverParameter::set_snapshot_prefix(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000004u; + snapshot_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.snapshot_prefix) +} +inline void SolverParameter::set_snapshot_prefix(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000004u; + snapshot_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.snapshot_prefix) +} +inline std::string* SolverParameter::_internal_mutable_snapshot_prefix() { + _has_bits_[0] |= 0x00000004u; + return snapshot_prefix_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* SolverParameter::release_snapshot_prefix() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.snapshot_prefix) + if (!_internal_has_snapshot_prefix()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + return snapshot_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void SolverParameter::set_allocated_snapshot_prefix(std::string* snapshot_prefix) { + if (snapshot_prefix != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + snapshot_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), snapshot_prefix, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.snapshot_prefix) +} +inline std::string* SolverParameter::unsafe_arena_release_snapshot_prefix() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.snapshot_prefix) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000004u; + return snapshot_prefix_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_snapshot_prefix( + std::string* snapshot_prefix) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (snapshot_prefix != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + snapshot_prefix_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + snapshot_prefix, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.snapshot_prefix) +} + +// optional bool snapshot_diff = 16 [default = false]; +inline bool SolverParameter::_internal_has_snapshot_diff() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + return value; +} +inline bool SolverParameter::has_snapshot_diff() const { + return _internal_has_snapshot_diff(); +} +inline void SolverParameter::clear_snapshot_diff() { + snapshot_diff_ = false; + _has_bits_[0] &= ~0x00200000u; +} +inline bool SolverParameter::_internal_snapshot_diff() const { + return snapshot_diff_; +} +inline bool SolverParameter::snapshot_diff() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.snapshot_diff) + return _internal_snapshot_diff(); +} +inline void SolverParameter::_internal_set_snapshot_diff(bool value) { + _has_bits_[0] |= 0x00200000u; + snapshot_diff_ = value; +} +inline void SolverParameter::set_snapshot_diff(bool value) { + _internal_set_snapshot_diff(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.snapshot_diff) +} + +// optional .caffe.SolverParameter.SnapshotFormat snapshot_format = 37 [default = BINARYPROTO]; +inline bool SolverParameter::_internal_has_snapshot_format() const { + bool value = (_has_bits_[1] & 0x00000004u) != 0; + return value; +} +inline bool SolverParameter::has_snapshot_format() const { + return _internal_has_snapshot_format(); +} +inline void SolverParameter::clear_snapshot_format() { + snapshot_format_ = 1; + _has_bits_[1] &= ~0x00000004u; +} +inline ::caffe::SolverParameter_SnapshotFormat SolverParameter::_internal_snapshot_format() const { + return static_cast< ::caffe::SolverParameter_SnapshotFormat >(snapshot_format_); +} +inline ::caffe::SolverParameter_SnapshotFormat SolverParameter::snapshot_format() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.snapshot_format) + return _internal_snapshot_format(); +} +inline void SolverParameter::_internal_set_snapshot_format(::caffe::SolverParameter_SnapshotFormat value) { + assert(::caffe::SolverParameter_SnapshotFormat_IsValid(value)); + _has_bits_[1] |= 0x00000004u; + snapshot_format_ = value; +} +inline void SolverParameter::set_snapshot_format(::caffe::SolverParameter_SnapshotFormat value) { + _internal_set_snapshot_format(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.snapshot_format) +} + +// optional .caffe.SolverParameter.SolverMode solver_mode = 17 [default = GPU]; +inline bool SolverParameter::_internal_has_solver_mode() const { + bool value = (_has_bits_[0] & 0x04000000u) != 0; + return value; +} +inline bool SolverParameter::has_solver_mode() const { + return _internal_has_solver_mode(); +} +inline void SolverParameter::clear_solver_mode() { + solver_mode_ = 1; + _has_bits_[0] &= ~0x04000000u; +} +inline ::caffe::SolverParameter_SolverMode SolverParameter::_internal_solver_mode() const { + return static_cast< ::caffe::SolverParameter_SolverMode >(solver_mode_); +} +inline ::caffe::SolverParameter_SolverMode SolverParameter::solver_mode() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.solver_mode) + return _internal_solver_mode(); +} +inline void SolverParameter::_internal_set_solver_mode(::caffe::SolverParameter_SolverMode value) { + assert(::caffe::SolverParameter_SolverMode_IsValid(value)); + _has_bits_[0] |= 0x04000000u; + solver_mode_ = value; +} +inline void SolverParameter::set_solver_mode(::caffe::SolverParameter_SolverMode value) { + _internal_set_solver_mode(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.solver_mode) +} + +// optional int32 device_id = 18 [default = 0]; +inline bool SolverParameter::_internal_has_device_id() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + return value; +} +inline bool SolverParameter::has_device_id() const { + return _internal_has_device_id(); +} +inline void SolverParameter::clear_device_id() { + device_id_ = 0; + _has_bits_[0] &= ~0x00080000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::_internal_device_id() const { + return device_id_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverParameter::device_id() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.device_id) + return _internal_device_id(); +} +inline void SolverParameter::_internal_set_device_id(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00080000u; + device_id_ = value; +} +inline void SolverParameter::set_device_id(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_device_id(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.device_id) +} + +// optional int64 random_seed = 20 [default = -1]; +inline bool SolverParameter::_internal_has_random_seed() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + return value; +} +inline bool SolverParameter::has_random_seed() const { + return _internal_has_random_seed(); +} +inline void SolverParameter::clear_random_seed() { + random_seed_ = PROTOBUF_LONGLONG(-1); + _has_bits_[0] &= ~0x02000000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 SolverParameter::_internal_random_seed() const { + return random_seed_; +} +inline ::PROTOBUF_NAMESPACE_ID::int64 SolverParameter::random_seed() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.random_seed) + return _internal_random_seed(); +} +inline void SolverParameter::_internal_set_random_seed(::PROTOBUF_NAMESPACE_ID::int64 value) { + _has_bits_[0] |= 0x02000000u; + random_seed_ = value; +} +inline void SolverParameter::set_random_seed(::PROTOBUF_NAMESPACE_ID::int64 value) { + _internal_set_random_seed(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.random_seed) +} + +// optional string type = 40 [default = "SGD"]; +inline bool SolverParameter::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SolverParameter::has_type() const { + return _internal_has_type(); +} +inline void SolverParameter::clear_type() { + type_.ClearToDefault(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); + _has_bits_[0] &= ~0x00000020u; +} +inline const std::string& SolverParameter::type() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.type) + return _internal_type(); +} +inline void SolverParameter::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.type) +} +inline std::string* SolverParameter::mutable_type() { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.type) + return _internal_mutable_type(); +} +inline const std::string& SolverParameter::_internal_type() const { + return type_.Get(); +} +inline void SolverParameter::_internal_set_type(const std::string& value) { + _has_bits_[0] |= 0x00000020u; + type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), value, GetArena()); +} +inline void SolverParameter::set_type(std::string&& value) { + _has_bits_[0] |= 0x00000020u; + type_.Set( + &::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverParameter.type) +} +inline void SolverParameter::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000020u; + type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.type) +} +inline void SolverParameter::set_type(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000020u; + type_.Set(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.type) +} +inline std::string* SolverParameter::_internal_mutable_type() { + _has_bits_[0] |= 0x00000020u; + return type_.Mutable(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); +} +inline std::string* SolverParameter::release_type() { + // @@protoc_insertion_point(field_release:caffe.SolverParameter.type) + if (!_internal_has_type()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000020u; + return type_.ReleaseNonDefault(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), GetArena()); +} +inline void SolverParameter::set_allocated_type(std::string* type) { + if (type != nullptr) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + type_.SetAllocated(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverParameter.type) +} +inline std::string* SolverParameter::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverParameter.type) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000020u; + return type_.UnsafeArenaRelease(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), + GetArena()); +} +inline void SolverParameter::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (type != nullptr) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + type_.UnsafeArenaSetAllocated(&::caffe::SolverParameter::_i_give_permission_to_break_this_code_default_type_.get(), + type, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverParameter.type) +} + +// optional float delta = 31 [default = 1e-08]; +inline bool SolverParameter::_internal_has_delta() const { + bool value = (_has_bits_[0] & 0x08000000u) != 0; + return value; +} +inline bool SolverParameter::has_delta() const { + return _internal_has_delta(); +} +inline void SolverParameter::clear_delta() { + delta_ = 1e-08f; + _has_bits_[0] &= ~0x08000000u; +} +inline float SolverParameter::_internal_delta() const { + return delta_; +} +inline float SolverParameter::delta() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.delta) + return _internal_delta(); +} +inline void SolverParameter::_internal_set_delta(float value) { + _has_bits_[0] |= 0x08000000u; + delta_ = value; +} +inline void SolverParameter::set_delta(float value) { + _internal_set_delta(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.delta) +} + +// optional float momentum2 = 39 [default = 0.999]; +inline bool SolverParameter::_internal_has_momentum2() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + return value; +} +inline bool SolverParameter::has_momentum2() const { + return _internal_has_momentum2(); +} +inline void SolverParameter::clear_momentum2() { + momentum2_ = 0.999f; + _has_bits_[0] &= ~0x01000000u; +} +inline float SolverParameter::_internal_momentum2() const { + return momentum2_; +} +inline float SolverParameter::momentum2() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.momentum2) + return _internal_momentum2(); +} +inline void SolverParameter::_internal_set_momentum2(float value) { + _has_bits_[0] |= 0x01000000u; + momentum2_ = value; +} +inline void SolverParameter::set_momentum2(float value) { + _internal_set_momentum2(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.momentum2) +} + +// optional float rms_decay = 38 [default = 0.99]; +inline bool SolverParameter::_internal_has_rms_decay() const { + bool value = (_has_bits_[1] & 0x00000008u) != 0; + return value; +} +inline bool SolverParameter::has_rms_decay() const { + return _internal_has_rms_decay(); +} +inline void SolverParameter::clear_rms_decay() { + rms_decay_ = 0.99f; + _has_bits_[1] &= ~0x00000008u; +} +inline float SolverParameter::_internal_rms_decay() const { + return rms_decay_; +} +inline float SolverParameter::rms_decay() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.rms_decay) + return _internal_rms_decay(); +} +inline void SolverParameter::_internal_set_rms_decay(float value) { + _has_bits_[1] |= 0x00000008u; + rms_decay_ = value; +} +inline void SolverParameter::set_rms_decay(float value) { + _internal_set_rms_decay(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.rms_decay) +} + +// optional bool debug_info = 23 [default = false]; +inline bool SolverParameter::_internal_has_debug_info() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + return value; +} +inline bool SolverParameter::has_debug_info() const { + return _internal_has_debug_info(); +} +inline void SolverParameter::clear_debug_info() { + debug_info_ = false; + _has_bits_[0] &= ~0x00400000u; +} +inline bool SolverParameter::_internal_debug_info() const { + return debug_info_; +} +inline bool SolverParameter::debug_info() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.debug_info) + return _internal_debug_info(); +} +inline void SolverParameter::_internal_set_debug_info(bool value) { + _has_bits_[0] |= 0x00400000u; + debug_info_ = value; +} +inline void SolverParameter::set_debug_info(bool value) { + _internal_set_debug_info(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.debug_info) +} + +// optional bool snapshot_after_train = 28 [default = true]; +inline bool SolverParameter::_internal_has_snapshot_after_train() const { + bool value = (_has_bits_[0] & 0x40000000u) != 0; + return value; +} +inline bool SolverParameter::has_snapshot_after_train() const { + return _internal_has_snapshot_after_train(); +} +inline void SolverParameter::clear_snapshot_after_train() { + snapshot_after_train_ = true; + _has_bits_[0] &= ~0x40000000u; +} +inline bool SolverParameter::_internal_snapshot_after_train() const { + return snapshot_after_train_; +} +inline bool SolverParameter::snapshot_after_train() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.snapshot_after_train) + return _internal_snapshot_after_train(); +} +inline void SolverParameter::_internal_set_snapshot_after_train(bool value) { + _has_bits_[0] |= 0x40000000u; + snapshot_after_train_ = value; +} +inline void SolverParameter::set_snapshot_after_train(bool value) { + _internal_set_snapshot_after_train(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.snapshot_after_train) +} + +// optional .caffe.SolverParameter.SolverType solver_type = 30 [default = SGD]; +inline bool SolverParameter::_internal_has_solver_type() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + return value; +} +inline bool SolverParameter::has_solver_type() const { + return _internal_has_solver_type(); +} +inline void SolverParameter::clear_solver_type() { + solver_type_ = 0; + _has_bits_[0] &= ~0x00800000u; +} +inline ::caffe::SolverParameter_SolverType SolverParameter::_internal_solver_type() const { + return static_cast< ::caffe::SolverParameter_SolverType >(solver_type_); +} +inline ::caffe::SolverParameter_SolverType SolverParameter::solver_type() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.solver_type) + return _internal_solver_type(); +} +inline void SolverParameter::_internal_set_solver_type(::caffe::SolverParameter_SolverType value) { + assert(::caffe::SolverParameter_SolverType_IsValid(value)); + _has_bits_[0] |= 0x00800000u; + solver_type_ = value; +} +inline void SolverParameter::set_solver_type(::caffe::SolverParameter_SolverType value) { + _internal_set_solver_type(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.solver_type) +} + +// optional bool layer_wise_reduce = 41 [default = true]; +inline bool SolverParameter::_internal_has_layer_wise_reduce() const { + bool value = (_has_bits_[0] & 0x80000000u) != 0; + return value; +} +inline bool SolverParameter::has_layer_wise_reduce() const { + return _internal_has_layer_wise_reduce(); +} +inline void SolverParameter::clear_layer_wise_reduce() { + layer_wise_reduce_ = true; + _has_bits_[0] &= ~0x80000000u; +} +inline bool SolverParameter::_internal_layer_wise_reduce() const { + return layer_wise_reduce_; +} +inline bool SolverParameter::layer_wise_reduce() const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.layer_wise_reduce) + return _internal_layer_wise_reduce(); +} +inline void SolverParameter::_internal_set_layer_wise_reduce(bool value) { + _has_bits_[0] |= 0x80000000u; + layer_wise_reduce_ = value; +} +inline void SolverParameter::set_layer_wise_reduce(bool value) { + _internal_set_layer_wise_reduce(value); + // @@protoc_insertion_point(field_set:caffe.SolverParameter.layer_wise_reduce) +} + +// repeated string weights = 42; +inline int SolverParameter::_internal_weights_size() const { + return weights_.size(); +} +inline int SolverParameter::weights_size() const { + return _internal_weights_size(); +} +inline void SolverParameter::clear_weights() { + weights_.Clear(); +} +inline std::string* SolverParameter::add_weights() { + // @@protoc_insertion_point(field_add_mutable:caffe.SolverParameter.weights) + return _internal_add_weights(); +} +inline const std::string& SolverParameter::_internal_weights(int index) const { + return weights_.Get(index); +} +inline const std::string& SolverParameter::weights(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverParameter.weights) + return _internal_weights(index); +} +inline std::string* SolverParameter::mutable_weights(int index) { + // @@protoc_insertion_point(field_mutable:caffe.SolverParameter.weights) + return weights_.Mutable(index); +} +inline void SolverParameter::set_weights(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.SolverParameter.weights) + weights_.Mutable(index)->assign(value); +} +inline void SolverParameter::set_weights(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.SolverParameter.weights) + weights_.Mutable(index)->assign(std::move(value)); +} +inline void SolverParameter::set_weights(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + weights_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.SolverParameter.weights) +} +inline void SolverParameter::set_weights(int index, const char* value, size_t size) { + weights_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverParameter.weights) +} +inline std::string* SolverParameter::_internal_add_weights() { + return weights_.Add(); +} +inline void SolverParameter::add_weights(const std::string& value) { + weights_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.weights) +} +inline void SolverParameter::add_weights(std::string&& value) { + weights_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.SolverParameter.weights) +} +inline void SolverParameter::add_weights(const char* value) { + GOOGLE_DCHECK(value != nullptr); + weights_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.SolverParameter.weights) +} +inline void SolverParameter::add_weights(const char* value, size_t size) { + weights_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.SolverParameter.weights) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +SolverParameter::weights() const { + // @@protoc_insertion_point(field_list:caffe.SolverParameter.weights) + return weights_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +SolverParameter::mutable_weights() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverParameter.weights) + return &weights_; +} + +// ------------------------------------------------------------------- + +// SolverState + +// optional int32 iter = 1; +inline bool SolverState::_internal_has_iter() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SolverState::has_iter() const { + return _internal_has_iter(); +} +inline void SolverState::clear_iter() { + iter_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverState::_internal_iter() const { + return iter_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverState::iter() const { + // @@protoc_insertion_point(field_get:caffe.SolverState.iter) + return _internal_iter(); +} +inline void SolverState::_internal_set_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + iter_ = value; +} +inline void SolverState::set_iter(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_iter(value); + // @@protoc_insertion_point(field_set:caffe.SolverState.iter) +} + +// optional string learned_net = 2; +inline bool SolverState::_internal_has_learned_net() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SolverState::has_learned_net() const { + return _internal_has_learned_net(); +} +inline void SolverState::clear_learned_net() { + learned_net_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SolverState::learned_net() const { + // @@protoc_insertion_point(field_get:caffe.SolverState.learned_net) + return _internal_learned_net(); +} +inline void SolverState::set_learned_net(const std::string& value) { + _internal_set_learned_net(value); + // @@protoc_insertion_point(field_set:caffe.SolverState.learned_net) +} +inline std::string* SolverState::mutable_learned_net() { + // @@protoc_insertion_point(field_mutable:caffe.SolverState.learned_net) + return _internal_mutable_learned_net(); +} +inline const std::string& SolverState::_internal_learned_net() const { + return learned_net_.Get(); +} +inline void SolverState::_internal_set_learned_net(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + learned_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void SolverState::set_learned_net(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + learned_net_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.SolverState.learned_net) +} +inline void SolverState::set_learned_net(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + learned_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.SolverState.learned_net) +} +inline void SolverState::set_learned_net(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + learned_net_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.SolverState.learned_net) +} +inline std::string* SolverState::_internal_mutable_learned_net() { + _has_bits_[0] |= 0x00000001u; + return learned_net_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* SolverState::release_learned_net() { + // @@protoc_insertion_point(field_release:caffe.SolverState.learned_net) + if (!_internal_has_learned_net()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return learned_net_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void SolverState::set_allocated_learned_net(std::string* learned_net) { + if (learned_net != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + learned_net_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), learned_net, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.SolverState.learned_net) +} +inline std::string* SolverState::unsafe_arena_release_learned_net() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.SolverState.learned_net) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return learned_net_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void SolverState::unsafe_arena_set_allocated_learned_net( + std::string* learned_net) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (learned_net != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + learned_net_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + learned_net, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.SolverState.learned_net) +} + +// repeated .caffe.BlobProto history = 3; +inline int SolverState::_internal_history_size() const { + return history_.size(); +} +inline int SolverState::history_size() const { + return _internal_history_size(); +} +inline void SolverState::clear_history() { + history_.Clear(); +} +inline ::caffe::BlobProto* SolverState::mutable_history(int index) { + // @@protoc_insertion_point(field_mutable:caffe.SolverState.history) + return history_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* +SolverState::mutable_history() { + // @@protoc_insertion_point(field_mutable_list:caffe.SolverState.history) + return &history_; +} +inline const ::caffe::BlobProto& SolverState::_internal_history(int index) const { + return history_.Get(index); +} +inline const ::caffe::BlobProto& SolverState::history(int index) const { + // @@protoc_insertion_point(field_get:caffe.SolverState.history) + return _internal_history(index); +} +inline ::caffe::BlobProto* SolverState::_internal_add_history() { + return history_.Add(); +} +inline ::caffe::BlobProto* SolverState::add_history() { + // @@protoc_insertion_point(field_add:caffe.SolverState.history) + return _internal_add_history(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& +SolverState::history() const { + // @@protoc_insertion_point(field_list:caffe.SolverState.history) + return history_; +} + +// optional int32 current_step = 4 [default = 0]; +inline bool SolverState::_internal_has_current_step() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SolverState::has_current_step() const { + return _internal_has_current_step(); +} +inline void SolverState::clear_current_step() { + current_step_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverState::_internal_current_step() const { + return current_step_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SolverState::current_step() const { + // @@protoc_insertion_point(field_get:caffe.SolverState.current_step) + return _internal_current_step(); +} +inline void SolverState::_internal_set_current_step(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + current_step_ = value; +} +inline void SolverState::set_current_step(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_current_step(value); + // @@protoc_insertion_point(field_set:caffe.SolverState.current_step) +} + +// ------------------------------------------------------------------- + +// NetState + +// optional .caffe.Phase phase = 1 [default = TEST]; +inline bool NetState::_internal_has_phase() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool NetState::has_phase() const { + return _internal_has_phase(); +} +inline void NetState::clear_phase() { + phase_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::Phase NetState::_internal_phase() const { + return static_cast< ::caffe::Phase >(phase_); +} +inline ::caffe::Phase NetState::phase() const { + // @@protoc_insertion_point(field_get:caffe.NetState.phase) + return _internal_phase(); +} +inline void NetState::_internal_set_phase(::caffe::Phase value) { + assert(::caffe::Phase_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + phase_ = value; +} +inline void NetState::set_phase(::caffe::Phase value) { + _internal_set_phase(value); + // @@protoc_insertion_point(field_set:caffe.NetState.phase) +} + +// optional int32 level = 2 [default = 0]; +inline bool NetState::_internal_has_level() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool NetState::has_level() const { + return _internal_has_level(); +} +inline void NetState::clear_level() { + level_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetState::_internal_level() const { + return level_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetState::level() const { + // @@protoc_insertion_point(field_get:caffe.NetState.level) + return _internal_level(); +} +inline void NetState::_internal_set_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + level_ = value; +} +inline void NetState::set_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_level(value); + // @@protoc_insertion_point(field_set:caffe.NetState.level) +} + +// repeated string stage = 3; +inline int NetState::_internal_stage_size() const { + return stage_.size(); +} +inline int NetState::stage_size() const { + return _internal_stage_size(); +} +inline void NetState::clear_stage() { + stage_.Clear(); +} +inline std::string* NetState::add_stage() { + // @@protoc_insertion_point(field_add_mutable:caffe.NetState.stage) + return _internal_add_stage(); +} +inline const std::string& NetState::_internal_stage(int index) const { + return stage_.Get(index); +} +inline const std::string& NetState::stage(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetState.stage) + return _internal_stage(index); +} +inline std::string* NetState::mutable_stage(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetState.stage) + return stage_.Mutable(index); +} +inline void NetState::set_stage(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.NetState.stage) + stage_.Mutable(index)->assign(value); +} +inline void NetState::set_stage(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.NetState.stage) + stage_.Mutable(index)->assign(std::move(value)); +} +inline void NetState::set_stage(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + stage_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.NetState.stage) +} +inline void NetState::set_stage(int index, const char* value, size_t size) { + stage_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.NetState.stage) +} +inline std::string* NetState::_internal_add_stage() { + return stage_.Add(); +} +inline void NetState::add_stage(const std::string& value) { + stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.NetState.stage) +} +inline void NetState::add_stage(std::string&& value) { + stage_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.NetState.stage) +} +inline void NetState::add_stage(const char* value) { + GOOGLE_DCHECK(value != nullptr); + stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.NetState.stage) +} +inline void NetState::add_stage(const char* value, size_t size) { + stage_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.NetState.stage) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +NetState::stage() const { + // @@protoc_insertion_point(field_list:caffe.NetState.stage) + return stage_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +NetState::mutable_stage() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetState.stage) + return &stage_; +} + +// ------------------------------------------------------------------- + +// NetStateRule + +// optional .caffe.Phase phase = 1; +inline bool NetStateRule::_internal_has_phase() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool NetStateRule::has_phase() const { + return _internal_has_phase(); +} +inline void NetStateRule::clear_phase() { + phase_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::Phase NetStateRule::_internal_phase() const { + return static_cast< ::caffe::Phase >(phase_); +} +inline ::caffe::Phase NetStateRule::phase() const { + // @@protoc_insertion_point(field_get:caffe.NetStateRule.phase) + return _internal_phase(); +} +inline void NetStateRule::_internal_set_phase(::caffe::Phase value) { + assert(::caffe::Phase_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + phase_ = value; +} +inline void NetStateRule::set_phase(::caffe::Phase value) { + _internal_set_phase(value); + // @@protoc_insertion_point(field_set:caffe.NetStateRule.phase) +} + +// optional int32 min_level = 2; +inline bool NetStateRule::_internal_has_min_level() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool NetStateRule::has_min_level() const { + return _internal_has_min_level(); +} +inline void NetStateRule::clear_min_level() { + min_level_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetStateRule::_internal_min_level() const { + return min_level_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetStateRule::min_level() const { + // @@protoc_insertion_point(field_get:caffe.NetStateRule.min_level) + return _internal_min_level(); +} +inline void NetStateRule::_internal_set_min_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + min_level_ = value; +} +inline void NetStateRule::set_min_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_min_level(value); + // @@protoc_insertion_point(field_set:caffe.NetStateRule.min_level) +} + +// optional int32 max_level = 3; +inline bool NetStateRule::_internal_has_max_level() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool NetStateRule::has_max_level() const { + return _internal_has_max_level(); +} +inline void NetStateRule::clear_max_level() { + max_level_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetStateRule::_internal_max_level() const { + return max_level_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 NetStateRule::max_level() const { + // @@protoc_insertion_point(field_get:caffe.NetStateRule.max_level) + return _internal_max_level(); +} +inline void NetStateRule::_internal_set_max_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + max_level_ = value; +} +inline void NetStateRule::set_max_level(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_max_level(value); + // @@protoc_insertion_point(field_set:caffe.NetStateRule.max_level) +} + +// repeated string stage = 4; +inline int NetStateRule::_internal_stage_size() const { + return stage_.size(); +} +inline int NetStateRule::stage_size() const { + return _internal_stage_size(); +} +inline void NetStateRule::clear_stage() { + stage_.Clear(); +} +inline std::string* NetStateRule::add_stage() { + // @@protoc_insertion_point(field_add_mutable:caffe.NetStateRule.stage) + return _internal_add_stage(); +} +inline const std::string& NetStateRule::_internal_stage(int index) const { + return stage_.Get(index); +} +inline const std::string& NetStateRule::stage(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetStateRule.stage) + return _internal_stage(index); +} +inline std::string* NetStateRule::mutable_stage(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetStateRule.stage) + return stage_.Mutable(index); +} +inline void NetStateRule::set_stage(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.NetStateRule.stage) + stage_.Mutable(index)->assign(value); +} +inline void NetStateRule::set_stage(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.NetStateRule.stage) + stage_.Mutable(index)->assign(std::move(value)); +} +inline void NetStateRule::set_stage(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + stage_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.NetStateRule.stage) +} +inline void NetStateRule::set_stage(int index, const char* value, size_t size) { + stage_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.NetStateRule.stage) +} +inline std::string* NetStateRule::_internal_add_stage() { + return stage_.Add(); +} +inline void NetStateRule::add_stage(const std::string& value) { + stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.NetStateRule.stage) +} +inline void NetStateRule::add_stage(std::string&& value) { + stage_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.NetStateRule.stage) +} +inline void NetStateRule::add_stage(const char* value) { + GOOGLE_DCHECK(value != nullptr); + stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.NetStateRule.stage) +} +inline void NetStateRule::add_stage(const char* value, size_t size) { + stage_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.NetStateRule.stage) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +NetStateRule::stage() const { + // @@protoc_insertion_point(field_list:caffe.NetStateRule.stage) + return stage_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +NetStateRule::mutable_stage() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetStateRule.stage) + return &stage_; +} + +// repeated string not_stage = 5; +inline int NetStateRule::_internal_not_stage_size() const { + return not_stage_.size(); +} +inline int NetStateRule::not_stage_size() const { + return _internal_not_stage_size(); +} +inline void NetStateRule::clear_not_stage() { + not_stage_.Clear(); +} +inline std::string* NetStateRule::add_not_stage() { + // @@protoc_insertion_point(field_add_mutable:caffe.NetStateRule.not_stage) + return _internal_add_not_stage(); +} +inline const std::string& NetStateRule::_internal_not_stage(int index) const { + return not_stage_.Get(index); +} +inline const std::string& NetStateRule::not_stage(int index) const { + // @@protoc_insertion_point(field_get:caffe.NetStateRule.not_stage) + return _internal_not_stage(index); +} +inline std::string* NetStateRule::mutable_not_stage(int index) { + // @@protoc_insertion_point(field_mutable:caffe.NetStateRule.not_stage) + return not_stage_.Mutable(index); +} +inline void NetStateRule::set_not_stage(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.NetStateRule.not_stage) + not_stage_.Mutable(index)->assign(value); +} +inline void NetStateRule::set_not_stage(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.NetStateRule.not_stage) + not_stage_.Mutable(index)->assign(std::move(value)); +} +inline void NetStateRule::set_not_stage(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + not_stage_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.NetStateRule.not_stage) +} +inline void NetStateRule::set_not_stage(int index, const char* value, size_t size) { + not_stage_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.NetStateRule.not_stage) +} +inline std::string* NetStateRule::_internal_add_not_stage() { + return not_stage_.Add(); +} +inline void NetStateRule::add_not_stage(const std::string& value) { + not_stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.NetStateRule.not_stage) +} +inline void NetStateRule::add_not_stage(std::string&& value) { + not_stage_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.NetStateRule.not_stage) +} +inline void NetStateRule::add_not_stage(const char* value) { + GOOGLE_DCHECK(value != nullptr); + not_stage_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.NetStateRule.not_stage) +} +inline void NetStateRule::add_not_stage(const char* value, size_t size) { + not_stage_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.NetStateRule.not_stage) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +NetStateRule::not_stage() const { + // @@protoc_insertion_point(field_list:caffe.NetStateRule.not_stage) + return not_stage_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +NetStateRule::mutable_not_stage() { + // @@protoc_insertion_point(field_mutable_list:caffe.NetStateRule.not_stage) + return ¬_stage_; +} + +// ------------------------------------------------------------------- + +// ParamSpec + +// optional string name = 1; +inline bool ParamSpec::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ParamSpec::has_name() const { + return _internal_has_name(); +} +inline void ParamSpec::clear_name() { + name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ParamSpec::name() const { + // @@protoc_insertion_point(field_get:caffe.ParamSpec.name) + return _internal_name(); +} +inline void ParamSpec::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:caffe.ParamSpec.name) +} +inline std::string* ParamSpec::mutable_name() { + // @@protoc_insertion_point(field_mutable:caffe.ParamSpec.name) + return _internal_mutable_name(); +} +inline const std::string& ParamSpec::_internal_name() const { + return name_.Get(); +} +inline void ParamSpec::_internal_set_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void ParamSpec::set_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.ParamSpec.name) +} +inline void ParamSpec::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.ParamSpec.name) +} +inline void ParamSpec::set_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.ParamSpec.name) +} +inline std::string* ParamSpec::_internal_mutable_name() { + _has_bits_[0] |= 0x00000001u; + return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* ParamSpec::release_name() { + // @@protoc_insertion_point(field_release:caffe.ParamSpec.name) + if (!_internal_has_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void ParamSpec::set_allocated_name(std::string* name) { + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.ParamSpec.name) +} +inline std::string* ParamSpec::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.ParamSpec.name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void ParamSpec::unsafe_arena_set_allocated_name( + std::string* name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ParamSpec.name) +} + +// optional .caffe.ParamSpec.DimCheckMode share_mode = 2; +inline bool ParamSpec::_internal_has_share_mode() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ParamSpec::has_share_mode() const { + return _internal_has_share_mode(); +} +inline void ParamSpec::clear_share_mode() { + share_mode_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::ParamSpec_DimCheckMode ParamSpec::_internal_share_mode() const { + return static_cast< ::caffe::ParamSpec_DimCheckMode >(share_mode_); +} +inline ::caffe::ParamSpec_DimCheckMode ParamSpec::share_mode() const { + // @@protoc_insertion_point(field_get:caffe.ParamSpec.share_mode) + return _internal_share_mode(); +} +inline void ParamSpec::_internal_set_share_mode(::caffe::ParamSpec_DimCheckMode value) { + assert(::caffe::ParamSpec_DimCheckMode_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + share_mode_ = value; +} +inline void ParamSpec::set_share_mode(::caffe::ParamSpec_DimCheckMode value) { + _internal_set_share_mode(value); + // @@protoc_insertion_point(field_set:caffe.ParamSpec.share_mode) +} + +// optional float lr_mult = 3 [default = 1]; +inline bool ParamSpec::_internal_has_lr_mult() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ParamSpec::has_lr_mult() const { + return _internal_has_lr_mult(); +} +inline void ParamSpec::clear_lr_mult() { + lr_mult_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline float ParamSpec::_internal_lr_mult() const { + return lr_mult_; +} +inline float ParamSpec::lr_mult() const { + // @@protoc_insertion_point(field_get:caffe.ParamSpec.lr_mult) + return _internal_lr_mult(); +} +inline void ParamSpec::_internal_set_lr_mult(float value) { + _has_bits_[0] |= 0x00000004u; + lr_mult_ = value; +} +inline void ParamSpec::set_lr_mult(float value) { + _internal_set_lr_mult(value); + // @@protoc_insertion_point(field_set:caffe.ParamSpec.lr_mult) +} + +// optional float decay_mult = 4 [default = 1]; +inline bool ParamSpec::_internal_has_decay_mult() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ParamSpec::has_decay_mult() const { + return _internal_has_decay_mult(); +} +inline void ParamSpec::clear_decay_mult() { + decay_mult_ = 1; + _has_bits_[0] &= ~0x00000008u; +} +inline float ParamSpec::_internal_decay_mult() const { + return decay_mult_; +} +inline float ParamSpec::decay_mult() const { + // @@protoc_insertion_point(field_get:caffe.ParamSpec.decay_mult) + return _internal_decay_mult(); +} +inline void ParamSpec::_internal_set_decay_mult(float value) { + _has_bits_[0] |= 0x00000008u; + decay_mult_ = value; +} +inline void ParamSpec::set_decay_mult(float value) { + _internal_set_decay_mult(value); + // @@protoc_insertion_point(field_set:caffe.ParamSpec.decay_mult) +} + +// ------------------------------------------------------------------- + +// LayerParameter + +// optional string name = 1; +inline bool LayerParameter::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool LayerParameter::has_name() const { + return _internal_has_name(); +} +inline void LayerParameter::clear_name() { + name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& LayerParameter::name() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.name) + return _internal_name(); +} +inline void LayerParameter::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:caffe.LayerParameter.name) +} +inline std::string* LayerParameter::mutable_name() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.name) + return _internal_mutable_name(); +} +inline const std::string& LayerParameter::_internal_name() const { + return name_.Get(); +} +inline void LayerParameter::_internal_set_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void LayerParameter::set_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.LayerParameter.name) +} +inline void LayerParameter::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.LayerParameter.name) +} +inline void LayerParameter::set_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.LayerParameter.name) +} +inline std::string* LayerParameter::_internal_mutable_name() { + _has_bits_[0] |= 0x00000001u; + return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* LayerParameter::release_name() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.name) + if (!_internal_has_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void LayerParameter::set_allocated_name(std::string* name) { + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.name) +} +inline std::string* LayerParameter::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.LayerParameter.name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void LayerParameter::unsafe_arena_set_allocated_name( + std::string* name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.name) +} + +// optional string type = 2; +inline bool LayerParameter::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool LayerParameter::has_type() const { + return _internal_has_type(); +} +inline void LayerParameter::clear_type() { + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& LayerParameter::type() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.type) + return _internal_type(); +} +inline void LayerParameter::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:caffe.LayerParameter.type) +} +inline std::string* LayerParameter::mutable_type() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.type) + return _internal_mutable_type(); +} +inline const std::string& LayerParameter::_internal_type() const { + return type_.Get(); +} +inline void LayerParameter::_internal_set_type(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void LayerParameter::set_type(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + type_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.LayerParameter.type) +} +inline void LayerParameter::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.LayerParameter.type) +} +inline void LayerParameter::set_type(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.LayerParameter.type) +} +inline std::string* LayerParameter::_internal_mutable_type() { + _has_bits_[0] |= 0x00000002u; + return type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* LayerParameter::release_type() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.type) + if (!_internal_has_type()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void LayerParameter::set_allocated_type(std::string* type) { + if (type != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.type) +} +inline std::string* LayerParameter::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.LayerParameter.type) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void LayerParameter::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (type != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + type, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.type) +} + +// repeated string bottom = 3; +inline int LayerParameter::_internal_bottom_size() const { + return bottom_.size(); +} +inline int LayerParameter::bottom_size() const { + return _internal_bottom_size(); +} +inline void LayerParameter::clear_bottom() { + bottom_.Clear(); +} +inline std::string* LayerParameter::add_bottom() { + // @@protoc_insertion_point(field_add_mutable:caffe.LayerParameter.bottom) + return _internal_add_bottom(); +} +inline const std::string& LayerParameter::_internal_bottom(int index) const { + return bottom_.Get(index); +} +inline const std::string& LayerParameter::bottom(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.bottom) + return _internal_bottom(index); +} +inline std::string* LayerParameter::mutable_bottom(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.bottom) + return bottom_.Mutable(index); +} +inline void LayerParameter::set_bottom(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.LayerParameter.bottom) + bottom_.Mutable(index)->assign(value); +} +inline void LayerParameter::set_bottom(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.LayerParameter.bottom) + bottom_.Mutable(index)->assign(std::move(value)); +} +inline void LayerParameter::set_bottom(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + bottom_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.LayerParameter.bottom) +} +inline void LayerParameter::set_bottom(int index, const char* value, size_t size) { + bottom_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.LayerParameter.bottom) +} +inline std::string* LayerParameter::_internal_add_bottom() { + return bottom_.Add(); +} +inline void LayerParameter::add_bottom(const std::string& value) { + bottom_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.bottom) +} +inline void LayerParameter::add_bottom(std::string&& value) { + bottom_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.bottom) +} +inline void LayerParameter::add_bottom(const char* value) { + GOOGLE_DCHECK(value != nullptr); + bottom_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.LayerParameter.bottom) +} +inline void LayerParameter::add_bottom(const char* value, size_t size) { + bottom_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.LayerParameter.bottom) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +LayerParameter::bottom() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.bottom) + return bottom_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +LayerParameter::mutable_bottom() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.bottom) + return &bottom_; +} + +// repeated string top = 4; +inline int LayerParameter::_internal_top_size() const { + return top_.size(); +} +inline int LayerParameter::top_size() const { + return _internal_top_size(); +} +inline void LayerParameter::clear_top() { + top_.Clear(); +} +inline std::string* LayerParameter::add_top() { + // @@protoc_insertion_point(field_add_mutable:caffe.LayerParameter.top) + return _internal_add_top(); +} +inline const std::string& LayerParameter::_internal_top(int index) const { + return top_.Get(index); +} +inline const std::string& LayerParameter::top(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.top) + return _internal_top(index); +} +inline std::string* LayerParameter::mutable_top(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.top) + return top_.Mutable(index); +} +inline void LayerParameter::set_top(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.LayerParameter.top) + top_.Mutable(index)->assign(value); +} +inline void LayerParameter::set_top(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.LayerParameter.top) + top_.Mutable(index)->assign(std::move(value)); +} +inline void LayerParameter::set_top(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + top_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.LayerParameter.top) +} +inline void LayerParameter::set_top(int index, const char* value, size_t size) { + top_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.LayerParameter.top) +} +inline std::string* LayerParameter::_internal_add_top() { + return top_.Add(); +} +inline void LayerParameter::add_top(const std::string& value) { + top_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.top) +} +inline void LayerParameter::add_top(std::string&& value) { + top_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.top) +} +inline void LayerParameter::add_top(const char* value) { + GOOGLE_DCHECK(value != nullptr); + top_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.LayerParameter.top) +} +inline void LayerParameter::add_top(const char* value, size_t size) { + top_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.LayerParameter.top) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +LayerParameter::top() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.top) + return top_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +LayerParameter::mutable_top() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.top) + return &top_; +} + +// optional .caffe.Phase phase = 10; +inline bool LayerParameter::_internal_has_phase() const { + bool value = (_has_bits_[1] & 0x00080000u) != 0; + return value; +} +inline bool LayerParameter::has_phase() const { + return _internal_has_phase(); +} +inline void LayerParameter::clear_phase() { + phase_ = 0; + _has_bits_[1] &= ~0x00080000u; +} +inline ::caffe::Phase LayerParameter::_internal_phase() const { + return static_cast< ::caffe::Phase >(phase_); +} +inline ::caffe::Phase LayerParameter::phase() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.phase) + return _internal_phase(); +} +inline void LayerParameter::_internal_set_phase(::caffe::Phase value) { + assert(::caffe::Phase_IsValid(value)); + _has_bits_[1] |= 0x00080000u; + phase_ = value; +} +inline void LayerParameter::set_phase(::caffe::Phase value) { + _internal_set_phase(value); + // @@protoc_insertion_point(field_set:caffe.LayerParameter.phase) +} + +// repeated float loss_weight = 5; +inline int LayerParameter::_internal_loss_weight_size() const { + return loss_weight_.size(); +} +inline int LayerParameter::loss_weight_size() const { + return _internal_loss_weight_size(); +} +inline void LayerParameter::clear_loss_weight() { + loss_weight_.Clear(); +} +inline float LayerParameter::_internal_loss_weight(int index) const { + return loss_weight_.Get(index); +} +inline float LayerParameter::loss_weight(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.loss_weight) + return _internal_loss_weight(index); +} +inline void LayerParameter::set_loss_weight(int index, float value) { + loss_weight_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.LayerParameter.loss_weight) +} +inline void LayerParameter::_internal_add_loss_weight(float value) { + loss_weight_.Add(value); +} +inline void LayerParameter::add_loss_weight(float value) { + _internal_add_loss_weight(value); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.loss_weight) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +LayerParameter::_internal_loss_weight() const { + return loss_weight_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +LayerParameter::loss_weight() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.loss_weight) + return _internal_loss_weight(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +LayerParameter::_internal_mutable_loss_weight() { + return &loss_weight_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +LayerParameter::mutable_loss_weight() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.loss_weight) + return _internal_mutable_loss_weight(); +} + +// repeated .caffe.ParamSpec param = 6; +inline int LayerParameter::_internal_param_size() const { + return param_.size(); +} +inline int LayerParameter::param_size() const { + return _internal_param_size(); +} +inline void LayerParameter::clear_param() { + param_.Clear(); +} +inline ::caffe::ParamSpec* LayerParameter::mutable_param(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.param) + return param_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::ParamSpec >* +LayerParameter::mutable_param() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.param) + return ¶m_; +} +inline const ::caffe::ParamSpec& LayerParameter::_internal_param(int index) const { + return param_.Get(index); +} +inline const ::caffe::ParamSpec& LayerParameter::param(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.param) + return _internal_param(index); +} +inline ::caffe::ParamSpec* LayerParameter::_internal_add_param() { + return param_.Add(); +} +inline ::caffe::ParamSpec* LayerParameter::add_param() { + // @@protoc_insertion_point(field_add:caffe.LayerParameter.param) + return _internal_add_param(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::ParamSpec >& +LayerParameter::param() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.param) + return param_; +} + +// repeated .caffe.BlobProto blobs = 7; +inline int LayerParameter::_internal_blobs_size() const { + return blobs_.size(); +} +inline int LayerParameter::blobs_size() const { + return _internal_blobs_size(); +} +inline void LayerParameter::clear_blobs() { + blobs_.Clear(); +} +inline ::caffe::BlobProto* LayerParameter::mutable_blobs(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.blobs) + return blobs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* +LayerParameter::mutable_blobs() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.blobs) + return &blobs_; +} +inline const ::caffe::BlobProto& LayerParameter::_internal_blobs(int index) const { + return blobs_.Get(index); +} +inline const ::caffe::BlobProto& LayerParameter::blobs(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.blobs) + return _internal_blobs(index); +} +inline ::caffe::BlobProto* LayerParameter::_internal_add_blobs() { + return blobs_.Add(); +} +inline ::caffe::BlobProto* LayerParameter::add_blobs() { + // @@protoc_insertion_point(field_add:caffe.LayerParameter.blobs) + return _internal_add_blobs(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& +LayerParameter::blobs() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.blobs) + return blobs_; +} + +// repeated bool propagate_down = 11; +inline int LayerParameter::_internal_propagate_down_size() const { + return propagate_down_.size(); +} +inline int LayerParameter::propagate_down_size() const { + return _internal_propagate_down_size(); +} +inline void LayerParameter::clear_propagate_down() { + propagate_down_.Clear(); +} +inline bool LayerParameter::_internal_propagate_down(int index) const { + return propagate_down_.Get(index); +} +inline bool LayerParameter::propagate_down(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.propagate_down) + return _internal_propagate_down(index); +} +inline void LayerParameter::set_propagate_down(int index, bool value) { + propagate_down_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.LayerParameter.propagate_down) +} +inline void LayerParameter::_internal_add_propagate_down(bool value) { + propagate_down_.Add(value); +} +inline void LayerParameter::add_propagate_down(bool value) { + _internal_add_propagate_down(value); + // @@protoc_insertion_point(field_add:caffe.LayerParameter.propagate_down) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& +LayerParameter::_internal_propagate_down() const { + return propagate_down_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& +LayerParameter::propagate_down() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.propagate_down) + return _internal_propagate_down(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* +LayerParameter::_internal_mutable_propagate_down() { + return &propagate_down_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* +LayerParameter::mutable_propagate_down() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.propagate_down) + return _internal_mutable_propagate_down(); +} + +// repeated .caffe.NetStateRule include = 8; +inline int LayerParameter::_internal_include_size() const { + return include_.size(); +} +inline int LayerParameter::include_size() const { + return _internal_include_size(); +} +inline void LayerParameter::clear_include() { + include_.Clear(); +} +inline ::caffe::NetStateRule* LayerParameter::mutable_include(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.include) + return include_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* +LayerParameter::mutable_include() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.include) + return &include_; +} +inline const ::caffe::NetStateRule& LayerParameter::_internal_include(int index) const { + return include_.Get(index); +} +inline const ::caffe::NetStateRule& LayerParameter::include(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.include) + return _internal_include(index); +} +inline ::caffe::NetStateRule* LayerParameter::_internal_add_include() { + return include_.Add(); +} +inline ::caffe::NetStateRule* LayerParameter::add_include() { + // @@protoc_insertion_point(field_add:caffe.LayerParameter.include) + return _internal_add_include(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& +LayerParameter::include() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.include) + return include_; +} + +// repeated .caffe.NetStateRule exclude = 9; +inline int LayerParameter::_internal_exclude_size() const { + return exclude_.size(); +} +inline int LayerParameter::exclude_size() const { + return _internal_exclude_size(); +} +inline void LayerParameter::clear_exclude() { + exclude_.Clear(); +} +inline ::caffe::NetStateRule* LayerParameter::mutable_exclude(int index) { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.exclude) + return exclude_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* +LayerParameter::mutable_exclude() { + // @@protoc_insertion_point(field_mutable_list:caffe.LayerParameter.exclude) + return &exclude_; +} +inline const ::caffe::NetStateRule& LayerParameter::_internal_exclude(int index) const { + return exclude_.Get(index); +} +inline const ::caffe::NetStateRule& LayerParameter::exclude(int index) const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.exclude) + return _internal_exclude(index); +} +inline ::caffe::NetStateRule* LayerParameter::_internal_add_exclude() { + return exclude_.Add(); +} +inline ::caffe::NetStateRule* LayerParameter::add_exclude() { + // @@protoc_insertion_point(field_add:caffe.LayerParameter.exclude) + return _internal_add_exclude(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& +LayerParameter::exclude() const { + // @@protoc_insertion_point(field_list:caffe.LayerParameter.exclude) + return exclude_; +} + +// optional .caffe.TransformationParameter transform_param = 100; +inline bool LayerParameter::_internal_has_transform_param() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || transform_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_transform_param() const { + return _internal_has_transform_param(); +} +inline void LayerParameter::clear_transform_param() { + if (transform_param_ != nullptr) transform_param_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +inline const ::caffe::TransformationParameter& LayerParameter::_internal_transform_param() const { + const ::caffe::TransformationParameter* p = transform_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_TransformationParameter_default_instance_); +} +inline const ::caffe::TransformationParameter& LayerParameter::transform_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.transform_param) + return _internal_transform_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_transform_param( + ::caffe::TransformationParameter* transform_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(transform_param_); + } + transform_param_ = transform_param; + if (transform_param) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.transform_param) +} +inline ::caffe::TransformationParameter* LayerParameter::release_transform_param() { + auto temp = unsafe_arena_release_transform_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::TransformationParameter* LayerParameter::unsafe_arena_release_transform_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.transform_param) + _has_bits_[0] &= ~0x00000004u; + ::caffe::TransformationParameter* temp = transform_param_; + transform_param_ = nullptr; + return temp; +} +inline ::caffe::TransformationParameter* LayerParameter::_internal_mutable_transform_param() { + _has_bits_[0] |= 0x00000004u; + if (transform_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::TransformationParameter>(GetArena()); + transform_param_ = p; + } + return transform_param_; +} +inline ::caffe::TransformationParameter* LayerParameter::mutable_transform_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.transform_param) + return _internal_mutable_transform_param(); +} +inline void LayerParameter::set_allocated_transform_param(::caffe::TransformationParameter* transform_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete transform_param_; + } + if (transform_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(transform_param); + if (message_arena != submessage_arena) { + transform_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, transform_param, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + transform_param_ = transform_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.transform_param) +} + +// optional .caffe.LossParameter loss_param = 101; +inline bool LayerParameter::_internal_has_loss_param() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || loss_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_loss_param() const { + return _internal_has_loss_param(); +} +inline void LayerParameter::clear_loss_param() { + if (loss_param_ != nullptr) loss_param_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +inline const ::caffe::LossParameter& LayerParameter::_internal_loss_param() const { + const ::caffe::LossParameter* p = loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_LossParameter_default_instance_); +} +inline const ::caffe::LossParameter& LayerParameter::loss_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.loss_param) + return _internal_loss_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_loss_param( + ::caffe::LossParameter* loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(loss_param_); + } + loss_param_ = loss_param; + if (loss_param) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.loss_param) +} +inline ::caffe::LossParameter* LayerParameter::release_loss_param() { + auto temp = unsafe_arena_release_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::LossParameter* LayerParameter::unsafe_arena_release_loss_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.loss_param) + _has_bits_[0] &= ~0x00000008u; + ::caffe::LossParameter* temp = loss_param_; + loss_param_ = nullptr; + return temp; +} +inline ::caffe::LossParameter* LayerParameter::_internal_mutable_loss_param() { + _has_bits_[0] |= 0x00000008u; + if (loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::LossParameter>(GetArena()); + loss_param_ = p; + } + return loss_param_; +} +inline ::caffe::LossParameter* LayerParameter::mutable_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.loss_param) + return _internal_mutable_loss_param(); +} +inline void LayerParameter::set_allocated_loss_param(::caffe::LossParameter* loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete loss_param_; + } + if (loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(loss_param); + if (message_arena != submessage_arena) { + loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + loss_param_ = loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.loss_param) +} + +// optional .caffe.AccuracyParameter accuracy_param = 102; +inline bool LayerParameter::_internal_has_accuracy_param() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || accuracy_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_accuracy_param() const { + return _internal_has_accuracy_param(); +} +inline void LayerParameter::clear_accuracy_param() { + if (accuracy_param_ != nullptr) accuracy_param_->Clear(); + _has_bits_[0] &= ~0x00000010u; +} +inline const ::caffe::AccuracyParameter& LayerParameter::_internal_accuracy_param() const { + const ::caffe::AccuracyParameter* p = accuracy_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_AccuracyParameter_default_instance_); +} +inline const ::caffe::AccuracyParameter& LayerParameter::accuracy_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.accuracy_param) + return _internal_accuracy_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_accuracy_param( + ::caffe::AccuracyParameter* accuracy_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(accuracy_param_); + } + accuracy_param_ = accuracy_param; + if (accuracy_param) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.accuracy_param) +} +inline ::caffe::AccuracyParameter* LayerParameter::release_accuracy_param() { + auto temp = unsafe_arena_release_accuracy_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::AccuracyParameter* LayerParameter::unsafe_arena_release_accuracy_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.accuracy_param) + _has_bits_[0] &= ~0x00000010u; + ::caffe::AccuracyParameter* temp = accuracy_param_; + accuracy_param_ = nullptr; + return temp; +} +inline ::caffe::AccuracyParameter* LayerParameter::_internal_mutable_accuracy_param() { + _has_bits_[0] |= 0x00000010u; + if (accuracy_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::AccuracyParameter>(GetArena()); + accuracy_param_ = p; + } + return accuracy_param_; +} +inline ::caffe::AccuracyParameter* LayerParameter::mutable_accuracy_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.accuracy_param) + return _internal_mutable_accuracy_param(); +} +inline void LayerParameter::set_allocated_accuracy_param(::caffe::AccuracyParameter* accuracy_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete accuracy_param_; + } + if (accuracy_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(accuracy_param); + if (message_arena != submessage_arena) { + accuracy_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, accuracy_param, submessage_arena); + } + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + accuracy_param_ = accuracy_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.accuracy_param) +} + +// optional .caffe.ArgMaxParameter argmax_param = 103; +inline bool LayerParameter::_internal_has_argmax_param() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || argmax_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_argmax_param() const { + return _internal_has_argmax_param(); +} +inline void LayerParameter::clear_argmax_param() { + if (argmax_param_ != nullptr) argmax_param_->Clear(); + _has_bits_[0] &= ~0x00000020u; +} +inline const ::caffe::ArgMaxParameter& LayerParameter::_internal_argmax_param() const { + const ::caffe::ArgMaxParameter* p = argmax_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ArgMaxParameter_default_instance_); +} +inline const ::caffe::ArgMaxParameter& LayerParameter::argmax_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.argmax_param) + return _internal_argmax_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_argmax_param( + ::caffe::ArgMaxParameter* argmax_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(argmax_param_); + } + argmax_param_ = argmax_param; + if (argmax_param) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.argmax_param) +} +inline ::caffe::ArgMaxParameter* LayerParameter::release_argmax_param() { + auto temp = unsafe_arena_release_argmax_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ArgMaxParameter* LayerParameter::unsafe_arena_release_argmax_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.argmax_param) + _has_bits_[0] &= ~0x00000020u; + ::caffe::ArgMaxParameter* temp = argmax_param_; + argmax_param_ = nullptr; + return temp; +} +inline ::caffe::ArgMaxParameter* LayerParameter::_internal_mutable_argmax_param() { + _has_bits_[0] |= 0x00000020u; + if (argmax_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ArgMaxParameter>(GetArena()); + argmax_param_ = p; + } + return argmax_param_; +} +inline ::caffe::ArgMaxParameter* LayerParameter::mutable_argmax_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.argmax_param) + return _internal_mutable_argmax_param(); +} +inline void LayerParameter::set_allocated_argmax_param(::caffe::ArgMaxParameter* argmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete argmax_param_; + } + if (argmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(argmax_param); + if (message_arena != submessage_arena) { + argmax_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, argmax_param, submessage_arena); + } + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + argmax_param_ = argmax_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.argmax_param) +} + +// optional .caffe.BatchNormParameter batch_norm_param = 139; +inline bool LayerParameter::_internal_has_batch_norm_param() const { + bool value = (_has_bits_[1] & 0x00000200u) != 0; + PROTOBUF_ASSUME(!value || batch_norm_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_batch_norm_param() const { + return _internal_has_batch_norm_param(); +} +inline void LayerParameter::clear_batch_norm_param() { + if (batch_norm_param_ != nullptr) batch_norm_param_->Clear(); + _has_bits_[1] &= ~0x00000200u; +} +inline const ::caffe::BatchNormParameter& LayerParameter::_internal_batch_norm_param() const { + const ::caffe::BatchNormParameter* p = batch_norm_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_BatchNormParameter_default_instance_); +} +inline const ::caffe::BatchNormParameter& LayerParameter::batch_norm_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.batch_norm_param) + return _internal_batch_norm_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_batch_norm_param( + ::caffe::BatchNormParameter* batch_norm_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(batch_norm_param_); + } + batch_norm_param_ = batch_norm_param; + if (batch_norm_param) { + _has_bits_[1] |= 0x00000200u; + } else { + _has_bits_[1] &= ~0x00000200u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.batch_norm_param) +} +inline ::caffe::BatchNormParameter* LayerParameter::release_batch_norm_param() { + auto temp = unsafe_arena_release_batch_norm_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::BatchNormParameter* LayerParameter::unsafe_arena_release_batch_norm_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.batch_norm_param) + _has_bits_[1] &= ~0x00000200u; + ::caffe::BatchNormParameter* temp = batch_norm_param_; + batch_norm_param_ = nullptr; + return temp; +} +inline ::caffe::BatchNormParameter* LayerParameter::_internal_mutable_batch_norm_param() { + _has_bits_[1] |= 0x00000200u; + if (batch_norm_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::BatchNormParameter>(GetArena()); + batch_norm_param_ = p; + } + return batch_norm_param_; +} +inline ::caffe::BatchNormParameter* LayerParameter::mutable_batch_norm_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.batch_norm_param) + return _internal_mutable_batch_norm_param(); +} +inline void LayerParameter::set_allocated_batch_norm_param(::caffe::BatchNormParameter* batch_norm_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete batch_norm_param_; + } + if (batch_norm_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(batch_norm_param); + if (message_arena != submessage_arena) { + batch_norm_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, batch_norm_param, submessage_arena); + } + _has_bits_[1] |= 0x00000200u; + } else { + _has_bits_[1] &= ~0x00000200u; + } + batch_norm_param_ = batch_norm_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.batch_norm_param) +} + +// optional .caffe.BiasParameter bias_param = 141; +inline bool LayerParameter::_internal_has_bias_param() const { + bool value = (_has_bits_[1] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || bias_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_bias_param() const { + return _internal_has_bias_param(); +} +inline void LayerParameter::clear_bias_param() { + if (bias_param_ != nullptr) bias_param_->Clear(); + _has_bits_[1] &= ~0x00000800u; +} +inline const ::caffe::BiasParameter& LayerParameter::_internal_bias_param() const { + const ::caffe::BiasParameter* p = bias_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_BiasParameter_default_instance_); +} +inline const ::caffe::BiasParameter& LayerParameter::bias_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.bias_param) + return _internal_bias_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_bias_param( + ::caffe::BiasParameter* bias_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_param_); + } + bias_param_ = bias_param; + if (bias_param) { + _has_bits_[1] |= 0x00000800u; + } else { + _has_bits_[1] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.bias_param) +} +inline ::caffe::BiasParameter* LayerParameter::release_bias_param() { + auto temp = unsafe_arena_release_bias_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::BiasParameter* LayerParameter::unsafe_arena_release_bias_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.bias_param) + _has_bits_[1] &= ~0x00000800u; + ::caffe::BiasParameter* temp = bias_param_; + bias_param_ = nullptr; + return temp; +} +inline ::caffe::BiasParameter* LayerParameter::_internal_mutable_bias_param() { + _has_bits_[1] |= 0x00000800u; + if (bias_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::BiasParameter>(GetArena()); + bias_param_ = p; + } + return bias_param_; +} +inline ::caffe::BiasParameter* LayerParameter::mutable_bias_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.bias_param) + return _internal_mutable_bias_param(); +} +inline void LayerParameter::set_allocated_bias_param(::caffe::BiasParameter* bias_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_param_; + } + if (bias_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_param); + if (message_arena != submessage_arena) { + bias_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_param, submessage_arena); + } + _has_bits_[1] |= 0x00000800u; + } else { + _has_bits_[1] &= ~0x00000800u; + } + bias_param_ = bias_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.bias_param) +} + +// optional .caffe.ClipParameter clip_param = 148; +inline bool LayerParameter::_internal_has_clip_param() const { + bool value = (_has_bits_[1] & 0x00040000u) != 0; + PROTOBUF_ASSUME(!value || clip_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_clip_param() const { + return _internal_has_clip_param(); +} +inline void LayerParameter::clear_clip_param() { + if (clip_param_ != nullptr) clip_param_->Clear(); + _has_bits_[1] &= ~0x00040000u; +} +inline const ::caffe::ClipParameter& LayerParameter::_internal_clip_param() const { + const ::caffe::ClipParameter* p = clip_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ClipParameter_default_instance_); +} +inline const ::caffe::ClipParameter& LayerParameter::clip_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.clip_param) + return _internal_clip_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_clip_param( + ::caffe::ClipParameter* clip_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(clip_param_); + } + clip_param_ = clip_param; + if (clip_param) { + _has_bits_[1] |= 0x00040000u; + } else { + _has_bits_[1] &= ~0x00040000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.clip_param) +} +inline ::caffe::ClipParameter* LayerParameter::release_clip_param() { + auto temp = unsafe_arena_release_clip_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ClipParameter* LayerParameter::unsafe_arena_release_clip_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.clip_param) + _has_bits_[1] &= ~0x00040000u; + ::caffe::ClipParameter* temp = clip_param_; + clip_param_ = nullptr; + return temp; +} +inline ::caffe::ClipParameter* LayerParameter::_internal_mutable_clip_param() { + _has_bits_[1] |= 0x00040000u; + if (clip_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ClipParameter>(GetArena()); + clip_param_ = p; + } + return clip_param_; +} +inline ::caffe::ClipParameter* LayerParameter::mutable_clip_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.clip_param) + return _internal_mutable_clip_param(); +} +inline void LayerParameter::set_allocated_clip_param(::caffe::ClipParameter* clip_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete clip_param_; + } + if (clip_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(clip_param); + if (message_arena != submessage_arena) { + clip_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, clip_param, submessage_arena); + } + _has_bits_[1] |= 0x00040000u; + } else { + _has_bits_[1] &= ~0x00040000u; + } + clip_param_ = clip_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.clip_param) +} + +// optional .caffe.ConcatParameter concat_param = 104; +inline bool LayerParameter::_internal_has_concat_param() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || concat_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_concat_param() const { + return _internal_has_concat_param(); +} +inline void LayerParameter::clear_concat_param() { + if (concat_param_ != nullptr) concat_param_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::caffe::ConcatParameter& LayerParameter::_internal_concat_param() const { + const ::caffe::ConcatParameter* p = concat_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ConcatParameter_default_instance_); +} +inline const ::caffe::ConcatParameter& LayerParameter::concat_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.concat_param) + return _internal_concat_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_concat_param( + ::caffe::ConcatParameter* concat_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(concat_param_); + } + concat_param_ = concat_param; + if (concat_param) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.concat_param) +} +inline ::caffe::ConcatParameter* LayerParameter::release_concat_param() { + auto temp = unsafe_arena_release_concat_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ConcatParameter* LayerParameter::unsafe_arena_release_concat_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.concat_param) + _has_bits_[0] &= ~0x00000040u; + ::caffe::ConcatParameter* temp = concat_param_; + concat_param_ = nullptr; + return temp; +} +inline ::caffe::ConcatParameter* LayerParameter::_internal_mutable_concat_param() { + _has_bits_[0] |= 0x00000040u; + if (concat_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ConcatParameter>(GetArena()); + concat_param_ = p; + } + return concat_param_; +} +inline ::caffe::ConcatParameter* LayerParameter::mutable_concat_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.concat_param) + return _internal_mutable_concat_param(); +} +inline void LayerParameter::set_allocated_concat_param(::caffe::ConcatParameter* concat_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete concat_param_; + } + if (concat_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(concat_param); + if (message_arena != submessage_arena) { + concat_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, concat_param, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + concat_param_ = concat_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.concat_param) +} + +// optional .caffe.ContrastiveLossParameter contrastive_loss_param = 105; +inline bool LayerParameter::_internal_has_contrastive_loss_param() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || contrastive_loss_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_contrastive_loss_param() const { + return _internal_has_contrastive_loss_param(); +} +inline void LayerParameter::clear_contrastive_loss_param() { + if (contrastive_loss_param_ != nullptr) contrastive_loss_param_->Clear(); + _has_bits_[0] &= ~0x00000080u; +} +inline const ::caffe::ContrastiveLossParameter& LayerParameter::_internal_contrastive_loss_param() const { + const ::caffe::ContrastiveLossParameter* p = contrastive_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ContrastiveLossParameter_default_instance_); +} +inline const ::caffe::ContrastiveLossParameter& LayerParameter::contrastive_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.contrastive_loss_param) + return _internal_contrastive_loss_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_contrastive_loss_param( + ::caffe::ContrastiveLossParameter* contrastive_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(contrastive_loss_param_); + } + contrastive_loss_param_ = contrastive_loss_param; + if (contrastive_loss_param) { + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.contrastive_loss_param) +} +inline ::caffe::ContrastiveLossParameter* LayerParameter::release_contrastive_loss_param() { + auto temp = unsafe_arena_release_contrastive_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ContrastiveLossParameter* LayerParameter::unsafe_arena_release_contrastive_loss_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.contrastive_loss_param) + _has_bits_[0] &= ~0x00000080u; + ::caffe::ContrastiveLossParameter* temp = contrastive_loss_param_; + contrastive_loss_param_ = nullptr; + return temp; +} +inline ::caffe::ContrastiveLossParameter* LayerParameter::_internal_mutable_contrastive_loss_param() { + _has_bits_[0] |= 0x00000080u; + if (contrastive_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ContrastiveLossParameter>(GetArena()); + contrastive_loss_param_ = p; + } + return contrastive_loss_param_; +} +inline ::caffe::ContrastiveLossParameter* LayerParameter::mutable_contrastive_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.contrastive_loss_param) + return _internal_mutable_contrastive_loss_param(); +} +inline void LayerParameter::set_allocated_contrastive_loss_param(::caffe::ContrastiveLossParameter* contrastive_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete contrastive_loss_param_; + } + if (contrastive_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(contrastive_loss_param); + if (message_arena != submessage_arena) { + contrastive_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, contrastive_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + contrastive_loss_param_ = contrastive_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.contrastive_loss_param) +} + +// optional .caffe.ConvolutionParameter convolution_param = 106; +inline bool LayerParameter::_internal_has_convolution_param() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || convolution_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_convolution_param() const { + return _internal_has_convolution_param(); +} +inline void LayerParameter::clear_convolution_param() { + if (convolution_param_ != nullptr) convolution_param_->Clear(); + _has_bits_[0] &= ~0x00000100u; +} +inline const ::caffe::ConvolutionParameter& LayerParameter::_internal_convolution_param() const { + const ::caffe::ConvolutionParameter* p = convolution_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ConvolutionParameter_default_instance_); +} +inline const ::caffe::ConvolutionParameter& LayerParameter::convolution_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.convolution_param) + return _internal_convolution_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_convolution_param( + ::caffe::ConvolutionParameter* convolution_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(convolution_param_); + } + convolution_param_ = convolution_param; + if (convolution_param) { + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.convolution_param) +} +inline ::caffe::ConvolutionParameter* LayerParameter::release_convolution_param() { + auto temp = unsafe_arena_release_convolution_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ConvolutionParameter* LayerParameter::unsafe_arena_release_convolution_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.convolution_param) + _has_bits_[0] &= ~0x00000100u; + ::caffe::ConvolutionParameter* temp = convolution_param_; + convolution_param_ = nullptr; + return temp; +} +inline ::caffe::ConvolutionParameter* LayerParameter::_internal_mutable_convolution_param() { + _has_bits_[0] |= 0x00000100u; + if (convolution_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ConvolutionParameter>(GetArena()); + convolution_param_ = p; + } + return convolution_param_; +} +inline ::caffe::ConvolutionParameter* LayerParameter::mutable_convolution_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.convolution_param) + return _internal_mutable_convolution_param(); +} +inline void LayerParameter::set_allocated_convolution_param(::caffe::ConvolutionParameter* convolution_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete convolution_param_; + } + if (convolution_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(convolution_param); + if (message_arena != submessage_arena) { + convolution_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, convolution_param, submessage_arena); + } + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + convolution_param_ = convolution_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.convolution_param) +} + +// optional .caffe.CropParameter crop_param = 144; +inline bool LayerParameter::_internal_has_crop_param() const { + bool value = (_has_bits_[1] & 0x00004000u) != 0; + PROTOBUF_ASSUME(!value || crop_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_crop_param() const { + return _internal_has_crop_param(); +} +inline void LayerParameter::clear_crop_param() { + if (crop_param_ != nullptr) crop_param_->Clear(); + _has_bits_[1] &= ~0x00004000u; +} +inline const ::caffe::CropParameter& LayerParameter::_internal_crop_param() const { + const ::caffe::CropParameter* p = crop_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_CropParameter_default_instance_); +} +inline const ::caffe::CropParameter& LayerParameter::crop_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.crop_param) + return _internal_crop_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_crop_param( + ::caffe::CropParameter* crop_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(crop_param_); + } + crop_param_ = crop_param; + if (crop_param) { + _has_bits_[1] |= 0x00004000u; + } else { + _has_bits_[1] &= ~0x00004000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.crop_param) +} +inline ::caffe::CropParameter* LayerParameter::release_crop_param() { + auto temp = unsafe_arena_release_crop_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::CropParameter* LayerParameter::unsafe_arena_release_crop_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.crop_param) + _has_bits_[1] &= ~0x00004000u; + ::caffe::CropParameter* temp = crop_param_; + crop_param_ = nullptr; + return temp; +} +inline ::caffe::CropParameter* LayerParameter::_internal_mutable_crop_param() { + _has_bits_[1] |= 0x00004000u; + if (crop_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::CropParameter>(GetArena()); + crop_param_ = p; + } + return crop_param_; +} +inline ::caffe::CropParameter* LayerParameter::mutable_crop_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.crop_param) + return _internal_mutable_crop_param(); +} +inline void LayerParameter::set_allocated_crop_param(::caffe::CropParameter* crop_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete crop_param_; + } + if (crop_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(crop_param); + if (message_arena != submessage_arena) { + crop_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, crop_param, submessage_arena); + } + _has_bits_[1] |= 0x00004000u; + } else { + _has_bits_[1] &= ~0x00004000u; + } + crop_param_ = crop_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.crop_param) +} + +// optional .caffe.DataParameter data_param = 107; +inline bool LayerParameter::_internal_has_data_param() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + PROTOBUF_ASSUME(!value || data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_data_param() const { + return _internal_has_data_param(); +} +inline void LayerParameter::clear_data_param() { + if (data_param_ != nullptr) data_param_->Clear(); + _has_bits_[0] &= ~0x00000200u; +} +inline const ::caffe::DataParameter& LayerParameter::_internal_data_param() const { + const ::caffe::DataParameter* p = data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DataParameter_default_instance_); +} +inline const ::caffe::DataParameter& LayerParameter::data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.data_param) + return _internal_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_data_param( + ::caffe::DataParameter* data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(data_param_); + } + data_param_ = data_param; + if (data_param) { + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.data_param) +} +inline ::caffe::DataParameter* LayerParameter::release_data_param() { + auto temp = unsafe_arena_release_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DataParameter* LayerParameter::unsafe_arena_release_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.data_param) + _has_bits_[0] &= ~0x00000200u; + ::caffe::DataParameter* temp = data_param_; + data_param_ = nullptr; + return temp; +} +inline ::caffe::DataParameter* LayerParameter::_internal_mutable_data_param() { + _has_bits_[0] |= 0x00000200u; + if (data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DataParameter>(GetArena()); + data_param_ = p; + } + return data_param_; +} +inline ::caffe::DataParameter* LayerParameter::mutable_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.data_param) + return _internal_mutable_data_param(); +} +inline void LayerParameter::set_allocated_data_param(::caffe::DataParameter* data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete data_param_; + } + if (data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(data_param); + if (message_arena != submessage_arena) { + data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, data_param, submessage_arena); + } + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + data_param_ = data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.data_param) +} + +// optional .caffe.DropoutParameter dropout_param = 108; +inline bool LayerParameter::_internal_has_dropout_param() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + PROTOBUF_ASSUME(!value || dropout_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_dropout_param() const { + return _internal_has_dropout_param(); +} +inline void LayerParameter::clear_dropout_param() { + if (dropout_param_ != nullptr) dropout_param_->Clear(); + _has_bits_[0] &= ~0x00000400u; +} +inline const ::caffe::DropoutParameter& LayerParameter::_internal_dropout_param() const { + const ::caffe::DropoutParameter* p = dropout_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DropoutParameter_default_instance_); +} +inline const ::caffe::DropoutParameter& LayerParameter::dropout_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.dropout_param) + return _internal_dropout_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_dropout_param( + ::caffe::DropoutParameter* dropout_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dropout_param_); + } + dropout_param_ = dropout_param; + if (dropout_param) { + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.dropout_param) +} +inline ::caffe::DropoutParameter* LayerParameter::release_dropout_param() { + auto temp = unsafe_arena_release_dropout_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DropoutParameter* LayerParameter::unsafe_arena_release_dropout_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.dropout_param) + _has_bits_[0] &= ~0x00000400u; + ::caffe::DropoutParameter* temp = dropout_param_; + dropout_param_ = nullptr; + return temp; +} +inline ::caffe::DropoutParameter* LayerParameter::_internal_mutable_dropout_param() { + _has_bits_[0] |= 0x00000400u; + if (dropout_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DropoutParameter>(GetArena()); + dropout_param_ = p; + } + return dropout_param_; +} +inline ::caffe::DropoutParameter* LayerParameter::mutable_dropout_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.dropout_param) + return _internal_mutable_dropout_param(); +} +inline void LayerParameter::set_allocated_dropout_param(::caffe::DropoutParameter* dropout_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete dropout_param_; + } + if (dropout_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(dropout_param); + if (message_arena != submessage_arena) { + dropout_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dropout_param, submessage_arena); + } + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + dropout_param_ = dropout_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.dropout_param) +} + +// optional .caffe.DummyDataParameter dummy_data_param = 109; +inline bool LayerParameter::_internal_has_dummy_data_param() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || dummy_data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_dummy_data_param() const { + return _internal_has_dummy_data_param(); +} +inline void LayerParameter::clear_dummy_data_param() { + if (dummy_data_param_ != nullptr) dummy_data_param_->Clear(); + _has_bits_[0] &= ~0x00000800u; +} +inline const ::caffe::DummyDataParameter& LayerParameter::_internal_dummy_data_param() const { + const ::caffe::DummyDataParameter* p = dummy_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DummyDataParameter_default_instance_); +} +inline const ::caffe::DummyDataParameter& LayerParameter::dummy_data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.dummy_data_param) + return _internal_dummy_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_dummy_data_param( + ::caffe::DummyDataParameter* dummy_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dummy_data_param_); + } + dummy_data_param_ = dummy_data_param; + if (dummy_data_param) { + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.dummy_data_param) +} +inline ::caffe::DummyDataParameter* LayerParameter::release_dummy_data_param() { + auto temp = unsafe_arena_release_dummy_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DummyDataParameter* LayerParameter::unsafe_arena_release_dummy_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.dummy_data_param) + _has_bits_[0] &= ~0x00000800u; + ::caffe::DummyDataParameter* temp = dummy_data_param_; + dummy_data_param_ = nullptr; + return temp; +} +inline ::caffe::DummyDataParameter* LayerParameter::_internal_mutable_dummy_data_param() { + _has_bits_[0] |= 0x00000800u; + if (dummy_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DummyDataParameter>(GetArena()); + dummy_data_param_ = p; + } + return dummy_data_param_; +} +inline ::caffe::DummyDataParameter* LayerParameter::mutable_dummy_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.dummy_data_param) + return _internal_mutable_dummy_data_param(); +} +inline void LayerParameter::set_allocated_dummy_data_param(::caffe::DummyDataParameter* dummy_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete dummy_data_param_; + } + if (dummy_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(dummy_data_param); + if (message_arena != submessage_arena) { + dummy_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dummy_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + dummy_data_param_ = dummy_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.dummy_data_param) +} + +// optional .caffe.EltwiseParameter eltwise_param = 110; +inline bool LayerParameter::_internal_has_eltwise_param() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + PROTOBUF_ASSUME(!value || eltwise_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_eltwise_param() const { + return _internal_has_eltwise_param(); +} +inline void LayerParameter::clear_eltwise_param() { + if (eltwise_param_ != nullptr) eltwise_param_->Clear(); + _has_bits_[0] &= ~0x00001000u; +} +inline const ::caffe::EltwiseParameter& LayerParameter::_internal_eltwise_param() const { + const ::caffe::EltwiseParameter* p = eltwise_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_EltwiseParameter_default_instance_); +} +inline const ::caffe::EltwiseParameter& LayerParameter::eltwise_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.eltwise_param) + return _internal_eltwise_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_eltwise_param( + ::caffe::EltwiseParameter* eltwise_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(eltwise_param_); + } + eltwise_param_ = eltwise_param; + if (eltwise_param) { + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.eltwise_param) +} +inline ::caffe::EltwiseParameter* LayerParameter::release_eltwise_param() { + auto temp = unsafe_arena_release_eltwise_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::EltwiseParameter* LayerParameter::unsafe_arena_release_eltwise_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.eltwise_param) + _has_bits_[0] &= ~0x00001000u; + ::caffe::EltwiseParameter* temp = eltwise_param_; + eltwise_param_ = nullptr; + return temp; +} +inline ::caffe::EltwiseParameter* LayerParameter::_internal_mutable_eltwise_param() { + _has_bits_[0] |= 0x00001000u; + if (eltwise_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::EltwiseParameter>(GetArena()); + eltwise_param_ = p; + } + return eltwise_param_; +} +inline ::caffe::EltwiseParameter* LayerParameter::mutable_eltwise_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.eltwise_param) + return _internal_mutable_eltwise_param(); +} +inline void LayerParameter::set_allocated_eltwise_param(::caffe::EltwiseParameter* eltwise_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete eltwise_param_; + } + if (eltwise_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(eltwise_param); + if (message_arena != submessage_arena) { + eltwise_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, eltwise_param, submessage_arena); + } + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + eltwise_param_ = eltwise_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.eltwise_param) +} + +// optional .caffe.ELUParameter elu_param = 140; +inline bool LayerParameter::_internal_has_elu_param() const { + bool value = (_has_bits_[1] & 0x00000400u) != 0; + PROTOBUF_ASSUME(!value || elu_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_elu_param() const { + return _internal_has_elu_param(); +} +inline void LayerParameter::clear_elu_param() { + if (elu_param_ != nullptr) elu_param_->Clear(); + _has_bits_[1] &= ~0x00000400u; +} +inline const ::caffe::ELUParameter& LayerParameter::_internal_elu_param() const { + const ::caffe::ELUParameter* p = elu_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ELUParameter_default_instance_); +} +inline const ::caffe::ELUParameter& LayerParameter::elu_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.elu_param) + return _internal_elu_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_elu_param( + ::caffe::ELUParameter* elu_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(elu_param_); + } + elu_param_ = elu_param; + if (elu_param) { + _has_bits_[1] |= 0x00000400u; + } else { + _has_bits_[1] &= ~0x00000400u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.elu_param) +} +inline ::caffe::ELUParameter* LayerParameter::release_elu_param() { + auto temp = unsafe_arena_release_elu_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ELUParameter* LayerParameter::unsafe_arena_release_elu_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.elu_param) + _has_bits_[1] &= ~0x00000400u; + ::caffe::ELUParameter* temp = elu_param_; + elu_param_ = nullptr; + return temp; +} +inline ::caffe::ELUParameter* LayerParameter::_internal_mutable_elu_param() { + _has_bits_[1] |= 0x00000400u; + if (elu_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ELUParameter>(GetArena()); + elu_param_ = p; + } + return elu_param_; +} +inline ::caffe::ELUParameter* LayerParameter::mutable_elu_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.elu_param) + return _internal_mutable_elu_param(); +} +inline void LayerParameter::set_allocated_elu_param(::caffe::ELUParameter* elu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete elu_param_; + } + if (elu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(elu_param); + if (message_arena != submessage_arena) { + elu_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, elu_param, submessage_arena); + } + _has_bits_[1] |= 0x00000400u; + } else { + _has_bits_[1] &= ~0x00000400u; + } + elu_param_ = elu_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.elu_param) +} + +// optional .caffe.EmbedParameter embed_param = 137; +inline bool LayerParameter::_internal_has_embed_param() const { + bool value = (_has_bits_[1] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || embed_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_embed_param() const { + return _internal_has_embed_param(); +} +inline void LayerParameter::clear_embed_param() { + if (embed_param_ != nullptr) embed_param_->Clear(); + _has_bits_[1] &= ~0x00000080u; +} +inline const ::caffe::EmbedParameter& LayerParameter::_internal_embed_param() const { + const ::caffe::EmbedParameter* p = embed_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_EmbedParameter_default_instance_); +} +inline const ::caffe::EmbedParameter& LayerParameter::embed_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.embed_param) + return _internal_embed_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_embed_param( + ::caffe::EmbedParameter* embed_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(embed_param_); + } + embed_param_ = embed_param; + if (embed_param) { + _has_bits_[1] |= 0x00000080u; + } else { + _has_bits_[1] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.embed_param) +} +inline ::caffe::EmbedParameter* LayerParameter::release_embed_param() { + auto temp = unsafe_arena_release_embed_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::EmbedParameter* LayerParameter::unsafe_arena_release_embed_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.embed_param) + _has_bits_[1] &= ~0x00000080u; + ::caffe::EmbedParameter* temp = embed_param_; + embed_param_ = nullptr; + return temp; +} +inline ::caffe::EmbedParameter* LayerParameter::_internal_mutable_embed_param() { + _has_bits_[1] |= 0x00000080u; + if (embed_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::EmbedParameter>(GetArena()); + embed_param_ = p; + } + return embed_param_; +} +inline ::caffe::EmbedParameter* LayerParameter::mutable_embed_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.embed_param) + return _internal_mutable_embed_param(); +} +inline void LayerParameter::set_allocated_embed_param(::caffe::EmbedParameter* embed_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete embed_param_; + } + if (embed_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(embed_param); + if (message_arena != submessage_arena) { + embed_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, embed_param, submessage_arena); + } + _has_bits_[1] |= 0x00000080u; + } else { + _has_bits_[1] &= ~0x00000080u; + } + embed_param_ = embed_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.embed_param) +} + +// optional .caffe.ExpParameter exp_param = 111; +inline bool LayerParameter::_internal_has_exp_param() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + PROTOBUF_ASSUME(!value || exp_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_exp_param() const { + return _internal_has_exp_param(); +} +inline void LayerParameter::clear_exp_param() { + if (exp_param_ != nullptr) exp_param_->Clear(); + _has_bits_[0] &= ~0x00002000u; +} +inline const ::caffe::ExpParameter& LayerParameter::_internal_exp_param() const { + const ::caffe::ExpParameter* p = exp_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ExpParameter_default_instance_); +} +inline const ::caffe::ExpParameter& LayerParameter::exp_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.exp_param) + return _internal_exp_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_exp_param( + ::caffe::ExpParameter* exp_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(exp_param_); + } + exp_param_ = exp_param; + if (exp_param) { + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.exp_param) +} +inline ::caffe::ExpParameter* LayerParameter::release_exp_param() { + auto temp = unsafe_arena_release_exp_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ExpParameter* LayerParameter::unsafe_arena_release_exp_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.exp_param) + _has_bits_[0] &= ~0x00002000u; + ::caffe::ExpParameter* temp = exp_param_; + exp_param_ = nullptr; + return temp; +} +inline ::caffe::ExpParameter* LayerParameter::_internal_mutable_exp_param() { + _has_bits_[0] |= 0x00002000u; + if (exp_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ExpParameter>(GetArena()); + exp_param_ = p; + } + return exp_param_; +} +inline ::caffe::ExpParameter* LayerParameter::mutable_exp_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.exp_param) + return _internal_mutable_exp_param(); +} +inline void LayerParameter::set_allocated_exp_param(::caffe::ExpParameter* exp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete exp_param_; + } + if (exp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(exp_param); + if (message_arena != submessage_arena) { + exp_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, exp_param, submessage_arena); + } + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + exp_param_ = exp_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.exp_param) +} + +// optional .caffe.FlattenParameter flatten_param = 135; +inline bool LayerParameter::_internal_has_flatten_param() const { + bool value = (_has_bits_[1] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || flatten_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_flatten_param() const { + return _internal_has_flatten_param(); +} +inline void LayerParameter::clear_flatten_param() { + if (flatten_param_ != nullptr) flatten_param_->Clear(); + _has_bits_[1] &= ~0x00000020u; +} +inline const ::caffe::FlattenParameter& LayerParameter::_internal_flatten_param() const { + const ::caffe::FlattenParameter* p = flatten_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FlattenParameter_default_instance_); +} +inline const ::caffe::FlattenParameter& LayerParameter::flatten_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.flatten_param) + return _internal_flatten_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_flatten_param( + ::caffe::FlattenParameter* flatten_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(flatten_param_); + } + flatten_param_ = flatten_param; + if (flatten_param) { + _has_bits_[1] |= 0x00000020u; + } else { + _has_bits_[1] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.flatten_param) +} +inline ::caffe::FlattenParameter* LayerParameter::release_flatten_param() { + auto temp = unsafe_arena_release_flatten_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FlattenParameter* LayerParameter::unsafe_arena_release_flatten_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.flatten_param) + _has_bits_[1] &= ~0x00000020u; + ::caffe::FlattenParameter* temp = flatten_param_; + flatten_param_ = nullptr; + return temp; +} +inline ::caffe::FlattenParameter* LayerParameter::_internal_mutable_flatten_param() { + _has_bits_[1] |= 0x00000020u; + if (flatten_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FlattenParameter>(GetArena()); + flatten_param_ = p; + } + return flatten_param_; +} +inline ::caffe::FlattenParameter* LayerParameter::mutable_flatten_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.flatten_param) + return _internal_mutable_flatten_param(); +} +inline void LayerParameter::set_allocated_flatten_param(::caffe::FlattenParameter* flatten_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete flatten_param_; + } + if (flatten_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(flatten_param); + if (message_arena != submessage_arena) { + flatten_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, flatten_param, submessage_arena); + } + _has_bits_[1] |= 0x00000020u; + } else { + _has_bits_[1] &= ~0x00000020u; + } + flatten_param_ = flatten_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.flatten_param) +} + +// optional .caffe.HDF5DataParameter hdf5_data_param = 112; +inline bool LayerParameter::_internal_has_hdf5_data_param() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + PROTOBUF_ASSUME(!value || hdf5_data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_hdf5_data_param() const { + return _internal_has_hdf5_data_param(); +} +inline void LayerParameter::clear_hdf5_data_param() { + if (hdf5_data_param_ != nullptr) hdf5_data_param_->Clear(); + _has_bits_[0] &= ~0x00004000u; +} +inline const ::caffe::HDF5DataParameter& LayerParameter::_internal_hdf5_data_param() const { + const ::caffe::HDF5DataParameter* p = hdf5_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HDF5DataParameter_default_instance_); +} +inline const ::caffe::HDF5DataParameter& LayerParameter::hdf5_data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.hdf5_data_param) + return _internal_hdf5_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_hdf5_data_param( + ::caffe::HDF5DataParameter* hdf5_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hdf5_data_param_); + } + hdf5_data_param_ = hdf5_data_param; + if (hdf5_data_param) { + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.hdf5_data_param) +} +inline ::caffe::HDF5DataParameter* LayerParameter::release_hdf5_data_param() { + auto temp = unsafe_arena_release_hdf5_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HDF5DataParameter* LayerParameter::unsafe_arena_release_hdf5_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.hdf5_data_param) + _has_bits_[0] &= ~0x00004000u; + ::caffe::HDF5DataParameter* temp = hdf5_data_param_; + hdf5_data_param_ = nullptr; + return temp; +} +inline ::caffe::HDF5DataParameter* LayerParameter::_internal_mutable_hdf5_data_param() { + _has_bits_[0] |= 0x00004000u; + if (hdf5_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HDF5DataParameter>(GetArena()); + hdf5_data_param_ = p; + } + return hdf5_data_param_; +} +inline ::caffe::HDF5DataParameter* LayerParameter::mutable_hdf5_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.hdf5_data_param) + return _internal_mutable_hdf5_data_param(); +} +inline void LayerParameter::set_allocated_hdf5_data_param(::caffe::HDF5DataParameter* hdf5_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hdf5_data_param_; + } + if (hdf5_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hdf5_data_param); + if (message_arena != submessage_arena) { + hdf5_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hdf5_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + hdf5_data_param_ = hdf5_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.hdf5_data_param) +} + +// optional .caffe.HDF5OutputParameter hdf5_output_param = 113; +inline bool LayerParameter::_internal_has_hdf5_output_param() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + PROTOBUF_ASSUME(!value || hdf5_output_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_hdf5_output_param() const { + return _internal_has_hdf5_output_param(); +} +inline void LayerParameter::clear_hdf5_output_param() { + if (hdf5_output_param_ != nullptr) hdf5_output_param_->Clear(); + _has_bits_[0] &= ~0x00008000u; +} +inline const ::caffe::HDF5OutputParameter& LayerParameter::_internal_hdf5_output_param() const { + const ::caffe::HDF5OutputParameter* p = hdf5_output_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HDF5OutputParameter_default_instance_); +} +inline const ::caffe::HDF5OutputParameter& LayerParameter::hdf5_output_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.hdf5_output_param) + return _internal_hdf5_output_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hdf5_output_param_); + } + hdf5_output_param_ = hdf5_output_param; + if (hdf5_output_param) { + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.hdf5_output_param) +} +inline ::caffe::HDF5OutputParameter* LayerParameter::release_hdf5_output_param() { + auto temp = unsafe_arena_release_hdf5_output_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HDF5OutputParameter* LayerParameter::unsafe_arena_release_hdf5_output_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.hdf5_output_param) + _has_bits_[0] &= ~0x00008000u; + ::caffe::HDF5OutputParameter* temp = hdf5_output_param_; + hdf5_output_param_ = nullptr; + return temp; +} +inline ::caffe::HDF5OutputParameter* LayerParameter::_internal_mutable_hdf5_output_param() { + _has_bits_[0] |= 0x00008000u; + if (hdf5_output_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HDF5OutputParameter>(GetArena()); + hdf5_output_param_ = p; + } + return hdf5_output_param_; +} +inline ::caffe::HDF5OutputParameter* LayerParameter::mutable_hdf5_output_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.hdf5_output_param) + return _internal_mutable_hdf5_output_param(); +} +inline void LayerParameter::set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hdf5_output_param_; + } + if (hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hdf5_output_param); + if (message_arena != submessage_arena) { + hdf5_output_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hdf5_output_param, submessage_arena); + } + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + hdf5_output_param_ = hdf5_output_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.hdf5_output_param) +} + +// optional .caffe.HingeLossParameter hinge_loss_param = 114; +inline bool LayerParameter::_internal_has_hinge_loss_param() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + PROTOBUF_ASSUME(!value || hinge_loss_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_hinge_loss_param() const { + return _internal_has_hinge_loss_param(); +} +inline void LayerParameter::clear_hinge_loss_param() { + if (hinge_loss_param_ != nullptr) hinge_loss_param_->Clear(); + _has_bits_[0] &= ~0x00010000u; +} +inline const ::caffe::HingeLossParameter& LayerParameter::_internal_hinge_loss_param() const { + const ::caffe::HingeLossParameter* p = hinge_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HingeLossParameter_default_instance_); +} +inline const ::caffe::HingeLossParameter& LayerParameter::hinge_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.hinge_loss_param) + return _internal_hinge_loss_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_hinge_loss_param( + ::caffe::HingeLossParameter* hinge_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hinge_loss_param_); + } + hinge_loss_param_ = hinge_loss_param; + if (hinge_loss_param) { + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.hinge_loss_param) +} +inline ::caffe::HingeLossParameter* LayerParameter::release_hinge_loss_param() { + auto temp = unsafe_arena_release_hinge_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HingeLossParameter* LayerParameter::unsafe_arena_release_hinge_loss_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.hinge_loss_param) + _has_bits_[0] &= ~0x00010000u; + ::caffe::HingeLossParameter* temp = hinge_loss_param_; + hinge_loss_param_ = nullptr; + return temp; +} +inline ::caffe::HingeLossParameter* LayerParameter::_internal_mutable_hinge_loss_param() { + _has_bits_[0] |= 0x00010000u; + if (hinge_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HingeLossParameter>(GetArena()); + hinge_loss_param_ = p; + } + return hinge_loss_param_; +} +inline ::caffe::HingeLossParameter* LayerParameter::mutable_hinge_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.hinge_loss_param) + return _internal_mutable_hinge_loss_param(); +} +inline void LayerParameter::set_allocated_hinge_loss_param(::caffe::HingeLossParameter* hinge_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hinge_loss_param_; + } + if (hinge_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hinge_loss_param); + if (message_arena != submessage_arena) { + hinge_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hinge_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + hinge_loss_param_ = hinge_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.hinge_loss_param) +} + +// optional .caffe.ImageDataParameter image_data_param = 115; +inline bool LayerParameter::_internal_has_image_data_param() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + PROTOBUF_ASSUME(!value || image_data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_image_data_param() const { + return _internal_has_image_data_param(); +} +inline void LayerParameter::clear_image_data_param() { + if (image_data_param_ != nullptr) image_data_param_->Clear(); + _has_bits_[0] &= ~0x00020000u; +} +inline const ::caffe::ImageDataParameter& LayerParameter::_internal_image_data_param() const { + const ::caffe::ImageDataParameter* p = image_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ImageDataParameter_default_instance_); +} +inline const ::caffe::ImageDataParameter& LayerParameter::image_data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.image_data_param) + return _internal_image_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_image_data_param( + ::caffe::ImageDataParameter* image_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(image_data_param_); + } + image_data_param_ = image_data_param; + if (image_data_param) { + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.image_data_param) +} +inline ::caffe::ImageDataParameter* LayerParameter::release_image_data_param() { + auto temp = unsafe_arena_release_image_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ImageDataParameter* LayerParameter::unsafe_arena_release_image_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.image_data_param) + _has_bits_[0] &= ~0x00020000u; + ::caffe::ImageDataParameter* temp = image_data_param_; + image_data_param_ = nullptr; + return temp; +} +inline ::caffe::ImageDataParameter* LayerParameter::_internal_mutable_image_data_param() { + _has_bits_[0] |= 0x00020000u; + if (image_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ImageDataParameter>(GetArena()); + image_data_param_ = p; + } + return image_data_param_; +} +inline ::caffe::ImageDataParameter* LayerParameter::mutable_image_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.image_data_param) + return _internal_mutable_image_data_param(); +} +inline void LayerParameter::set_allocated_image_data_param(::caffe::ImageDataParameter* image_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete image_data_param_; + } + if (image_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(image_data_param); + if (message_arena != submessage_arena) { + image_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, image_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + image_data_param_ = image_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.image_data_param) +} + +// optional .caffe.InfogainLossParameter infogain_loss_param = 116; +inline bool LayerParameter::_internal_has_infogain_loss_param() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + PROTOBUF_ASSUME(!value || infogain_loss_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_infogain_loss_param() const { + return _internal_has_infogain_loss_param(); +} +inline void LayerParameter::clear_infogain_loss_param() { + if (infogain_loss_param_ != nullptr) infogain_loss_param_->Clear(); + _has_bits_[0] &= ~0x00040000u; +} +inline const ::caffe::InfogainLossParameter& LayerParameter::_internal_infogain_loss_param() const { + const ::caffe::InfogainLossParameter* p = infogain_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_InfogainLossParameter_default_instance_); +} +inline const ::caffe::InfogainLossParameter& LayerParameter::infogain_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.infogain_loss_param) + return _internal_infogain_loss_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_infogain_loss_param( + ::caffe::InfogainLossParameter* infogain_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(infogain_loss_param_); + } + infogain_loss_param_ = infogain_loss_param; + if (infogain_loss_param) { + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.infogain_loss_param) +} +inline ::caffe::InfogainLossParameter* LayerParameter::release_infogain_loss_param() { + auto temp = unsafe_arena_release_infogain_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::InfogainLossParameter* LayerParameter::unsafe_arena_release_infogain_loss_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.infogain_loss_param) + _has_bits_[0] &= ~0x00040000u; + ::caffe::InfogainLossParameter* temp = infogain_loss_param_; + infogain_loss_param_ = nullptr; + return temp; +} +inline ::caffe::InfogainLossParameter* LayerParameter::_internal_mutable_infogain_loss_param() { + _has_bits_[0] |= 0x00040000u; + if (infogain_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::InfogainLossParameter>(GetArena()); + infogain_loss_param_ = p; + } + return infogain_loss_param_; +} +inline ::caffe::InfogainLossParameter* LayerParameter::mutable_infogain_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.infogain_loss_param) + return _internal_mutable_infogain_loss_param(); +} +inline void LayerParameter::set_allocated_infogain_loss_param(::caffe::InfogainLossParameter* infogain_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete infogain_loss_param_; + } + if (infogain_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(infogain_loss_param); + if (message_arena != submessage_arena) { + infogain_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, infogain_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + infogain_loss_param_ = infogain_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.infogain_loss_param) +} + +// optional .caffe.InnerProductParameter inner_product_param = 117; +inline bool LayerParameter::_internal_has_inner_product_param() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + PROTOBUF_ASSUME(!value || inner_product_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_inner_product_param() const { + return _internal_has_inner_product_param(); +} +inline void LayerParameter::clear_inner_product_param() { + if (inner_product_param_ != nullptr) inner_product_param_->Clear(); + _has_bits_[0] &= ~0x00080000u; +} +inline const ::caffe::InnerProductParameter& LayerParameter::_internal_inner_product_param() const { + const ::caffe::InnerProductParameter* p = inner_product_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_InnerProductParameter_default_instance_); +} +inline const ::caffe::InnerProductParameter& LayerParameter::inner_product_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.inner_product_param) + return _internal_inner_product_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_inner_product_param( + ::caffe::InnerProductParameter* inner_product_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(inner_product_param_); + } + inner_product_param_ = inner_product_param; + if (inner_product_param) { + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.inner_product_param) +} +inline ::caffe::InnerProductParameter* LayerParameter::release_inner_product_param() { + auto temp = unsafe_arena_release_inner_product_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::InnerProductParameter* LayerParameter::unsafe_arena_release_inner_product_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.inner_product_param) + _has_bits_[0] &= ~0x00080000u; + ::caffe::InnerProductParameter* temp = inner_product_param_; + inner_product_param_ = nullptr; + return temp; +} +inline ::caffe::InnerProductParameter* LayerParameter::_internal_mutable_inner_product_param() { + _has_bits_[0] |= 0x00080000u; + if (inner_product_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::InnerProductParameter>(GetArena()); + inner_product_param_ = p; + } + return inner_product_param_; +} +inline ::caffe::InnerProductParameter* LayerParameter::mutable_inner_product_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.inner_product_param) + return _internal_mutable_inner_product_param(); +} +inline void LayerParameter::set_allocated_inner_product_param(::caffe::InnerProductParameter* inner_product_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete inner_product_param_; + } + if (inner_product_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(inner_product_param); + if (message_arena != submessage_arena) { + inner_product_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, inner_product_param, submessage_arena); + } + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + inner_product_param_ = inner_product_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.inner_product_param) +} + +// optional .caffe.InputParameter input_param = 143; +inline bool LayerParameter::_internal_has_input_param() const { + bool value = (_has_bits_[1] & 0x00002000u) != 0; + PROTOBUF_ASSUME(!value || input_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_input_param() const { + return _internal_has_input_param(); +} +inline void LayerParameter::clear_input_param() { + if (input_param_ != nullptr) input_param_->Clear(); + _has_bits_[1] &= ~0x00002000u; +} +inline const ::caffe::InputParameter& LayerParameter::_internal_input_param() const { + const ::caffe::InputParameter* p = input_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_InputParameter_default_instance_); +} +inline const ::caffe::InputParameter& LayerParameter::input_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.input_param) + return _internal_input_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_input_param( + ::caffe::InputParameter* input_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(input_param_); + } + input_param_ = input_param; + if (input_param) { + _has_bits_[1] |= 0x00002000u; + } else { + _has_bits_[1] &= ~0x00002000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.input_param) +} +inline ::caffe::InputParameter* LayerParameter::release_input_param() { + auto temp = unsafe_arena_release_input_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::InputParameter* LayerParameter::unsafe_arena_release_input_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.input_param) + _has_bits_[1] &= ~0x00002000u; + ::caffe::InputParameter* temp = input_param_; + input_param_ = nullptr; + return temp; +} +inline ::caffe::InputParameter* LayerParameter::_internal_mutable_input_param() { + _has_bits_[1] |= 0x00002000u; + if (input_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::InputParameter>(GetArena()); + input_param_ = p; + } + return input_param_; +} +inline ::caffe::InputParameter* LayerParameter::mutable_input_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.input_param) + return _internal_mutable_input_param(); +} +inline void LayerParameter::set_allocated_input_param(::caffe::InputParameter* input_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete input_param_; + } + if (input_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(input_param); + if (message_arena != submessage_arena) { + input_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, input_param, submessage_arena); + } + _has_bits_[1] |= 0x00002000u; + } else { + _has_bits_[1] &= ~0x00002000u; + } + input_param_ = input_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.input_param) +} + +// optional .caffe.LogParameter log_param = 134; +inline bool LayerParameter::_internal_has_log_param() const { + bool value = (_has_bits_[1] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || log_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_log_param() const { + return _internal_has_log_param(); +} +inline void LayerParameter::clear_log_param() { + if (log_param_ != nullptr) log_param_->Clear(); + _has_bits_[1] &= ~0x00000010u; +} +inline const ::caffe::LogParameter& LayerParameter::_internal_log_param() const { + const ::caffe::LogParameter* p = log_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_LogParameter_default_instance_); +} +inline const ::caffe::LogParameter& LayerParameter::log_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.log_param) + return _internal_log_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_log_param( + ::caffe::LogParameter* log_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(log_param_); + } + log_param_ = log_param; + if (log_param) { + _has_bits_[1] |= 0x00000010u; + } else { + _has_bits_[1] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.log_param) +} +inline ::caffe::LogParameter* LayerParameter::release_log_param() { + auto temp = unsafe_arena_release_log_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::LogParameter* LayerParameter::unsafe_arena_release_log_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.log_param) + _has_bits_[1] &= ~0x00000010u; + ::caffe::LogParameter* temp = log_param_; + log_param_ = nullptr; + return temp; +} +inline ::caffe::LogParameter* LayerParameter::_internal_mutable_log_param() { + _has_bits_[1] |= 0x00000010u; + if (log_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::LogParameter>(GetArena()); + log_param_ = p; + } + return log_param_; +} +inline ::caffe::LogParameter* LayerParameter::mutable_log_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.log_param) + return _internal_mutable_log_param(); +} +inline void LayerParameter::set_allocated_log_param(::caffe::LogParameter* log_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete log_param_; + } + if (log_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(log_param); + if (message_arena != submessage_arena) { + log_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, log_param, submessage_arena); + } + _has_bits_[1] |= 0x00000010u; + } else { + _has_bits_[1] &= ~0x00000010u; + } + log_param_ = log_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.log_param) +} + +// optional .caffe.LRNParameter lrn_param = 118; +inline bool LayerParameter::_internal_has_lrn_param() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + PROTOBUF_ASSUME(!value || lrn_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_lrn_param() const { + return _internal_has_lrn_param(); +} +inline void LayerParameter::clear_lrn_param() { + if (lrn_param_ != nullptr) lrn_param_->Clear(); + _has_bits_[0] &= ~0x00100000u; +} +inline const ::caffe::LRNParameter& LayerParameter::_internal_lrn_param() const { + const ::caffe::LRNParameter* p = lrn_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_LRNParameter_default_instance_); +} +inline const ::caffe::LRNParameter& LayerParameter::lrn_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.lrn_param) + return _internal_lrn_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_lrn_param( + ::caffe::LRNParameter* lrn_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(lrn_param_); + } + lrn_param_ = lrn_param; + if (lrn_param) { + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.lrn_param) +} +inline ::caffe::LRNParameter* LayerParameter::release_lrn_param() { + auto temp = unsafe_arena_release_lrn_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::LRNParameter* LayerParameter::unsafe_arena_release_lrn_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.lrn_param) + _has_bits_[0] &= ~0x00100000u; + ::caffe::LRNParameter* temp = lrn_param_; + lrn_param_ = nullptr; + return temp; +} +inline ::caffe::LRNParameter* LayerParameter::_internal_mutable_lrn_param() { + _has_bits_[0] |= 0x00100000u; + if (lrn_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::LRNParameter>(GetArena()); + lrn_param_ = p; + } + return lrn_param_; +} +inline ::caffe::LRNParameter* LayerParameter::mutable_lrn_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.lrn_param) + return _internal_mutable_lrn_param(); +} +inline void LayerParameter::set_allocated_lrn_param(::caffe::LRNParameter* lrn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete lrn_param_; + } + if (lrn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(lrn_param); + if (message_arena != submessage_arena) { + lrn_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, lrn_param, submessage_arena); + } + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + lrn_param_ = lrn_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.lrn_param) +} + +// optional .caffe.MemoryDataParameter memory_data_param = 119; +inline bool LayerParameter::_internal_has_memory_data_param() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + PROTOBUF_ASSUME(!value || memory_data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_memory_data_param() const { + return _internal_has_memory_data_param(); +} +inline void LayerParameter::clear_memory_data_param() { + if (memory_data_param_ != nullptr) memory_data_param_->Clear(); + _has_bits_[0] &= ~0x00200000u; +} +inline const ::caffe::MemoryDataParameter& LayerParameter::_internal_memory_data_param() const { + const ::caffe::MemoryDataParameter* p = memory_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_MemoryDataParameter_default_instance_); +} +inline const ::caffe::MemoryDataParameter& LayerParameter::memory_data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.memory_data_param) + return _internal_memory_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_memory_data_param( + ::caffe::MemoryDataParameter* memory_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(memory_data_param_); + } + memory_data_param_ = memory_data_param; + if (memory_data_param) { + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.memory_data_param) +} +inline ::caffe::MemoryDataParameter* LayerParameter::release_memory_data_param() { + auto temp = unsafe_arena_release_memory_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::MemoryDataParameter* LayerParameter::unsafe_arena_release_memory_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.memory_data_param) + _has_bits_[0] &= ~0x00200000u; + ::caffe::MemoryDataParameter* temp = memory_data_param_; + memory_data_param_ = nullptr; + return temp; +} +inline ::caffe::MemoryDataParameter* LayerParameter::_internal_mutable_memory_data_param() { + _has_bits_[0] |= 0x00200000u; + if (memory_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::MemoryDataParameter>(GetArena()); + memory_data_param_ = p; + } + return memory_data_param_; +} +inline ::caffe::MemoryDataParameter* LayerParameter::mutable_memory_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.memory_data_param) + return _internal_mutable_memory_data_param(); +} +inline void LayerParameter::set_allocated_memory_data_param(::caffe::MemoryDataParameter* memory_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete memory_data_param_; + } + if (memory_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(memory_data_param); + if (message_arena != submessage_arena) { + memory_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, memory_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + memory_data_param_ = memory_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.memory_data_param) +} + +// optional .caffe.MVNParameter mvn_param = 120; +inline bool LayerParameter::_internal_has_mvn_param() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + PROTOBUF_ASSUME(!value || mvn_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_mvn_param() const { + return _internal_has_mvn_param(); +} +inline void LayerParameter::clear_mvn_param() { + if (mvn_param_ != nullptr) mvn_param_->Clear(); + _has_bits_[0] &= ~0x00400000u; +} +inline const ::caffe::MVNParameter& LayerParameter::_internal_mvn_param() const { + const ::caffe::MVNParameter* p = mvn_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_MVNParameter_default_instance_); +} +inline const ::caffe::MVNParameter& LayerParameter::mvn_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.mvn_param) + return _internal_mvn_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_mvn_param( + ::caffe::MVNParameter* mvn_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(mvn_param_); + } + mvn_param_ = mvn_param; + if (mvn_param) { + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.mvn_param) +} +inline ::caffe::MVNParameter* LayerParameter::release_mvn_param() { + auto temp = unsafe_arena_release_mvn_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::MVNParameter* LayerParameter::unsafe_arena_release_mvn_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.mvn_param) + _has_bits_[0] &= ~0x00400000u; + ::caffe::MVNParameter* temp = mvn_param_; + mvn_param_ = nullptr; + return temp; +} +inline ::caffe::MVNParameter* LayerParameter::_internal_mutable_mvn_param() { + _has_bits_[0] |= 0x00400000u; + if (mvn_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::MVNParameter>(GetArena()); + mvn_param_ = p; + } + return mvn_param_; +} +inline ::caffe::MVNParameter* LayerParameter::mutable_mvn_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.mvn_param) + return _internal_mutable_mvn_param(); +} +inline void LayerParameter::set_allocated_mvn_param(::caffe::MVNParameter* mvn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete mvn_param_; + } + if (mvn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(mvn_param); + if (message_arena != submessage_arena) { + mvn_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, mvn_param, submessage_arena); + } + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + mvn_param_ = mvn_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.mvn_param) +} + +// optional .caffe.ParameterParameter parameter_param = 145; +inline bool LayerParameter::_internal_has_parameter_param() const { + bool value = (_has_bits_[1] & 0x00008000u) != 0; + PROTOBUF_ASSUME(!value || parameter_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_parameter_param() const { + return _internal_has_parameter_param(); +} +inline void LayerParameter::clear_parameter_param() { + if (parameter_param_ != nullptr) parameter_param_->Clear(); + _has_bits_[1] &= ~0x00008000u; +} +inline const ::caffe::ParameterParameter& LayerParameter::_internal_parameter_param() const { + const ::caffe::ParameterParameter* p = parameter_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ParameterParameter_default_instance_); +} +inline const ::caffe::ParameterParameter& LayerParameter::parameter_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.parameter_param) + return _internal_parameter_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_parameter_param( + ::caffe::ParameterParameter* parameter_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(parameter_param_); + } + parameter_param_ = parameter_param; + if (parameter_param) { + _has_bits_[1] |= 0x00008000u; + } else { + _has_bits_[1] &= ~0x00008000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.parameter_param) +} +inline ::caffe::ParameterParameter* LayerParameter::release_parameter_param() { + auto temp = unsafe_arena_release_parameter_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ParameterParameter* LayerParameter::unsafe_arena_release_parameter_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.parameter_param) + _has_bits_[1] &= ~0x00008000u; + ::caffe::ParameterParameter* temp = parameter_param_; + parameter_param_ = nullptr; + return temp; +} +inline ::caffe::ParameterParameter* LayerParameter::_internal_mutable_parameter_param() { + _has_bits_[1] |= 0x00008000u; + if (parameter_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ParameterParameter>(GetArena()); + parameter_param_ = p; + } + return parameter_param_; +} +inline ::caffe::ParameterParameter* LayerParameter::mutable_parameter_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.parameter_param) + return _internal_mutable_parameter_param(); +} +inline void LayerParameter::set_allocated_parameter_param(::caffe::ParameterParameter* parameter_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete parameter_param_; + } + if (parameter_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(parameter_param); + if (message_arena != submessage_arena) { + parameter_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, parameter_param, submessage_arena); + } + _has_bits_[1] |= 0x00008000u; + } else { + _has_bits_[1] &= ~0x00008000u; + } + parameter_param_ = parameter_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.parameter_param) +} + +// optional .caffe.PoolingParameter pooling_param = 121; +inline bool LayerParameter::_internal_has_pooling_param() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + PROTOBUF_ASSUME(!value || pooling_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_pooling_param() const { + return _internal_has_pooling_param(); +} +inline void LayerParameter::clear_pooling_param() { + if (pooling_param_ != nullptr) pooling_param_->Clear(); + _has_bits_[0] &= ~0x00800000u; +} +inline const ::caffe::PoolingParameter& LayerParameter::_internal_pooling_param() const { + const ::caffe::PoolingParameter* p = pooling_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PoolingParameter_default_instance_); +} +inline const ::caffe::PoolingParameter& LayerParameter::pooling_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.pooling_param) + return _internal_pooling_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_pooling_param( + ::caffe::PoolingParameter* pooling_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(pooling_param_); + } + pooling_param_ = pooling_param; + if (pooling_param) { + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.pooling_param) +} +inline ::caffe::PoolingParameter* LayerParameter::release_pooling_param() { + auto temp = unsafe_arena_release_pooling_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PoolingParameter* LayerParameter::unsafe_arena_release_pooling_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.pooling_param) + _has_bits_[0] &= ~0x00800000u; + ::caffe::PoolingParameter* temp = pooling_param_; + pooling_param_ = nullptr; + return temp; +} +inline ::caffe::PoolingParameter* LayerParameter::_internal_mutable_pooling_param() { + _has_bits_[0] |= 0x00800000u; + if (pooling_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PoolingParameter>(GetArena()); + pooling_param_ = p; + } + return pooling_param_; +} +inline ::caffe::PoolingParameter* LayerParameter::mutable_pooling_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.pooling_param) + return _internal_mutable_pooling_param(); +} +inline void LayerParameter::set_allocated_pooling_param(::caffe::PoolingParameter* pooling_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete pooling_param_; + } + if (pooling_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(pooling_param); + if (message_arena != submessage_arena) { + pooling_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, pooling_param, submessage_arena); + } + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + pooling_param_ = pooling_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.pooling_param) +} + +// optional .caffe.PowerParameter power_param = 122; +inline bool LayerParameter::_internal_has_power_param() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + PROTOBUF_ASSUME(!value || power_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_power_param() const { + return _internal_has_power_param(); +} +inline void LayerParameter::clear_power_param() { + if (power_param_ != nullptr) power_param_->Clear(); + _has_bits_[0] &= ~0x01000000u; +} +inline const ::caffe::PowerParameter& LayerParameter::_internal_power_param() const { + const ::caffe::PowerParameter* p = power_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PowerParameter_default_instance_); +} +inline const ::caffe::PowerParameter& LayerParameter::power_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.power_param) + return _internal_power_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_power_param( + ::caffe::PowerParameter* power_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(power_param_); + } + power_param_ = power_param; + if (power_param) { + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.power_param) +} +inline ::caffe::PowerParameter* LayerParameter::release_power_param() { + auto temp = unsafe_arena_release_power_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PowerParameter* LayerParameter::unsafe_arena_release_power_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.power_param) + _has_bits_[0] &= ~0x01000000u; + ::caffe::PowerParameter* temp = power_param_; + power_param_ = nullptr; + return temp; +} +inline ::caffe::PowerParameter* LayerParameter::_internal_mutable_power_param() { + _has_bits_[0] |= 0x01000000u; + if (power_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PowerParameter>(GetArena()); + power_param_ = p; + } + return power_param_; +} +inline ::caffe::PowerParameter* LayerParameter::mutable_power_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.power_param) + return _internal_mutable_power_param(); +} +inline void LayerParameter::set_allocated_power_param(::caffe::PowerParameter* power_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete power_param_; + } + if (power_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(power_param); + if (message_arena != submessage_arena) { + power_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, power_param, submessage_arena); + } + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + power_param_ = power_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.power_param) +} + +// optional .caffe.PReLUParameter prelu_param = 131; +inline bool LayerParameter::_internal_has_prelu_param() const { + bool value = (_has_bits_[1] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || prelu_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_prelu_param() const { + return _internal_has_prelu_param(); +} +inline void LayerParameter::clear_prelu_param() { + if (prelu_param_ != nullptr) prelu_param_->Clear(); + _has_bits_[1] &= ~0x00000002u; +} +inline const ::caffe::PReLUParameter& LayerParameter::_internal_prelu_param() const { + const ::caffe::PReLUParameter* p = prelu_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PReLUParameter_default_instance_); +} +inline const ::caffe::PReLUParameter& LayerParameter::prelu_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.prelu_param) + return _internal_prelu_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_prelu_param( + ::caffe::PReLUParameter* prelu_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(prelu_param_); + } + prelu_param_ = prelu_param; + if (prelu_param) { + _has_bits_[1] |= 0x00000002u; + } else { + _has_bits_[1] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.prelu_param) +} +inline ::caffe::PReLUParameter* LayerParameter::release_prelu_param() { + auto temp = unsafe_arena_release_prelu_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PReLUParameter* LayerParameter::unsafe_arena_release_prelu_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.prelu_param) + _has_bits_[1] &= ~0x00000002u; + ::caffe::PReLUParameter* temp = prelu_param_; + prelu_param_ = nullptr; + return temp; +} +inline ::caffe::PReLUParameter* LayerParameter::_internal_mutable_prelu_param() { + _has_bits_[1] |= 0x00000002u; + if (prelu_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PReLUParameter>(GetArena()); + prelu_param_ = p; + } + return prelu_param_; +} +inline ::caffe::PReLUParameter* LayerParameter::mutable_prelu_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.prelu_param) + return _internal_mutable_prelu_param(); +} +inline void LayerParameter::set_allocated_prelu_param(::caffe::PReLUParameter* prelu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete prelu_param_; + } + if (prelu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(prelu_param); + if (message_arena != submessage_arena) { + prelu_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, prelu_param, submessage_arena); + } + _has_bits_[1] |= 0x00000002u; + } else { + _has_bits_[1] &= ~0x00000002u; + } + prelu_param_ = prelu_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.prelu_param) +} + +// optional .caffe.PythonParameter python_param = 130; +inline bool LayerParameter::_internal_has_python_param() const { + bool value = (_has_bits_[1] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || python_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_python_param() const { + return _internal_has_python_param(); +} +inline void LayerParameter::clear_python_param() { + if (python_param_ != nullptr) python_param_->Clear(); + _has_bits_[1] &= ~0x00000001u; +} +inline const ::caffe::PythonParameter& LayerParameter::_internal_python_param() const { + const ::caffe::PythonParameter* p = python_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PythonParameter_default_instance_); +} +inline const ::caffe::PythonParameter& LayerParameter::python_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.python_param) + return _internal_python_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_python_param( + ::caffe::PythonParameter* python_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(python_param_); + } + python_param_ = python_param; + if (python_param) { + _has_bits_[1] |= 0x00000001u; + } else { + _has_bits_[1] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.python_param) +} +inline ::caffe::PythonParameter* LayerParameter::release_python_param() { + auto temp = unsafe_arena_release_python_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PythonParameter* LayerParameter::unsafe_arena_release_python_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.python_param) + _has_bits_[1] &= ~0x00000001u; + ::caffe::PythonParameter* temp = python_param_; + python_param_ = nullptr; + return temp; +} +inline ::caffe::PythonParameter* LayerParameter::_internal_mutable_python_param() { + _has_bits_[1] |= 0x00000001u; + if (python_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PythonParameter>(GetArena()); + python_param_ = p; + } + return python_param_; +} +inline ::caffe::PythonParameter* LayerParameter::mutable_python_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.python_param) + return _internal_mutable_python_param(); +} +inline void LayerParameter::set_allocated_python_param(::caffe::PythonParameter* python_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete python_param_; + } + if (python_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(python_param); + if (message_arena != submessage_arena) { + python_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, python_param, submessage_arena); + } + _has_bits_[1] |= 0x00000001u; + } else { + _has_bits_[1] &= ~0x00000001u; + } + python_param_ = python_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.python_param) +} + +// optional .caffe.RecurrentParameter recurrent_param = 146; +inline bool LayerParameter::_internal_has_recurrent_param() const { + bool value = (_has_bits_[1] & 0x00010000u) != 0; + PROTOBUF_ASSUME(!value || recurrent_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_recurrent_param() const { + return _internal_has_recurrent_param(); +} +inline void LayerParameter::clear_recurrent_param() { + if (recurrent_param_ != nullptr) recurrent_param_->Clear(); + _has_bits_[1] &= ~0x00010000u; +} +inline const ::caffe::RecurrentParameter& LayerParameter::_internal_recurrent_param() const { + const ::caffe::RecurrentParameter* p = recurrent_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_RecurrentParameter_default_instance_); +} +inline const ::caffe::RecurrentParameter& LayerParameter::recurrent_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.recurrent_param) + return _internal_recurrent_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_recurrent_param( + ::caffe::RecurrentParameter* recurrent_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(recurrent_param_); + } + recurrent_param_ = recurrent_param; + if (recurrent_param) { + _has_bits_[1] |= 0x00010000u; + } else { + _has_bits_[1] &= ~0x00010000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.recurrent_param) +} +inline ::caffe::RecurrentParameter* LayerParameter::release_recurrent_param() { + auto temp = unsafe_arena_release_recurrent_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::RecurrentParameter* LayerParameter::unsafe_arena_release_recurrent_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.recurrent_param) + _has_bits_[1] &= ~0x00010000u; + ::caffe::RecurrentParameter* temp = recurrent_param_; + recurrent_param_ = nullptr; + return temp; +} +inline ::caffe::RecurrentParameter* LayerParameter::_internal_mutable_recurrent_param() { + _has_bits_[1] |= 0x00010000u; + if (recurrent_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::RecurrentParameter>(GetArena()); + recurrent_param_ = p; + } + return recurrent_param_; +} +inline ::caffe::RecurrentParameter* LayerParameter::mutable_recurrent_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.recurrent_param) + return _internal_mutable_recurrent_param(); +} +inline void LayerParameter::set_allocated_recurrent_param(::caffe::RecurrentParameter* recurrent_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete recurrent_param_; + } + if (recurrent_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(recurrent_param); + if (message_arena != submessage_arena) { + recurrent_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, recurrent_param, submessage_arena); + } + _has_bits_[1] |= 0x00010000u; + } else { + _has_bits_[1] &= ~0x00010000u; + } + recurrent_param_ = recurrent_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.recurrent_param) +} + +// optional .caffe.ReductionParameter reduction_param = 136; +inline bool LayerParameter::_internal_has_reduction_param() const { + bool value = (_has_bits_[1] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || reduction_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_reduction_param() const { + return _internal_has_reduction_param(); +} +inline void LayerParameter::clear_reduction_param() { + if (reduction_param_ != nullptr) reduction_param_->Clear(); + _has_bits_[1] &= ~0x00000040u; +} +inline const ::caffe::ReductionParameter& LayerParameter::_internal_reduction_param() const { + const ::caffe::ReductionParameter* p = reduction_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ReductionParameter_default_instance_); +} +inline const ::caffe::ReductionParameter& LayerParameter::reduction_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.reduction_param) + return _internal_reduction_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_reduction_param( + ::caffe::ReductionParameter* reduction_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(reduction_param_); + } + reduction_param_ = reduction_param; + if (reduction_param) { + _has_bits_[1] |= 0x00000040u; + } else { + _has_bits_[1] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.reduction_param) +} +inline ::caffe::ReductionParameter* LayerParameter::release_reduction_param() { + auto temp = unsafe_arena_release_reduction_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ReductionParameter* LayerParameter::unsafe_arena_release_reduction_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.reduction_param) + _has_bits_[1] &= ~0x00000040u; + ::caffe::ReductionParameter* temp = reduction_param_; + reduction_param_ = nullptr; + return temp; +} +inline ::caffe::ReductionParameter* LayerParameter::_internal_mutable_reduction_param() { + _has_bits_[1] |= 0x00000040u; + if (reduction_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ReductionParameter>(GetArena()); + reduction_param_ = p; + } + return reduction_param_; +} +inline ::caffe::ReductionParameter* LayerParameter::mutable_reduction_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.reduction_param) + return _internal_mutable_reduction_param(); +} +inline void LayerParameter::set_allocated_reduction_param(::caffe::ReductionParameter* reduction_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete reduction_param_; + } + if (reduction_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(reduction_param); + if (message_arena != submessage_arena) { + reduction_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, reduction_param, submessage_arena); + } + _has_bits_[1] |= 0x00000040u; + } else { + _has_bits_[1] &= ~0x00000040u; + } + reduction_param_ = reduction_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.reduction_param) +} + +// optional .caffe.ReLUParameter relu_param = 123; +inline bool LayerParameter::_internal_has_relu_param() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + PROTOBUF_ASSUME(!value || relu_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_relu_param() const { + return _internal_has_relu_param(); +} +inline void LayerParameter::clear_relu_param() { + if (relu_param_ != nullptr) relu_param_->Clear(); + _has_bits_[0] &= ~0x02000000u; +} +inline const ::caffe::ReLUParameter& LayerParameter::_internal_relu_param() const { + const ::caffe::ReLUParameter* p = relu_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ReLUParameter_default_instance_); +} +inline const ::caffe::ReLUParameter& LayerParameter::relu_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.relu_param) + return _internal_relu_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_relu_param( + ::caffe::ReLUParameter* relu_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(relu_param_); + } + relu_param_ = relu_param; + if (relu_param) { + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.relu_param) +} +inline ::caffe::ReLUParameter* LayerParameter::release_relu_param() { + auto temp = unsafe_arena_release_relu_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ReLUParameter* LayerParameter::unsafe_arena_release_relu_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.relu_param) + _has_bits_[0] &= ~0x02000000u; + ::caffe::ReLUParameter* temp = relu_param_; + relu_param_ = nullptr; + return temp; +} +inline ::caffe::ReLUParameter* LayerParameter::_internal_mutable_relu_param() { + _has_bits_[0] |= 0x02000000u; + if (relu_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ReLUParameter>(GetArena()); + relu_param_ = p; + } + return relu_param_; +} +inline ::caffe::ReLUParameter* LayerParameter::mutable_relu_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.relu_param) + return _internal_mutable_relu_param(); +} +inline void LayerParameter::set_allocated_relu_param(::caffe::ReLUParameter* relu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete relu_param_; + } + if (relu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(relu_param); + if (message_arena != submessage_arena) { + relu_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, relu_param, submessage_arena); + } + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + relu_param_ = relu_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.relu_param) +} + +// optional .caffe.ReshapeParameter reshape_param = 133; +inline bool LayerParameter::_internal_has_reshape_param() const { + bool value = (_has_bits_[1] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || reshape_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_reshape_param() const { + return _internal_has_reshape_param(); +} +inline void LayerParameter::clear_reshape_param() { + if (reshape_param_ != nullptr) reshape_param_->Clear(); + _has_bits_[1] &= ~0x00000008u; +} +inline const ::caffe::ReshapeParameter& LayerParameter::_internal_reshape_param() const { + const ::caffe::ReshapeParameter* p = reshape_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ReshapeParameter_default_instance_); +} +inline const ::caffe::ReshapeParameter& LayerParameter::reshape_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.reshape_param) + return _internal_reshape_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_reshape_param( + ::caffe::ReshapeParameter* reshape_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(reshape_param_); + } + reshape_param_ = reshape_param; + if (reshape_param) { + _has_bits_[1] |= 0x00000008u; + } else { + _has_bits_[1] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.reshape_param) +} +inline ::caffe::ReshapeParameter* LayerParameter::release_reshape_param() { + auto temp = unsafe_arena_release_reshape_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ReshapeParameter* LayerParameter::unsafe_arena_release_reshape_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.reshape_param) + _has_bits_[1] &= ~0x00000008u; + ::caffe::ReshapeParameter* temp = reshape_param_; + reshape_param_ = nullptr; + return temp; +} +inline ::caffe::ReshapeParameter* LayerParameter::_internal_mutable_reshape_param() { + _has_bits_[1] |= 0x00000008u; + if (reshape_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ReshapeParameter>(GetArena()); + reshape_param_ = p; + } + return reshape_param_; +} +inline ::caffe::ReshapeParameter* LayerParameter::mutable_reshape_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.reshape_param) + return _internal_mutable_reshape_param(); +} +inline void LayerParameter::set_allocated_reshape_param(::caffe::ReshapeParameter* reshape_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete reshape_param_; + } + if (reshape_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(reshape_param); + if (message_arena != submessage_arena) { + reshape_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, reshape_param, submessage_arena); + } + _has_bits_[1] |= 0x00000008u; + } else { + _has_bits_[1] &= ~0x00000008u; + } + reshape_param_ = reshape_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.reshape_param) +} + +// optional .caffe.ScaleParameter scale_param = 142; +inline bool LayerParameter::_internal_has_scale_param() const { + bool value = (_has_bits_[1] & 0x00001000u) != 0; + PROTOBUF_ASSUME(!value || scale_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_scale_param() const { + return _internal_has_scale_param(); +} +inline void LayerParameter::clear_scale_param() { + if (scale_param_ != nullptr) scale_param_->Clear(); + _has_bits_[1] &= ~0x00001000u; +} +inline const ::caffe::ScaleParameter& LayerParameter::_internal_scale_param() const { + const ::caffe::ScaleParameter* p = scale_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ScaleParameter_default_instance_); +} +inline const ::caffe::ScaleParameter& LayerParameter::scale_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.scale_param) + return _internal_scale_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_scale_param( + ::caffe::ScaleParameter* scale_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(scale_param_); + } + scale_param_ = scale_param; + if (scale_param) { + _has_bits_[1] |= 0x00001000u; + } else { + _has_bits_[1] &= ~0x00001000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.scale_param) +} +inline ::caffe::ScaleParameter* LayerParameter::release_scale_param() { + auto temp = unsafe_arena_release_scale_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ScaleParameter* LayerParameter::unsafe_arena_release_scale_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.scale_param) + _has_bits_[1] &= ~0x00001000u; + ::caffe::ScaleParameter* temp = scale_param_; + scale_param_ = nullptr; + return temp; +} +inline ::caffe::ScaleParameter* LayerParameter::_internal_mutable_scale_param() { + _has_bits_[1] |= 0x00001000u; + if (scale_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ScaleParameter>(GetArena()); + scale_param_ = p; + } + return scale_param_; +} +inline ::caffe::ScaleParameter* LayerParameter::mutable_scale_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.scale_param) + return _internal_mutable_scale_param(); +} +inline void LayerParameter::set_allocated_scale_param(::caffe::ScaleParameter* scale_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete scale_param_; + } + if (scale_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(scale_param); + if (message_arena != submessage_arena) { + scale_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, scale_param, submessage_arena); + } + _has_bits_[1] |= 0x00001000u; + } else { + _has_bits_[1] &= ~0x00001000u; + } + scale_param_ = scale_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.scale_param) +} + +// optional .caffe.SigmoidParameter sigmoid_param = 124; +inline bool LayerParameter::_internal_has_sigmoid_param() const { + bool value = (_has_bits_[0] & 0x04000000u) != 0; + PROTOBUF_ASSUME(!value || sigmoid_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_sigmoid_param() const { + return _internal_has_sigmoid_param(); +} +inline void LayerParameter::clear_sigmoid_param() { + if (sigmoid_param_ != nullptr) sigmoid_param_->Clear(); + _has_bits_[0] &= ~0x04000000u; +} +inline const ::caffe::SigmoidParameter& LayerParameter::_internal_sigmoid_param() const { + const ::caffe::SigmoidParameter* p = sigmoid_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SigmoidParameter_default_instance_); +} +inline const ::caffe::SigmoidParameter& LayerParameter::sigmoid_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.sigmoid_param) + return _internal_sigmoid_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_sigmoid_param( + ::caffe::SigmoidParameter* sigmoid_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(sigmoid_param_); + } + sigmoid_param_ = sigmoid_param; + if (sigmoid_param) { + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.sigmoid_param) +} +inline ::caffe::SigmoidParameter* LayerParameter::release_sigmoid_param() { + auto temp = unsafe_arena_release_sigmoid_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SigmoidParameter* LayerParameter::unsafe_arena_release_sigmoid_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.sigmoid_param) + _has_bits_[0] &= ~0x04000000u; + ::caffe::SigmoidParameter* temp = sigmoid_param_; + sigmoid_param_ = nullptr; + return temp; +} +inline ::caffe::SigmoidParameter* LayerParameter::_internal_mutable_sigmoid_param() { + _has_bits_[0] |= 0x04000000u; + if (sigmoid_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SigmoidParameter>(GetArena()); + sigmoid_param_ = p; + } + return sigmoid_param_; +} +inline ::caffe::SigmoidParameter* LayerParameter::mutable_sigmoid_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.sigmoid_param) + return _internal_mutable_sigmoid_param(); +} +inline void LayerParameter::set_allocated_sigmoid_param(::caffe::SigmoidParameter* sigmoid_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete sigmoid_param_; + } + if (sigmoid_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(sigmoid_param); + if (message_arena != submessage_arena) { + sigmoid_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, sigmoid_param, submessage_arena); + } + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + sigmoid_param_ = sigmoid_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.sigmoid_param) +} + +// optional .caffe.SoftmaxParameter softmax_param = 125; +inline bool LayerParameter::_internal_has_softmax_param() const { + bool value = (_has_bits_[0] & 0x08000000u) != 0; + PROTOBUF_ASSUME(!value || softmax_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_softmax_param() const { + return _internal_has_softmax_param(); +} +inline void LayerParameter::clear_softmax_param() { + if (softmax_param_ != nullptr) softmax_param_->Clear(); + _has_bits_[0] &= ~0x08000000u; +} +inline const ::caffe::SoftmaxParameter& LayerParameter::_internal_softmax_param() const { + const ::caffe::SoftmaxParameter* p = softmax_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SoftmaxParameter_default_instance_); +} +inline const ::caffe::SoftmaxParameter& LayerParameter::softmax_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.softmax_param) + return _internal_softmax_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_softmax_param( + ::caffe::SoftmaxParameter* softmax_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(softmax_param_); + } + softmax_param_ = softmax_param; + if (softmax_param) { + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.softmax_param) +} +inline ::caffe::SoftmaxParameter* LayerParameter::release_softmax_param() { + auto temp = unsafe_arena_release_softmax_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SoftmaxParameter* LayerParameter::unsafe_arena_release_softmax_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.softmax_param) + _has_bits_[0] &= ~0x08000000u; + ::caffe::SoftmaxParameter* temp = softmax_param_; + softmax_param_ = nullptr; + return temp; +} +inline ::caffe::SoftmaxParameter* LayerParameter::_internal_mutable_softmax_param() { + _has_bits_[0] |= 0x08000000u; + if (softmax_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SoftmaxParameter>(GetArena()); + softmax_param_ = p; + } + return softmax_param_; +} +inline ::caffe::SoftmaxParameter* LayerParameter::mutable_softmax_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.softmax_param) + return _internal_mutable_softmax_param(); +} +inline void LayerParameter::set_allocated_softmax_param(::caffe::SoftmaxParameter* softmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete softmax_param_; + } + if (softmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(softmax_param); + if (message_arena != submessage_arena) { + softmax_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, softmax_param, submessage_arena); + } + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + softmax_param_ = softmax_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.softmax_param) +} + +// optional .caffe.SPPParameter spp_param = 132; +inline bool LayerParameter::_internal_has_spp_param() const { + bool value = (_has_bits_[1] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || spp_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_spp_param() const { + return _internal_has_spp_param(); +} +inline void LayerParameter::clear_spp_param() { + if (spp_param_ != nullptr) spp_param_->Clear(); + _has_bits_[1] &= ~0x00000004u; +} +inline const ::caffe::SPPParameter& LayerParameter::_internal_spp_param() const { + const ::caffe::SPPParameter* p = spp_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SPPParameter_default_instance_); +} +inline const ::caffe::SPPParameter& LayerParameter::spp_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.spp_param) + return _internal_spp_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_spp_param( + ::caffe::SPPParameter* spp_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(spp_param_); + } + spp_param_ = spp_param; + if (spp_param) { + _has_bits_[1] |= 0x00000004u; + } else { + _has_bits_[1] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.spp_param) +} +inline ::caffe::SPPParameter* LayerParameter::release_spp_param() { + auto temp = unsafe_arena_release_spp_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SPPParameter* LayerParameter::unsafe_arena_release_spp_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.spp_param) + _has_bits_[1] &= ~0x00000004u; + ::caffe::SPPParameter* temp = spp_param_; + spp_param_ = nullptr; + return temp; +} +inline ::caffe::SPPParameter* LayerParameter::_internal_mutable_spp_param() { + _has_bits_[1] |= 0x00000004u; + if (spp_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SPPParameter>(GetArena()); + spp_param_ = p; + } + return spp_param_; +} +inline ::caffe::SPPParameter* LayerParameter::mutable_spp_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.spp_param) + return _internal_mutable_spp_param(); +} +inline void LayerParameter::set_allocated_spp_param(::caffe::SPPParameter* spp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete spp_param_; + } + if (spp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(spp_param); + if (message_arena != submessage_arena) { + spp_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, spp_param, submessage_arena); + } + _has_bits_[1] |= 0x00000004u; + } else { + _has_bits_[1] &= ~0x00000004u; + } + spp_param_ = spp_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.spp_param) +} + +// optional .caffe.SliceParameter slice_param = 126; +inline bool LayerParameter::_internal_has_slice_param() const { + bool value = (_has_bits_[0] & 0x10000000u) != 0; + PROTOBUF_ASSUME(!value || slice_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_slice_param() const { + return _internal_has_slice_param(); +} +inline void LayerParameter::clear_slice_param() { + if (slice_param_ != nullptr) slice_param_->Clear(); + _has_bits_[0] &= ~0x10000000u; +} +inline const ::caffe::SliceParameter& LayerParameter::_internal_slice_param() const { + const ::caffe::SliceParameter* p = slice_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SliceParameter_default_instance_); +} +inline const ::caffe::SliceParameter& LayerParameter::slice_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.slice_param) + return _internal_slice_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_slice_param( + ::caffe::SliceParameter* slice_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(slice_param_); + } + slice_param_ = slice_param; + if (slice_param) { + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.slice_param) +} +inline ::caffe::SliceParameter* LayerParameter::release_slice_param() { + auto temp = unsafe_arena_release_slice_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SliceParameter* LayerParameter::unsafe_arena_release_slice_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.slice_param) + _has_bits_[0] &= ~0x10000000u; + ::caffe::SliceParameter* temp = slice_param_; + slice_param_ = nullptr; + return temp; +} +inline ::caffe::SliceParameter* LayerParameter::_internal_mutable_slice_param() { + _has_bits_[0] |= 0x10000000u; + if (slice_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SliceParameter>(GetArena()); + slice_param_ = p; + } + return slice_param_; +} +inline ::caffe::SliceParameter* LayerParameter::mutable_slice_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.slice_param) + return _internal_mutable_slice_param(); +} +inline void LayerParameter::set_allocated_slice_param(::caffe::SliceParameter* slice_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete slice_param_; + } + if (slice_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(slice_param); + if (message_arena != submessage_arena) { + slice_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, slice_param, submessage_arena); + } + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + slice_param_ = slice_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.slice_param) +} + +// optional .caffe.SwishParameter swish_param = 147; +inline bool LayerParameter::_internal_has_swish_param() const { + bool value = (_has_bits_[1] & 0x00020000u) != 0; + PROTOBUF_ASSUME(!value || swish_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_swish_param() const { + return _internal_has_swish_param(); +} +inline void LayerParameter::clear_swish_param() { + if (swish_param_ != nullptr) swish_param_->Clear(); + _has_bits_[1] &= ~0x00020000u; +} +inline const ::caffe::SwishParameter& LayerParameter::_internal_swish_param() const { + const ::caffe::SwishParameter* p = swish_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SwishParameter_default_instance_); +} +inline const ::caffe::SwishParameter& LayerParameter::swish_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.swish_param) + return _internal_swish_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_swish_param( + ::caffe::SwishParameter* swish_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(swish_param_); + } + swish_param_ = swish_param; + if (swish_param) { + _has_bits_[1] |= 0x00020000u; + } else { + _has_bits_[1] &= ~0x00020000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.swish_param) +} +inline ::caffe::SwishParameter* LayerParameter::release_swish_param() { + auto temp = unsafe_arena_release_swish_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SwishParameter* LayerParameter::unsafe_arena_release_swish_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.swish_param) + _has_bits_[1] &= ~0x00020000u; + ::caffe::SwishParameter* temp = swish_param_; + swish_param_ = nullptr; + return temp; +} +inline ::caffe::SwishParameter* LayerParameter::_internal_mutable_swish_param() { + _has_bits_[1] |= 0x00020000u; + if (swish_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SwishParameter>(GetArena()); + swish_param_ = p; + } + return swish_param_; +} +inline ::caffe::SwishParameter* LayerParameter::mutable_swish_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.swish_param) + return _internal_mutable_swish_param(); +} +inline void LayerParameter::set_allocated_swish_param(::caffe::SwishParameter* swish_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete swish_param_; + } + if (swish_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(swish_param); + if (message_arena != submessage_arena) { + swish_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, swish_param, submessage_arena); + } + _has_bits_[1] |= 0x00020000u; + } else { + _has_bits_[1] &= ~0x00020000u; + } + swish_param_ = swish_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.swish_param) +} + +// optional .caffe.TanHParameter tanh_param = 127; +inline bool LayerParameter::_internal_has_tanh_param() const { + bool value = (_has_bits_[0] & 0x20000000u) != 0; + PROTOBUF_ASSUME(!value || tanh_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_tanh_param() const { + return _internal_has_tanh_param(); +} +inline void LayerParameter::clear_tanh_param() { + if (tanh_param_ != nullptr) tanh_param_->Clear(); + _has_bits_[0] &= ~0x20000000u; +} +inline const ::caffe::TanHParameter& LayerParameter::_internal_tanh_param() const { + const ::caffe::TanHParameter* p = tanh_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_TanHParameter_default_instance_); +} +inline const ::caffe::TanHParameter& LayerParameter::tanh_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.tanh_param) + return _internal_tanh_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_tanh_param( + ::caffe::TanHParameter* tanh_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tanh_param_); + } + tanh_param_ = tanh_param; + if (tanh_param) { + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.tanh_param) +} +inline ::caffe::TanHParameter* LayerParameter::release_tanh_param() { + auto temp = unsafe_arena_release_tanh_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::TanHParameter* LayerParameter::unsafe_arena_release_tanh_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.tanh_param) + _has_bits_[0] &= ~0x20000000u; + ::caffe::TanHParameter* temp = tanh_param_; + tanh_param_ = nullptr; + return temp; +} +inline ::caffe::TanHParameter* LayerParameter::_internal_mutable_tanh_param() { + _has_bits_[0] |= 0x20000000u; + if (tanh_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::TanHParameter>(GetArena()); + tanh_param_ = p; + } + return tanh_param_; +} +inline ::caffe::TanHParameter* LayerParameter::mutable_tanh_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.tanh_param) + return _internal_mutable_tanh_param(); +} +inline void LayerParameter::set_allocated_tanh_param(::caffe::TanHParameter* tanh_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete tanh_param_; + } + if (tanh_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(tanh_param); + if (message_arena != submessage_arena) { + tanh_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tanh_param, submessage_arena); + } + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + tanh_param_ = tanh_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.tanh_param) +} + +// optional .caffe.ThresholdParameter threshold_param = 128; +inline bool LayerParameter::_internal_has_threshold_param() const { + bool value = (_has_bits_[0] & 0x40000000u) != 0; + PROTOBUF_ASSUME(!value || threshold_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_threshold_param() const { + return _internal_has_threshold_param(); +} +inline void LayerParameter::clear_threshold_param() { + if (threshold_param_ != nullptr) threshold_param_->Clear(); + _has_bits_[0] &= ~0x40000000u; +} +inline const ::caffe::ThresholdParameter& LayerParameter::_internal_threshold_param() const { + const ::caffe::ThresholdParameter* p = threshold_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ThresholdParameter_default_instance_); +} +inline const ::caffe::ThresholdParameter& LayerParameter::threshold_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.threshold_param) + return _internal_threshold_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_threshold_param( + ::caffe::ThresholdParameter* threshold_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(threshold_param_); + } + threshold_param_ = threshold_param; + if (threshold_param) { + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.threshold_param) +} +inline ::caffe::ThresholdParameter* LayerParameter::release_threshold_param() { + auto temp = unsafe_arena_release_threshold_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ThresholdParameter* LayerParameter::unsafe_arena_release_threshold_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.threshold_param) + _has_bits_[0] &= ~0x40000000u; + ::caffe::ThresholdParameter* temp = threshold_param_; + threshold_param_ = nullptr; + return temp; +} +inline ::caffe::ThresholdParameter* LayerParameter::_internal_mutable_threshold_param() { + _has_bits_[0] |= 0x40000000u; + if (threshold_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ThresholdParameter>(GetArena()); + threshold_param_ = p; + } + return threshold_param_; +} +inline ::caffe::ThresholdParameter* LayerParameter::mutable_threshold_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.threshold_param) + return _internal_mutable_threshold_param(); +} +inline void LayerParameter::set_allocated_threshold_param(::caffe::ThresholdParameter* threshold_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete threshold_param_; + } + if (threshold_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(threshold_param); + if (message_arena != submessage_arena) { + threshold_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, threshold_param, submessage_arena); + } + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + threshold_param_ = threshold_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.threshold_param) +} + +// optional .caffe.TileParameter tile_param = 138; +inline bool LayerParameter::_internal_has_tile_param() const { + bool value = (_has_bits_[1] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || tile_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_tile_param() const { + return _internal_has_tile_param(); +} +inline void LayerParameter::clear_tile_param() { + if (tile_param_ != nullptr) tile_param_->Clear(); + _has_bits_[1] &= ~0x00000100u; +} +inline const ::caffe::TileParameter& LayerParameter::_internal_tile_param() const { + const ::caffe::TileParameter* p = tile_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_TileParameter_default_instance_); +} +inline const ::caffe::TileParameter& LayerParameter::tile_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.tile_param) + return _internal_tile_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_tile_param( + ::caffe::TileParameter* tile_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tile_param_); + } + tile_param_ = tile_param; + if (tile_param) { + _has_bits_[1] |= 0x00000100u; + } else { + _has_bits_[1] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.tile_param) +} +inline ::caffe::TileParameter* LayerParameter::release_tile_param() { + auto temp = unsafe_arena_release_tile_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::TileParameter* LayerParameter::unsafe_arena_release_tile_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.tile_param) + _has_bits_[1] &= ~0x00000100u; + ::caffe::TileParameter* temp = tile_param_; + tile_param_ = nullptr; + return temp; +} +inline ::caffe::TileParameter* LayerParameter::_internal_mutable_tile_param() { + _has_bits_[1] |= 0x00000100u; + if (tile_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::TileParameter>(GetArena()); + tile_param_ = p; + } + return tile_param_; +} +inline ::caffe::TileParameter* LayerParameter::mutable_tile_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.tile_param) + return _internal_mutable_tile_param(); +} +inline void LayerParameter::set_allocated_tile_param(::caffe::TileParameter* tile_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete tile_param_; + } + if (tile_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(tile_param); + if (message_arena != submessage_arena) { + tile_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tile_param, submessage_arena); + } + _has_bits_[1] |= 0x00000100u; + } else { + _has_bits_[1] &= ~0x00000100u; + } + tile_param_ = tile_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.tile_param) +} + +// optional .caffe.WindowDataParameter window_data_param = 129; +inline bool LayerParameter::_internal_has_window_data_param() const { + bool value = (_has_bits_[0] & 0x80000000u) != 0; + PROTOBUF_ASSUME(!value || window_data_param_ != nullptr); + return value; +} +inline bool LayerParameter::has_window_data_param() const { + return _internal_has_window_data_param(); +} +inline void LayerParameter::clear_window_data_param() { + if (window_data_param_ != nullptr) window_data_param_->Clear(); + _has_bits_[0] &= ~0x80000000u; +} +inline const ::caffe::WindowDataParameter& LayerParameter::_internal_window_data_param() const { + const ::caffe::WindowDataParameter* p = window_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_WindowDataParameter_default_instance_); +} +inline const ::caffe::WindowDataParameter& LayerParameter::window_data_param() const { + // @@protoc_insertion_point(field_get:caffe.LayerParameter.window_data_param) + return _internal_window_data_param(); +} +inline void LayerParameter::unsafe_arena_set_allocated_window_data_param( + ::caffe::WindowDataParameter* window_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(window_data_param_); + } + window_data_param_ = window_data_param; + if (window_data_param) { + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.LayerParameter.window_data_param) +} +inline ::caffe::WindowDataParameter* LayerParameter::release_window_data_param() { + auto temp = unsafe_arena_release_window_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::WindowDataParameter* LayerParameter::unsafe_arena_release_window_data_param() { + // @@protoc_insertion_point(field_release:caffe.LayerParameter.window_data_param) + _has_bits_[0] &= ~0x80000000u; + ::caffe::WindowDataParameter* temp = window_data_param_; + window_data_param_ = nullptr; + return temp; +} +inline ::caffe::WindowDataParameter* LayerParameter::_internal_mutable_window_data_param() { + _has_bits_[0] |= 0x80000000u; + if (window_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::WindowDataParameter>(GetArena()); + window_data_param_ = p; + } + return window_data_param_; +} +inline ::caffe::WindowDataParameter* LayerParameter::mutable_window_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.LayerParameter.window_data_param) + return _internal_mutable_window_data_param(); +} +inline void LayerParameter::set_allocated_window_data_param(::caffe::WindowDataParameter* window_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete window_data_param_; + } + if (window_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(window_data_param); + if (message_arena != submessage_arena) { + window_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, window_data_param, submessage_arena); + } + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + window_data_param_ = window_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.LayerParameter.window_data_param) +} + +// ------------------------------------------------------------------- + +// TransformationParameter + +// optional float scale = 1 [default = 1]; +inline bool TransformationParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool TransformationParameter::has_scale() const { + return _internal_has_scale(); +} +inline void TransformationParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000020u; +} +inline float TransformationParameter::_internal_scale() const { + return scale_; +} +inline float TransformationParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.scale) + return _internal_scale(); +} +inline void TransformationParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000020u; + scale_ = value; +} +inline void TransformationParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.scale) +} + +// optional bool mirror = 2 [default = false]; +inline bool TransformationParameter::_internal_has_mirror() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool TransformationParameter::has_mirror() const { + return _internal_has_mirror(); +} +inline void TransformationParameter::clear_mirror() { + mirror_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool TransformationParameter::_internal_mirror() const { + return mirror_; +} +inline bool TransformationParameter::mirror() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.mirror) + return _internal_mirror(); +} +inline void TransformationParameter::_internal_set_mirror(bool value) { + _has_bits_[0] |= 0x00000004u; + mirror_ = value; +} +inline void TransformationParameter::set_mirror(bool value) { + _internal_set_mirror(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.mirror) +} + +// optional uint32 crop_size = 3 [default = 0]; +inline bool TransformationParameter::_internal_has_crop_size() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool TransformationParameter::has_crop_size() const { + return _internal_has_crop_size(); +} +inline void TransformationParameter::clear_crop_size() { + crop_size_ = 0u; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 TransformationParameter::_internal_crop_size() const { + return crop_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 TransformationParameter::crop_size() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.crop_size) + return _internal_crop_size(); +} +inline void TransformationParameter::_internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000002u; + crop_size_ = value; +} +inline void TransformationParameter::set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_crop_size(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.crop_size) +} + +// optional string mean_file = 4; +inline bool TransformationParameter::_internal_has_mean_file() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool TransformationParameter::has_mean_file() const { + return _internal_has_mean_file(); +} +inline void TransformationParameter::clear_mean_file() { + mean_file_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& TransformationParameter::mean_file() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.mean_file) + return _internal_mean_file(); +} +inline void TransformationParameter::set_mean_file(const std::string& value) { + _internal_set_mean_file(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.mean_file) +} +inline std::string* TransformationParameter::mutable_mean_file() { + // @@protoc_insertion_point(field_mutable:caffe.TransformationParameter.mean_file) + return _internal_mutable_mean_file(); +} +inline const std::string& TransformationParameter::_internal_mean_file() const { + return mean_file_.Get(); +} +inline void TransformationParameter::_internal_set_mean_file(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void TransformationParameter::set_mean_file(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + mean_file_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.TransformationParameter.mean_file) +} +inline void TransformationParameter::set_mean_file(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.TransformationParameter.mean_file) +} +inline void TransformationParameter::set_mean_file(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.TransformationParameter.mean_file) +} +inline std::string* TransformationParameter::_internal_mutable_mean_file() { + _has_bits_[0] |= 0x00000001u; + return mean_file_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* TransformationParameter::release_mean_file() { + // @@protoc_insertion_point(field_release:caffe.TransformationParameter.mean_file) + if (!_internal_has_mean_file()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return mean_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void TransformationParameter::set_allocated_mean_file(std::string* mean_file) { + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + mean_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), mean_file, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.TransformationParameter.mean_file) +} +inline std::string* TransformationParameter::unsafe_arena_release_mean_file() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.TransformationParameter.mean_file) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return mean_file_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void TransformationParameter::unsafe_arena_set_allocated_mean_file( + std::string* mean_file) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + mean_file_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + mean_file, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.TransformationParameter.mean_file) +} + +// repeated float mean_value = 5; +inline int TransformationParameter::_internal_mean_value_size() const { + return mean_value_.size(); +} +inline int TransformationParameter::mean_value_size() const { + return _internal_mean_value_size(); +} +inline void TransformationParameter::clear_mean_value() { + mean_value_.Clear(); +} +inline float TransformationParameter::_internal_mean_value(int index) const { + return mean_value_.Get(index); +} +inline float TransformationParameter::mean_value(int index) const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.mean_value) + return _internal_mean_value(index); +} +inline void TransformationParameter::set_mean_value(int index, float value) { + mean_value_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.mean_value) +} +inline void TransformationParameter::_internal_add_mean_value(float value) { + mean_value_.Add(value); +} +inline void TransformationParameter::add_mean_value(float value) { + _internal_add_mean_value(value); + // @@protoc_insertion_point(field_add:caffe.TransformationParameter.mean_value) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +TransformationParameter::_internal_mean_value() const { + return mean_value_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +TransformationParameter::mean_value() const { + // @@protoc_insertion_point(field_list:caffe.TransformationParameter.mean_value) + return _internal_mean_value(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +TransformationParameter::_internal_mutable_mean_value() { + return &mean_value_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +TransformationParameter::mutable_mean_value() { + // @@protoc_insertion_point(field_mutable_list:caffe.TransformationParameter.mean_value) + return _internal_mutable_mean_value(); +} + +// optional bool force_color = 6 [default = false]; +inline bool TransformationParameter::_internal_has_force_color() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool TransformationParameter::has_force_color() const { + return _internal_has_force_color(); +} +inline void TransformationParameter::clear_force_color() { + force_color_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool TransformationParameter::_internal_force_color() const { + return force_color_; +} +inline bool TransformationParameter::force_color() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.force_color) + return _internal_force_color(); +} +inline void TransformationParameter::_internal_set_force_color(bool value) { + _has_bits_[0] |= 0x00000008u; + force_color_ = value; +} +inline void TransformationParameter::set_force_color(bool value) { + _internal_set_force_color(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.force_color) +} + +// optional bool force_gray = 7 [default = false]; +inline bool TransformationParameter::_internal_has_force_gray() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool TransformationParameter::has_force_gray() const { + return _internal_has_force_gray(); +} +inline void TransformationParameter::clear_force_gray() { + force_gray_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool TransformationParameter::_internal_force_gray() const { + return force_gray_; +} +inline bool TransformationParameter::force_gray() const { + // @@protoc_insertion_point(field_get:caffe.TransformationParameter.force_gray) + return _internal_force_gray(); +} +inline void TransformationParameter::_internal_set_force_gray(bool value) { + _has_bits_[0] |= 0x00000010u; + force_gray_ = value; +} +inline void TransformationParameter::set_force_gray(bool value) { + _internal_set_force_gray(value); + // @@protoc_insertion_point(field_set:caffe.TransformationParameter.force_gray) +} + +// ------------------------------------------------------------------- + +// LossParameter + +// optional int32 ignore_label = 1; +inline bool LossParameter::_internal_has_ignore_label() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool LossParameter::has_ignore_label() const { + return _internal_has_ignore_label(); +} +inline void LossParameter::clear_ignore_label() { + ignore_label_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 LossParameter::_internal_ignore_label() const { + return ignore_label_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 LossParameter::ignore_label() const { + // @@protoc_insertion_point(field_get:caffe.LossParameter.ignore_label) + return _internal_ignore_label(); +} +inline void LossParameter::_internal_set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + ignore_label_ = value; +} +inline void LossParameter::set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_ignore_label(value); + // @@protoc_insertion_point(field_set:caffe.LossParameter.ignore_label) +} + +// optional .caffe.LossParameter.NormalizationMode normalization = 3 [default = VALID]; +inline bool LossParameter::_internal_has_normalization() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool LossParameter::has_normalization() const { + return _internal_has_normalization(); +} +inline void LossParameter::clear_normalization() { + normalization_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline ::caffe::LossParameter_NormalizationMode LossParameter::_internal_normalization() const { + return static_cast< ::caffe::LossParameter_NormalizationMode >(normalization_); +} +inline ::caffe::LossParameter_NormalizationMode LossParameter::normalization() const { + // @@protoc_insertion_point(field_get:caffe.LossParameter.normalization) + return _internal_normalization(); +} +inline void LossParameter::_internal_set_normalization(::caffe::LossParameter_NormalizationMode value) { + assert(::caffe::LossParameter_NormalizationMode_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + normalization_ = value; +} +inline void LossParameter::set_normalization(::caffe::LossParameter_NormalizationMode value) { + _internal_set_normalization(value); + // @@protoc_insertion_point(field_set:caffe.LossParameter.normalization) +} + +// optional bool normalize = 2; +inline bool LossParameter::_internal_has_normalize() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool LossParameter::has_normalize() const { + return _internal_has_normalize(); +} +inline void LossParameter::clear_normalize() { + normalize_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool LossParameter::_internal_normalize() const { + return normalize_; +} +inline bool LossParameter::normalize() const { + // @@protoc_insertion_point(field_get:caffe.LossParameter.normalize) + return _internal_normalize(); +} +inline void LossParameter::_internal_set_normalize(bool value) { + _has_bits_[0] |= 0x00000002u; + normalize_ = value; +} +inline void LossParameter::set_normalize(bool value) { + _internal_set_normalize(value); + // @@protoc_insertion_point(field_set:caffe.LossParameter.normalize) +} + +// ------------------------------------------------------------------- + +// AccuracyParameter + +// optional uint32 top_k = 1 [default = 1]; +inline bool AccuracyParameter::_internal_has_top_k() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool AccuracyParameter::has_top_k() const { + return _internal_has_top_k(); +} +inline void AccuracyParameter::clear_top_k() { + top_k_ = 1u; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 AccuracyParameter::_internal_top_k() const { + return top_k_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 AccuracyParameter::top_k() const { + // @@protoc_insertion_point(field_get:caffe.AccuracyParameter.top_k) + return _internal_top_k(); +} +inline void AccuracyParameter::_internal_set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000002u; + top_k_ = value; +} +inline void AccuracyParameter::set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_top_k(value); + // @@protoc_insertion_point(field_set:caffe.AccuracyParameter.top_k) +} + +// optional int32 axis = 2 [default = 1]; +inline bool AccuracyParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool AccuracyParameter::has_axis() const { + return _internal_has_axis(); +} +inline void AccuracyParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AccuracyParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AccuracyParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.AccuracyParameter.axis) + return _internal_axis(); +} +inline void AccuracyParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + axis_ = value; +} +inline void AccuracyParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.AccuracyParameter.axis) +} + +// optional int32 ignore_label = 3; +inline bool AccuracyParameter::_internal_has_ignore_label() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool AccuracyParameter::has_ignore_label() const { + return _internal_has_ignore_label(); +} +inline void AccuracyParameter::clear_ignore_label() { + ignore_label_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AccuracyParameter::_internal_ignore_label() const { + return ignore_label_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 AccuracyParameter::ignore_label() const { + // @@protoc_insertion_point(field_get:caffe.AccuracyParameter.ignore_label) + return _internal_ignore_label(); +} +inline void AccuracyParameter::_internal_set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + ignore_label_ = value; +} +inline void AccuracyParameter::set_ignore_label(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_ignore_label(value); + // @@protoc_insertion_point(field_set:caffe.AccuracyParameter.ignore_label) +} + +// ------------------------------------------------------------------- + +// ArgMaxParameter + +// optional bool out_max_val = 1 [default = false]; +inline bool ArgMaxParameter::_internal_has_out_max_val() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ArgMaxParameter::has_out_max_val() const { + return _internal_has_out_max_val(); +} +inline void ArgMaxParameter::clear_out_max_val() { + out_max_val_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool ArgMaxParameter::_internal_out_max_val() const { + return out_max_val_; +} +inline bool ArgMaxParameter::out_max_val() const { + // @@protoc_insertion_point(field_get:caffe.ArgMaxParameter.out_max_val) + return _internal_out_max_val(); +} +inline void ArgMaxParameter::_internal_set_out_max_val(bool value) { + _has_bits_[0] |= 0x00000001u; + out_max_val_ = value; +} +inline void ArgMaxParameter::set_out_max_val(bool value) { + _internal_set_out_max_val(value); + // @@protoc_insertion_point(field_set:caffe.ArgMaxParameter.out_max_val) +} + +// optional uint32 top_k = 2 [default = 1]; +inline bool ArgMaxParameter::_internal_has_top_k() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ArgMaxParameter::has_top_k() const { + return _internal_has_top_k(); +} +inline void ArgMaxParameter::clear_top_k() { + top_k_ = 1u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ArgMaxParameter::_internal_top_k() const { + return top_k_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ArgMaxParameter::top_k() const { + // @@protoc_insertion_point(field_get:caffe.ArgMaxParameter.top_k) + return _internal_top_k(); +} +inline void ArgMaxParameter::_internal_set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + top_k_ = value; +} +inline void ArgMaxParameter::set_top_k(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_top_k(value); + // @@protoc_insertion_point(field_set:caffe.ArgMaxParameter.top_k) +} + +// optional int32 axis = 3; +inline bool ArgMaxParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ArgMaxParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ArgMaxParameter::clear_axis() { + axis_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ArgMaxParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ArgMaxParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ArgMaxParameter.axis) + return _internal_axis(); +} +inline void ArgMaxParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void ArgMaxParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ArgMaxParameter.axis) +} + +// ------------------------------------------------------------------- + +// ClipParameter + +// optional float min = 1; +inline bool ClipParameter::_internal_has_min() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ClipParameter::has_min() const { + return _internal_has_min(); +} +inline void ClipParameter::clear_min() { + min_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float ClipParameter::_internal_min() const { + return min_; +} +inline float ClipParameter::min() const { + // @@protoc_insertion_point(field_get:caffe.ClipParameter.min) + return _internal_min(); +} +inline void ClipParameter::_internal_set_min(float value) { + _has_bits_[0] |= 0x00000001u; + min_ = value; +} +inline void ClipParameter::set_min(float value) { + _internal_set_min(value); + // @@protoc_insertion_point(field_set:caffe.ClipParameter.min) +} + +// optional float max = 2; +inline bool ClipParameter::_internal_has_max() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ClipParameter::has_max() const { + return _internal_has_max(); +} +inline void ClipParameter::clear_max() { + max_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline float ClipParameter::_internal_max() const { + return max_; +} +inline float ClipParameter::max() const { + // @@protoc_insertion_point(field_get:caffe.ClipParameter.max) + return _internal_max(); +} +inline void ClipParameter::_internal_set_max(float value) { + _has_bits_[0] |= 0x00000002u; + max_ = value; +} +inline void ClipParameter::set_max(float value) { + _internal_set_max(value); + // @@protoc_insertion_point(field_set:caffe.ClipParameter.max) +} + +// ------------------------------------------------------------------- + +// ConcatParameter + +// optional int32 axis = 2 [default = 1]; +inline bool ConcatParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ConcatParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ConcatParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConcatParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConcatParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ConcatParameter.axis) + return _internal_axis(); +} +inline void ConcatParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void ConcatParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ConcatParameter.axis) +} + +// optional uint32 concat_dim = 1 [default = 1]; +inline bool ConcatParameter::_internal_has_concat_dim() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ConcatParameter::has_concat_dim() const { + return _internal_has_concat_dim(); +} +inline void ConcatParameter::clear_concat_dim() { + concat_dim_ = 1u; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConcatParameter::_internal_concat_dim() const { + return concat_dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConcatParameter::concat_dim() const { + // @@protoc_insertion_point(field_get:caffe.ConcatParameter.concat_dim) + return _internal_concat_dim(); +} +inline void ConcatParameter::_internal_set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000001u; + concat_dim_ = value; +} +inline void ConcatParameter::set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_concat_dim(value); + // @@protoc_insertion_point(field_set:caffe.ConcatParameter.concat_dim) +} + +// ------------------------------------------------------------------- + +// BatchNormParameter + +// optional bool use_global_stats = 1; +inline bool BatchNormParameter::_internal_has_use_global_stats() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool BatchNormParameter::has_use_global_stats() const { + return _internal_has_use_global_stats(); +} +inline void BatchNormParameter::clear_use_global_stats() { + use_global_stats_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool BatchNormParameter::_internal_use_global_stats() const { + return use_global_stats_; +} +inline bool BatchNormParameter::use_global_stats() const { + // @@protoc_insertion_point(field_get:caffe.BatchNormParameter.use_global_stats) + return _internal_use_global_stats(); +} +inline void BatchNormParameter::_internal_set_use_global_stats(bool value) { + _has_bits_[0] |= 0x00000001u; + use_global_stats_ = value; +} +inline void BatchNormParameter::set_use_global_stats(bool value) { + _internal_set_use_global_stats(value); + // @@protoc_insertion_point(field_set:caffe.BatchNormParameter.use_global_stats) +} + +// optional float moving_average_fraction = 2 [default = 0.999]; +inline bool BatchNormParameter::_internal_has_moving_average_fraction() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool BatchNormParameter::has_moving_average_fraction() const { + return _internal_has_moving_average_fraction(); +} +inline void BatchNormParameter::clear_moving_average_fraction() { + moving_average_fraction_ = 0.999f; + _has_bits_[0] &= ~0x00000002u; +} +inline float BatchNormParameter::_internal_moving_average_fraction() const { + return moving_average_fraction_; +} +inline float BatchNormParameter::moving_average_fraction() const { + // @@protoc_insertion_point(field_get:caffe.BatchNormParameter.moving_average_fraction) + return _internal_moving_average_fraction(); +} +inline void BatchNormParameter::_internal_set_moving_average_fraction(float value) { + _has_bits_[0] |= 0x00000002u; + moving_average_fraction_ = value; +} +inline void BatchNormParameter::set_moving_average_fraction(float value) { + _internal_set_moving_average_fraction(value); + // @@protoc_insertion_point(field_set:caffe.BatchNormParameter.moving_average_fraction) +} + +// optional float eps = 3 [default = 1e-05]; +inline bool BatchNormParameter::_internal_has_eps() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool BatchNormParameter::has_eps() const { + return _internal_has_eps(); +} +inline void BatchNormParameter::clear_eps() { + eps_ = 1e-05f; + _has_bits_[0] &= ~0x00000004u; +} +inline float BatchNormParameter::_internal_eps() const { + return eps_; +} +inline float BatchNormParameter::eps() const { + // @@protoc_insertion_point(field_get:caffe.BatchNormParameter.eps) + return _internal_eps(); +} +inline void BatchNormParameter::_internal_set_eps(float value) { + _has_bits_[0] |= 0x00000004u; + eps_ = value; +} +inline void BatchNormParameter::set_eps(float value) { + _internal_set_eps(value); + // @@protoc_insertion_point(field_set:caffe.BatchNormParameter.eps) +} + +// ------------------------------------------------------------------- + +// BiasParameter + +// optional int32 axis = 1 [default = 1]; +inline bool BiasParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool BiasParameter::has_axis() const { + return _internal_has_axis(); +} +inline void BiasParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BiasParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BiasParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.BiasParameter.axis) + return _internal_axis(); +} +inline void BiasParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void BiasParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.BiasParameter.axis) +} + +// optional int32 num_axes = 2 [default = 1]; +inline bool BiasParameter::_internal_has_num_axes() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool BiasParameter::has_num_axes() const { + return _internal_has_num_axes(); +} +inline void BiasParameter::clear_num_axes() { + num_axes_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BiasParameter::_internal_num_axes() const { + return num_axes_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 BiasParameter::num_axes() const { + // @@protoc_insertion_point(field_get:caffe.BiasParameter.num_axes) + return _internal_num_axes(); +} +inline void BiasParameter::_internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + num_axes_ = value; +} +inline void BiasParameter::set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_num_axes(value); + // @@protoc_insertion_point(field_set:caffe.BiasParameter.num_axes) +} + +// optional .caffe.FillerParameter filler = 3; +inline bool BiasParameter::_internal_has_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || filler_ != nullptr); + return value; +} +inline bool BiasParameter::has_filler() const { + return _internal_has_filler(); +} +inline void BiasParameter::clear_filler() { + if (filler_ != nullptr) filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& BiasParameter::_internal_filler() const { + const ::caffe::FillerParameter* p = filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& BiasParameter::filler() const { + // @@protoc_insertion_point(field_get:caffe.BiasParameter.filler) + return _internal_filler(); +} +inline void BiasParameter::unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(filler_); + } + filler_ = filler; + if (filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.BiasParameter.filler) +} +inline ::caffe::FillerParameter* BiasParameter::release_filler() { + auto temp = unsafe_arena_release_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* BiasParameter::unsafe_arena_release_filler() { + // @@protoc_insertion_point(field_release:caffe.BiasParameter.filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = filler_; + filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* BiasParameter::_internal_mutable_filler() { + _has_bits_[0] |= 0x00000001u; + if (filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + filler_ = p; + } + return filler_; +} +inline ::caffe::FillerParameter* BiasParameter::mutable_filler() { + // @@protoc_insertion_point(field_mutable:caffe.BiasParameter.filler) + return _internal_mutable_filler(); +} +inline void BiasParameter::set_allocated_filler(::caffe::FillerParameter* filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete filler_; + } + if (filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(filler); + if (message_arena != submessage_arena) { + filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + filler_ = filler; + // @@protoc_insertion_point(field_set_allocated:caffe.BiasParameter.filler) +} + +// ------------------------------------------------------------------- + +// ContrastiveLossParameter + +// optional float margin = 1 [default = 1]; +inline bool ContrastiveLossParameter::_internal_has_margin() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ContrastiveLossParameter::has_margin() const { + return _internal_has_margin(); +} +inline void ContrastiveLossParameter::clear_margin() { + margin_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline float ContrastiveLossParameter::_internal_margin() const { + return margin_; +} +inline float ContrastiveLossParameter::margin() const { + // @@protoc_insertion_point(field_get:caffe.ContrastiveLossParameter.margin) + return _internal_margin(); +} +inline void ContrastiveLossParameter::_internal_set_margin(float value) { + _has_bits_[0] |= 0x00000002u; + margin_ = value; +} +inline void ContrastiveLossParameter::set_margin(float value) { + _internal_set_margin(value); + // @@protoc_insertion_point(field_set:caffe.ContrastiveLossParameter.margin) +} + +// optional bool legacy_version = 2 [default = false]; +inline bool ContrastiveLossParameter::_internal_has_legacy_version() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ContrastiveLossParameter::has_legacy_version() const { + return _internal_has_legacy_version(); +} +inline void ContrastiveLossParameter::clear_legacy_version() { + legacy_version_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool ContrastiveLossParameter::_internal_legacy_version() const { + return legacy_version_; +} +inline bool ContrastiveLossParameter::legacy_version() const { + // @@protoc_insertion_point(field_get:caffe.ContrastiveLossParameter.legacy_version) + return _internal_legacy_version(); +} +inline void ContrastiveLossParameter::_internal_set_legacy_version(bool value) { + _has_bits_[0] |= 0x00000001u; + legacy_version_ = value; +} +inline void ContrastiveLossParameter::set_legacy_version(bool value) { + _internal_set_legacy_version(value); + // @@protoc_insertion_point(field_set:caffe.ContrastiveLossParameter.legacy_version) +} + +// ------------------------------------------------------------------- + +// ConvolutionParameter + +// optional uint32 num_output = 1; +inline bool ConvolutionParameter::_internal_has_num_output() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ConvolutionParameter::has_num_output() const { + return _internal_has_num_output(); +} +inline void ConvolutionParameter::clear_num_output() { + num_output_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_num_output() const { + return num_output_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::num_output() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.num_output) + return _internal_num_output(); +} +inline void ConvolutionParameter::_internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + num_output_ = value; +} +inline void ConvolutionParameter::set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_num_output(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.num_output) +} + +// optional bool bias_term = 2 [default = true]; +inline bool ConvolutionParameter::_internal_has_bias_term() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool ConvolutionParameter::has_bias_term() const { + return _internal_has_bias_term(); +} +inline void ConvolutionParameter::clear_bias_term() { + bias_term_ = true; + _has_bits_[0] &= ~0x00001000u; +} +inline bool ConvolutionParameter::_internal_bias_term() const { + return bias_term_; +} +inline bool ConvolutionParameter::bias_term() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.bias_term) + return _internal_bias_term(); +} +inline void ConvolutionParameter::_internal_set_bias_term(bool value) { + _has_bits_[0] |= 0x00001000u; + bias_term_ = value; +} +inline void ConvolutionParameter::set_bias_term(bool value) { + _internal_set_bias_term(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.bias_term) +} + +// repeated uint32 pad = 3; +inline int ConvolutionParameter::_internal_pad_size() const { + return pad_.size(); +} +inline int ConvolutionParameter::pad_size() const { + return _internal_pad_size(); +} +inline void ConvolutionParameter::clear_pad() { + pad_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_pad(int index) const { + return pad_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::pad(int index) const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.pad) + return _internal_pad(index); +} +inline void ConvolutionParameter::set_pad(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + pad_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.pad) +} +inline void ConvolutionParameter::_internal_add_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + pad_.Add(value); +} +inline void ConvolutionParameter::add_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_pad(value); + // @@protoc_insertion_point(field_add:caffe.ConvolutionParameter.pad) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::_internal_pad() const { + return pad_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::pad() const { + // @@protoc_insertion_point(field_list:caffe.ConvolutionParameter.pad) + return _internal_pad(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::_internal_mutable_pad() { + return &pad_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::mutable_pad() { + // @@protoc_insertion_point(field_mutable_list:caffe.ConvolutionParameter.pad) + return _internal_mutable_pad(); +} + +// repeated uint32 kernel_size = 4; +inline int ConvolutionParameter::_internal_kernel_size_size() const { + return kernel_size_.size(); +} +inline int ConvolutionParameter::kernel_size_size() const { + return _internal_kernel_size_size(); +} +inline void ConvolutionParameter::clear_kernel_size() { + kernel_size_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_kernel_size(int index) const { + return kernel_size_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::kernel_size(int index) const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.kernel_size) + return _internal_kernel_size(index); +} +inline void ConvolutionParameter::set_kernel_size(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + kernel_size_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.kernel_size) +} +inline void ConvolutionParameter::_internal_add_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + kernel_size_.Add(value); +} +inline void ConvolutionParameter::add_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_kernel_size(value); + // @@protoc_insertion_point(field_add:caffe.ConvolutionParameter.kernel_size) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::_internal_kernel_size() const { + return kernel_size_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::kernel_size() const { + // @@protoc_insertion_point(field_list:caffe.ConvolutionParameter.kernel_size) + return _internal_kernel_size(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::_internal_mutable_kernel_size() { + return &kernel_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::mutable_kernel_size() { + // @@protoc_insertion_point(field_mutable_list:caffe.ConvolutionParameter.kernel_size) + return _internal_mutable_kernel_size(); +} + +// repeated uint32 stride = 6; +inline int ConvolutionParameter::_internal_stride_size() const { + return stride_.size(); +} +inline int ConvolutionParameter::stride_size() const { + return _internal_stride_size(); +} +inline void ConvolutionParameter::clear_stride() { + stride_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_stride(int index) const { + return stride_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::stride(int index) const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.stride) + return _internal_stride(index); +} +inline void ConvolutionParameter::set_stride(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + stride_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.stride) +} +inline void ConvolutionParameter::_internal_add_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + stride_.Add(value); +} +inline void ConvolutionParameter::add_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_stride(value); + // @@protoc_insertion_point(field_add:caffe.ConvolutionParameter.stride) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::_internal_stride() const { + return stride_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::stride() const { + // @@protoc_insertion_point(field_list:caffe.ConvolutionParameter.stride) + return _internal_stride(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::_internal_mutable_stride() { + return &stride_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::mutable_stride() { + // @@protoc_insertion_point(field_mutable_list:caffe.ConvolutionParameter.stride) + return _internal_mutable_stride(); +} + +// repeated uint32 dilation = 18; +inline int ConvolutionParameter::_internal_dilation_size() const { + return dilation_.size(); +} +inline int ConvolutionParameter::dilation_size() const { + return _internal_dilation_size(); +} +inline void ConvolutionParameter::clear_dilation() { + dilation_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_dilation(int index) const { + return dilation_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::dilation(int index) const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.dilation) + return _internal_dilation(index); +} +inline void ConvolutionParameter::set_dilation(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + dilation_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.dilation) +} +inline void ConvolutionParameter::_internal_add_dilation(::PROTOBUF_NAMESPACE_ID::uint32 value) { + dilation_.Add(value); +} +inline void ConvolutionParameter::add_dilation(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_dilation(value); + // @@protoc_insertion_point(field_add:caffe.ConvolutionParameter.dilation) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::_internal_dilation() const { + return dilation_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +ConvolutionParameter::dilation() const { + // @@protoc_insertion_point(field_list:caffe.ConvolutionParameter.dilation) + return _internal_dilation(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::_internal_mutable_dilation() { + return &dilation_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +ConvolutionParameter::mutable_dilation() { + // @@protoc_insertion_point(field_mutable_list:caffe.ConvolutionParameter.dilation) + return _internal_mutable_dilation(); +} + +// optional uint32 pad_h = 9 [default = 0]; +inline bool ConvolutionParameter::_internal_has_pad_h() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ConvolutionParameter::has_pad_h() const { + return _internal_has_pad_h(); +} +inline void ConvolutionParameter::clear_pad_h() { + pad_h_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_pad_h() const { + return pad_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::pad_h() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.pad_h) + return _internal_pad_h(); +} +inline void ConvolutionParameter::_internal_set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + pad_h_ = value; +} +inline void ConvolutionParameter::set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad_h(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.pad_h) +} + +// optional uint32 pad_w = 10 [default = 0]; +inline bool ConvolutionParameter::_internal_has_pad_w() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ConvolutionParameter::has_pad_w() const { + return _internal_has_pad_w(); +} +inline void ConvolutionParameter::clear_pad_w() { + pad_w_ = 0u; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_pad_w() const { + return pad_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::pad_w() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.pad_w) + return _internal_pad_w(); +} +inline void ConvolutionParameter::_internal_set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000010u; + pad_w_ = value; +} +inline void ConvolutionParameter::set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad_w(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.pad_w) +} + +// optional uint32 kernel_h = 11; +inline bool ConvolutionParameter::_internal_has_kernel_h() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool ConvolutionParameter::has_kernel_h() const { + return _internal_has_kernel_h(); +} +inline void ConvolutionParameter::clear_kernel_h() { + kernel_h_ = 0u; + _has_bits_[0] &= ~0x00000020u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_kernel_h() const { + return kernel_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::kernel_h() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.kernel_h) + return _internal_kernel_h(); +} +inline void ConvolutionParameter::_internal_set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000020u; + kernel_h_ = value; +} +inline void ConvolutionParameter::set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernel_h(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.kernel_h) +} + +// optional uint32 kernel_w = 12; +inline bool ConvolutionParameter::_internal_has_kernel_w() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool ConvolutionParameter::has_kernel_w() const { + return _internal_has_kernel_w(); +} +inline void ConvolutionParameter::clear_kernel_w() { + kernel_w_ = 0u; + _has_bits_[0] &= ~0x00000040u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_kernel_w() const { + return kernel_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::kernel_w() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.kernel_w) + return _internal_kernel_w(); +} +inline void ConvolutionParameter::_internal_set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000040u; + kernel_w_ = value; +} +inline void ConvolutionParameter::set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernel_w(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.kernel_w) +} + +// optional uint32 stride_h = 13; +inline bool ConvolutionParameter::_internal_has_stride_h() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool ConvolutionParameter::has_stride_h() const { + return _internal_has_stride_h(); +} +inline void ConvolutionParameter::clear_stride_h() { + stride_h_ = 0u; + _has_bits_[0] &= ~0x00000080u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_stride_h() const { + return stride_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::stride_h() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.stride_h) + return _internal_stride_h(); +} +inline void ConvolutionParameter::_internal_set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000080u; + stride_h_ = value; +} +inline void ConvolutionParameter::set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride_h(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.stride_h) +} + +// optional uint32 stride_w = 14; +inline bool ConvolutionParameter::_internal_has_stride_w() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool ConvolutionParameter::has_stride_w() const { + return _internal_has_stride_w(); +} +inline void ConvolutionParameter::clear_stride_w() { + stride_w_ = 0u; + _has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_stride_w() const { + return stride_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::stride_w() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.stride_w) + return _internal_stride_w(); +} +inline void ConvolutionParameter::_internal_set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000100u; + stride_w_ = value; +} +inline void ConvolutionParameter::set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride_w(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.stride_w) +} + +// optional uint32 group = 5 [default = 1]; +inline bool ConvolutionParameter::_internal_has_group() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + return value; +} +inline bool ConvolutionParameter::has_group() const { + return _internal_has_group(); +} +inline void ConvolutionParameter::clear_group() { + group_ = 1u; + _has_bits_[0] &= ~0x00002000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::_internal_group() const { + return group_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ConvolutionParameter::group() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.group) + return _internal_group(); +} +inline void ConvolutionParameter::_internal_set_group(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00002000u; + group_ = value; +} +inline void ConvolutionParameter::set_group(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_group(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.group) +} + +// optional .caffe.FillerParameter weight_filler = 7; +inline bool ConvolutionParameter::_internal_has_weight_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || weight_filler_ != nullptr); + return value; +} +inline bool ConvolutionParameter::has_weight_filler() const { + return _internal_has_weight_filler(); +} +inline void ConvolutionParameter::clear_weight_filler() { + if (weight_filler_ != nullptr) weight_filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& ConvolutionParameter::_internal_weight_filler() const { + const ::caffe::FillerParameter* p = weight_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& ConvolutionParameter::weight_filler() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.weight_filler) + return _internal_weight_filler(); +} +inline void ConvolutionParameter::unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(weight_filler_); + } + weight_filler_ = weight_filler; + if (weight_filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ConvolutionParameter.weight_filler) +} +inline ::caffe::FillerParameter* ConvolutionParameter::release_weight_filler() { + auto temp = unsafe_arena_release_weight_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* ConvolutionParameter::unsafe_arena_release_weight_filler() { + // @@protoc_insertion_point(field_release:caffe.ConvolutionParameter.weight_filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = weight_filler_; + weight_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* ConvolutionParameter::_internal_mutable_weight_filler() { + _has_bits_[0] |= 0x00000001u; + if (weight_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + weight_filler_ = p; + } + return weight_filler_; +} +inline ::caffe::FillerParameter* ConvolutionParameter::mutable_weight_filler() { + // @@protoc_insertion_point(field_mutable:caffe.ConvolutionParameter.weight_filler) + return _internal_mutable_weight_filler(); +} +inline void ConvolutionParameter::set_allocated_weight_filler(::caffe::FillerParameter* weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete weight_filler_; + } + if (weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(weight_filler); + if (message_arena != submessage_arena) { + weight_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, weight_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + weight_filler_ = weight_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.ConvolutionParameter.weight_filler) +} + +// optional .caffe.FillerParameter bias_filler = 8; +inline bool ConvolutionParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool ConvolutionParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void ConvolutionParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::FillerParameter& ConvolutionParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& ConvolutionParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.bias_filler) + return _internal_bias_filler(); +} +inline void ConvolutionParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ConvolutionParameter.bias_filler) +} +inline ::caffe::FillerParameter* ConvolutionParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* ConvolutionParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.ConvolutionParameter.bias_filler) + _has_bits_[0] &= ~0x00000002u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* ConvolutionParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000002u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* ConvolutionParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.ConvolutionParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void ConvolutionParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.ConvolutionParameter.bias_filler) +} + +// optional .caffe.ConvolutionParameter.Engine engine = 15 [default = DEFAULT]; +inline bool ConvolutionParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool ConvolutionParameter::has_engine() const { + return _internal_has_engine(); +} +inline void ConvolutionParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::caffe::ConvolutionParameter_Engine ConvolutionParameter::_internal_engine() const { + return static_cast< ::caffe::ConvolutionParameter_Engine >(engine_); +} +inline ::caffe::ConvolutionParameter_Engine ConvolutionParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.engine) + return _internal_engine(); +} +inline void ConvolutionParameter::_internal_set_engine(::caffe::ConvolutionParameter_Engine value) { + assert(::caffe::ConvolutionParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000200u; + engine_ = value; +} +inline void ConvolutionParameter::set_engine(::caffe::ConvolutionParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.engine) +} + +// optional int32 axis = 16 [default = 1]; +inline bool ConvolutionParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool ConvolutionParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ConvolutionParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000800u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConvolutionParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ConvolutionParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.axis) + return _internal_axis(); +} +inline void ConvolutionParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000800u; + axis_ = value; +} +inline void ConvolutionParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.axis) +} + +// optional bool force_nd_im2col = 17 [default = false]; +inline bool ConvolutionParameter::_internal_has_force_nd_im2col() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool ConvolutionParameter::has_force_nd_im2col() const { + return _internal_has_force_nd_im2col(); +} +inline void ConvolutionParameter::clear_force_nd_im2col() { + force_nd_im2col_ = false; + _has_bits_[0] &= ~0x00000400u; +} +inline bool ConvolutionParameter::_internal_force_nd_im2col() const { + return force_nd_im2col_; +} +inline bool ConvolutionParameter::force_nd_im2col() const { + // @@protoc_insertion_point(field_get:caffe.ConvolutionParameter.force_nd_im2col) + return _internal_force_nd_im2col(); +} +inline void ConvolutionParameter::_internal_set_force_nd_im2col(bool value) { + _has_bits_[0] |= 0x00000400u; + force_nd_im2col_ = value; +} +inline void ConvolutionParameter::set_force_nd_im2col(bool value) { + _internal_set_force_nd_im2col(value); + // @@protoc_insertion_point(field_set:caffe.ConvolutionParameter.force_nd_im2col) +} + +// ------------------------------------------------------------------- + +// CropParameter + +// optional int32 axis = 1 [default = 2]; +inline bool CropParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool CropParameter::has_axis() const { + return _internal_has_axis(); +} +inline void CropParameter::clear_axis() { + axis_ = 2; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 CropParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 CropParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.CropParameter.axis) + return _internal_axis(); +} +inline void CropParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + axis_ = value; +} +inline void CropParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.CropParameter.axis) +} + +// repeated uint32 offset = 2; +inline int CropParameter::_internal_offset_size() const { + return offset_.size(); +} +inline int CropParameter::offset_size() const { + return _internal_offset_size(); +} +inline void CropParameter::clear_offset() { + offset_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 CropParameter::_internal_offset(int index) const { + return offset_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 CropParameter::offset(int index) const { + // @@protoc_insertion_point(field_get:caffe.CropParameter.offset) + return _internal_offset(index); +} +inline void CropParameter::set_offset(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + offset_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.CropParameter.offset) +} +inline void CropParameter::_internal_add_offset(::PROTOBUF_NAMESPACE_ID::uint32 value) { + offset_.Add(value); +} +inline void CropParameter::add_offset(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_offset(value); + // @@protoc_insertion_point(field_add:caffe.CropParameter.offset) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +CropParameter::_internal_offset() const { + return offset_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +CropParameter::offset() const { + // @@protoc_insertion_point(field_list:caffe.CropParameter.offset) + return _internal_offset(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +CropParameter::_internal_mutable_offset() { + return &offset_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +CropParameter::mutable_offset() { + // @@protoc_insertion_point(field_mutable_list:caffe.CropParameter.offset) + return _internal_mutable_offset(); +} + +// ------------------------------------------------------------------- + +// DataParameter + +// optional string source = 1; +inline bool DataParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool DataParameter::has_source() const { + return _internal_has_source(); +} +inline void DataParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& DataParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.source) + return _internal_source(); +} +inline void DataParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.source) +} +inline std::string* DataParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.DataParameter.source) + return _internal_mutable_source(); +} +inline const std::string& DataParameter::_internal_source() const { + return source_.Get(); +} +inline void DataParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void DataParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.DataParameter.source) +} +inline void DataParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.DataParameter.source) +} +inline void DataParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.DataParameter.source) +} +inline std::string* DataParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000001u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* DataParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.DataParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void DataParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.DataParameter.source) +} +inline std::string* DataParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.DataParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void DataParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.DataParameter.source) +} + +// optional uint32 batch_size = 4; +inline bool DataParameter::_internal_has_batch_size() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool DataParameter::has_batch_size() const { + return _internal_has_batch_size(); +} +inline void DataParameter::clear_batch_size() { + batch_size_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::_internal_batch_size() const { + return batch_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::batch_size() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.batch_size) + return _internal_batch_size(); +} +inline void DataParameter::_internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + batch_size_ = value; +} +inline void DataParameter::set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batch_size(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.batch_size) +} + +// optional uint32 rand_skip = 7 [default = 0]; +inline bool DataParameter::_internal_has_rand_skip() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool DataParameter::has_rand_skip() const { + return _internal_has_rand_skip(); +} +inline void DataParameter::clear_rand_skip() { + rand_skip_ = 0u; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::_internal_rand_skip() const { + return rand_skip_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::rand_skip() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.rand_skip) + return _internal_rand_skip(); +} +inline void DataParameter::_internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000010u; + rand_skip_ = value; +} +inline void DataParameter::set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_rand_skip(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.rand_skip) +} + +// optional .caffe.DataParameter.DB backend = 8 [default = LEVELDB]; +inline bool DataParameter::_internal_has_backend() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool DataParameter::has_backend() const { + return _internal_has_backend(); +} +inline void DataParameter::clear_backend() { + backend_ = 0; + _has_bits_[0] &= ~0x00000080u; +} +inline ::caffe::DataParameter_DB DataParameter::_internal_backend() const { + return static_cast< ::caffe::DataParameter_DB >(backend_); +} +inline ::caffe::DataParameter_DB DataParameter::backend() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.backend) + return _internal_backend(); +} +inline void DataParameter::_internal_set_backend(::caffe::DataParameter_DB value) { + assert(::caffe::DataParameter_DB_IsValid(value)); + _has_bits_[0] |= 0x00000080u; + backend_ = value; +} +inline void DataParameter::set_backend(::caffe::DataParameter_DB value) { + _internal_set_backend(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.backend) +} + +// optional float scale = 2 [default = 1]; +inline bool DataParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool DataParameter::has_scale() const { + return _internal_has_scale(); +} +inline void DataParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000100u; +} +inline float DataParameter::_internal_scale() const { + return scale_; +} +inline float DataParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.scale) + return _internal_scale(); +} +inline void DataParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000100u; + scale_ = value; +} +inline void DataParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.scale) +} + +// optional string mean_file = 3; +inline bool DataParameter::_internal_has_mean_file() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool DataParameter::has_mean_file() const { + return _internal_has_mean_file(); +} +inline void DataParameter::clear_mean_file() { + mean_file_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& DataParameter::mean_file() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.mean_file) + return _internal_mean_file(); +} +inline void DataParameter::set_mean_file(const std::string& value) { + _internal_set_mean_file(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.mean_file) +} +inline std::string* DataParameter::mutable_mean_file() { + // @@protoc_insertion_point(field_mutable:caffe.DataParameter.mean_file) + return _internal_mutable_mean_file(); +} +inline const std::string& DataParameter::_internal_mean_file() const { + return mean_file_.Get(); +} +inline void DataParameter::_internal_set_mean_file(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void DataParameter::set_mean_file(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.DataParameter.mean_file) +} +inline void DataParameter::set_mean_file(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.DataParameter.mean_file) +} +inline void DataParameter::set_mean_file(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.DataParameter.mean_file) +} +inline std::string* DataParameter::_internal_mutable_mean_file() { + _has_bits_[0] |= 0x00000002u; + return mean_file_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* DataParameter::release_mean_file() { + // @@protoc_insertion_point(field_release:caffe.DataParameter.mean_file) + if (!_internal_has_mean_file()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return mean_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void DataParameter::set_allocated_mean_file(std::string* mean_file) { + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), mean_file, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.DataParameter.mean_file) +} +inline std::string* DataParameter::unsafe_arena_release_mean_file() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.DataParameter.mean_file) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return mean_file_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void DataParameter::unsafe_arena_set_allocated_mean_file( + std::string* mean_file) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + mean_file, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.DataParameter.mean_file) +} + +// optional uint32 crop_size = 5 [default = 0]; +inline bool DataParameter::_internal_has_crop_size() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool DataParameter::has_crop_size() const { + return _internal_has_crop_size(); +} +inline void DataParameter::clear_crop_size() { + crop_size_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::_internal_crop_size() const { + return crop_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::crop_size() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.crop_size) + return _internal_crop_size(); +} +inline void DataParameter::_internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + crop_size_ = value; +} +inline void DataParameter::set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_crop_size(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.crop_size) +} + +// optional bool mirror = 6 [default = false]; +inline bool DataParameter::_internal_has_mirror() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool DataParameter::has_mirror() const { + return _internal_has_mirror(); +} +inline void DataParameter::clear_mirror() { + mirror_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool DataParameter::_internal_mirror() const { + return mirror_; +} +inline bool DataParameter::mirror() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.mirror) + return _internal_mirror(); +} +inline void DataParameter::_internal_set_mirror(bool value) { + _has_bits_[0] |= 0x00000020u; + mirror_ = value; +} +inline void DataParameter::set_mirror(bool value) { + _internal_set_mirror(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.mirror) +} + +// optional bool force_encoded_color = 9 [default = false]; +inline bool DataParameter::_internal_has_force_encoded_color() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool DataParameter::has_force_encoded_color() const { + return _internal_has_force_encoded_color(); +} +inline void DataParameter::clear_force_encoded_color() { + force_encoded_color_ = false; + _has_bits_[0] &= ~0x00000040u; +} +inline bool DataParameter::_internal_force_encoded_color() const { + return force_encoded_color_; +} +inline bool DataParameter::force_encoded_color() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.force_encoded_color) + return _internal_force_encoded_color(); +} +inline void DataParameter::_internal_set_force_encoded_color(bool value) { + _has_bits_[0] |= 0x00000040u; + force_encoded_color_ = value; +} +inline void DataParameter::set_force_encoded_color(bool value) { + _internal_set_force_encoded_color(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.force_encoded_color) +} + +// optional uint32 prefetch = 10 [default = 4]; +inline bool DataParameter::_internal_has_prefetch() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool DataParameter::has_prefetch() const { + return _internal_has_prefetch(); +} +inline void DataParameter::clear_prefetch() { + prefetch_ = 4u; + _has_bits_[0] &= ~0x00000200u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::_internal_prefetch() const { + return prefetch_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DataParameter::prefetch() const { + // @@protoc_insertion_point(field_get:caffe.DataParameter.prefetch) + return _internal_prefetch(); +} +inline void DataParameter::_internal_set_prefetch(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000200u; + prefetch_ = value; +} +inline void DataParameter::set_prefetch(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_prefetch(value); + // @@protoc_insertion_point(field_set:caffe.DataParameter.prefetch) +} + +// ------------------------------------------------------------------- + +// DropoutParameter + +// optional float dropout_ratio = 1 [default = 0.5]; +inline bool DropoutParameter::_internal_has_dropout_ratio() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool DropoutParameter::has_dropout_ratio() const { + return _internal_has_dropout_ratio(); +} +inline void DropoutParameter::clear_dropout_ratio() { + dropout_ratio_ = 0.5f; + _has_bits_[0] &= ~0x00000001u; +} +inline float DropoutParameter::_internal_dropout_ratio() const { + return dropout_ratio_; +} +inline float DropoutParameter::dropout_ratio() const { + // @@protoc_insertion_point(field_get:caffe.DropoutParameter.dropout_ratio) + return _internal_dropout_ratio(); +} +inline void DropoutParameter::_internal_set_dropout_ratio(float value) { + _has_bits_[0] |= 0x00000001u; + dropout_ratio_ = value; +} +inline void DropoutParameter::set_dropout_ratio(float value) { + _internal_set_dropout_ratio(value); + // @@protoc_insertion_point(field_set:caffe.DropoutParameter.dropout_ratio) +} + +// ------------------------------------------------------------------- + +// DummyDataParameter + +// repeated .caffe.FillerParameter data_filler = 1; +inline int DummyDataParameter::_internal_data_filler_size() const { + return data_filler_.size(); +} +inline int DummyDataParameter::data_filler_size() const { + return _internal_data_filler_size(); +} +inline void DummyDataParameter::clear_data_filler() { + data_filler_.Clear(); +} +inline ::caffe::FillerParameter* DummyDataParameter::mutable_data_filler(int index) { + // @@protoc_insertion_point(field_mutable:caffe.DummyDataParameter.data_filler) + return data_filler_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::FillerParameter >* +DummyDataParameter::mutable_data_filler() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.data_filler) + return &data_filler_; +} +inline const ::caffe::FillerParameter& DummyDataParameter::_internal_data_filler(int index) const { + return data_filler_.Get(index); +} +inline const ::caffe::FillerParameter& DummyDataParameter::data_filler(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.data_filler) + return _internal_data_filler(index); +} +inline ::caffe::FillerParameter* DummyDataParameter::_internal_add_data_filler() { + return data_filler_.Add(); +} +inline ::caffe::FillerParameter* DummyDataParameter::add_data_filler() { + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.data_filler) + return _internal_add_data_filler(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::FillerParameter >& +DummyDataParameter::data_filler() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.data_filler) + return data_filler_; +} + +// repeated .caffe.BlobShape shape = 6; +inline int DummyDataParameter::_internal_shape_size() const { + return shape_.size(); +} +inline int DummyDataParameter::shape_size() const { + return _internal_shape_size(); +} +inline void DummyDataParameter::clear_shape() { + shape_.Clear(); +} +inline ::caffe::BlobShape* DummyDataParameter::mutable_shape(int index) { + // @@protoc_insertion_point(field_mutable:caffe.DummyDataParameter.shape) + return shape_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* +DummyDataParameter::mutable_shape() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.shape) + return &shape_; +} +inline const ::caffe::BlobShape& DummyDataParameter::_internal_shape(int index) const { + return shape_.Get(index); +} +inline const ::caffe::BlobShape& DummyDataParameter::shape(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.shape) + return _internal_shape(index); +} +inline ::caffe::BlobShape* DummyDataParameter::_internal_add_shape() { + return shape_.Add(); +} +inline ::caffe::BlobShape* DummyDataParameter::add_shape() { + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.shape) + return _internal_add_shape(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& +DummyDataParameter::shape() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.shape) + return shape_; +} + +// repeated uint32 num = 2; +inline int DummyDataParameter::_internal_num_size() const { + return num_.size(); +} +inline int DummyDataParameter::num_size() const { + return _internal_num_size(); +} +inline void DummyDataParameter::clear_num() { + num_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::_internal_num(int index) const { + return num_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::num(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.num) + return _internal_num(index); +} +inline void DummyDataParameter::set_num(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + num_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.DummyDataParameter.num) +} +inline void DummyDataParameter::_internal_add_num(::PROTOBUF_NAMESPACE_ID::uint32 value) { + num_.Add(value); +} +inline void DummyDataParameter::add_num(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_num(value); + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.num) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::_internal_num() const { + return num_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::num() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.num) + return _internal_num(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::_internal_mutable_num() { + return &num_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::mutable_num() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.num) + return _internal_mutable_num(); +} + +// repeated uint32 channels = 3; +inline int DummyDataParameter::_internal_channels_size() const { + return channels_.size(); +} +inline int DummyDataParameter::channels_size() const { + return _internal_channels_size(); +} +inline void DummyDataParameter::clear_channels() { + channels_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::_internal_channels(int index) const { + return channels_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::channels(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.channels) + return _internal_channels(index); +} +inline void DummyDataParameter::set_channels(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + channels_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.DummyDataParameter.channels) +} +inline void DummyDataParameter::_internal_add_channels(::PROTOBUF_NAMESPACE_ID::uint32 value) { + channels_.Add(value); +} +inline void DummyDataParameter::add_channels(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_channels(value); + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.channels) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::_internal_channels() const { + return channels_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::channels() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.channels) + return _internal_channels(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::_internal_mutable_channels() { + return &channels_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::mutable_channels() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.channels) + return _internal_mutable_channels(); +} + +// repeated uint32 height = 4; +inline int DummyDataParameter::_internal_height_size() const { + return height_.size(); +} +inline int DummyDataParameter::height_size() const { + return _internal_height_size(); +} +inline void DummyDataParameter::clear_height() { + height_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::_internal_height(int index) const { + return height_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::height(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.height) + return _internal_height(index); +} +inline void DummyDataParameter::set_height(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + height_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.DummyDataParameter.height) +} +inline void DummyDataParameter::_internal_add_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + height_.Add(value); +} +inline void DummyDataParameter::add_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_height(value); + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.height) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::_internal_height() const { + return height_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::height() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.height) + return _internal_height(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::_internal_mutable_height() { + return &height_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::mutable_height() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.height) + return _internal_mutable_height(); +} + +// repeated uint32 width = 5; +inline int DummyDataParameter::_internal_width_size() const { + return width_.size(); +} +inline int DummyDataParameter::width_size() const { + return _internal_width_size(); +} +inline void DummyDataParameter::clear_width() { + width_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::_internal_width(int index) const { + return width_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 DummyDataParameter::width(int index) const { + // @@protoc_insertion_point(field_get:caffe.DummyDataParameter.width) + return _internal_width(index); +} +inline void DummyDataParameter::set_width(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + width_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.DummyDataParameter.width) +} +inline void DummyDataParameter::_internal_add_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + width_.Add(value); +} +inline void DummyDataParameter::add_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_width(value); + // @@protoc_insertion_point(field_add:caffe.DummyDataParameter.width) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::_internal_width() const { + return width_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +DummyDataParameter::width() const { + // @@protoc_insertion_point(field_list:caffe.DummyDataParameter.width) + return _internal_width(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::_internal_mutable_width() { + return &width_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +DummyDataParameter::mutable_width() { + // @@protoc_insertion_point(field_mutable_list:caffe.DummyDataParameter.width) + return _internal_mutable_width(); +} + +// ------------------------------------------------------------------- + +// EltwiseParameter + +// optional .caffe.EltwiseParameter.EltwiseOp operation = 1 [default = SUM]; +inline bool EltwiseParameter::_internal_has_operation() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool EltwiseParameter::has_operation() const { + return _internal_has_operation(); +} +inline void EltwiseParameter::clear_operation() { + operation_ = 1; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::EltwiseParameter_EltwiseOp EltwiseParameter::_internal_operation() const { + return static_cast< ::caffe::EltwiseParameter_EltwiseOp >(operation_); +} +inline ::caffe::EltwiseParameter_EltwiseOp EltwiseParameter::operation() const { + // @@protoc_insertion_point(field_get:caffe.EltwiseParameter.operation) + return _internal_operation(); +} +inline void EltwiseParameter::_internal_set_operation(::caffe::EltwiseParameter_EltwiseOp value) { + assert(::caffe::EltwiseParameter_EltwiseOp_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + operation_ = value; +} +inline void EltwiseParameter::set_operation(::caffe::EltwiseParameter_EltwiseOp value) { + _internal_set_operation(value); + // @@protoc_insertion_point(field_set:caffe.EltwiseParameter.operation) +} + +// repeated float coeff = 2; +inline int EltwiseParameter::_internal_coeff_size() const { + return coeff_.size(); +} +inline int EltwiseParameter::coeff_size() const { + return _internal_coeff_size(); +} +inline void EltwiseParameter::clear_coeff() { + coeff_.Clear(); +} +inline float EltwiseParameter::_internal_coeff(int index) const { + return coeff_.Get(index); +} +inline float EltwiseParameter::coeff(int index) const { + // @@protoc_insertion_point(field_get:caffe.EltwiseParameter.coeff) + return _internal_coeff(index); +} +inline void EltwiseParameter::set_coeff(int index, float value) { + coeff_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.EltwiseParameter.coeff) +} +inline void EltwiseParameter::_internal_add_coeff(float value) { + coeff_.Add(value); +} +inline void EltwiseParameter::add_coeff(float value) { + _internal_add_coeff(value); + // @@protoc_insertion_point(field_add:caffe.EltwiseParameter.coeff) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +EltwiseParameter::_internal_coeff() const { + return coeff_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +EltwiseParameter::coeff() const { + // @@protoc_insertion_point(field_list:caffe.EltwiseParameter.coeff) + return _internal_coeff(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +EltwiseParameter::_internal_mutable_coeff() { + return &coeff_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +EltwiseParameter::mutable_coeff() { + // @@protoc_insertion_point(field_mutable_list:caffe.EltwiseParameter.coeff) + return _internal_mutable_coeff(); +} + +// optional bool stable_prod_grad = 3 [default = true]; +inline bool EltwiseParameter::_internal_has_stable_prod_grad() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool EltwiseParameter::has_stable_prod_grad() const { + return _internal_has_stable_prod_grad(); +} +inline void EltwiseParameter::clear_stable_prod_grad() { + stable_prod_grad_ = true; + _has_bits_[0] &= ~0x00000002u; +} +inline bool EltwiseParameter::_internal_stable_prod_grad() const { + return stable_prod_grad_; +} +inline bool EltwiseParameter::stable_prod_grad() const { + // @@protoc_insertion_point(field_get:caffe.EltwiseParameter.stable_prod_grad) + return _internal_stable_prod_grad(); +} +inline void EltwiseParameter::_internal_set_stable_prod_grad(bool value) { + _has_bits_[0] |= 0x00000002u; + stable_prod_grad_ = value; +} +inline void EltwiseParameter::set_stable_prod_grad(bool value) { + _internal_set_stable_prod_grad(value); + // @@protoc_insertion_point(field_set:caffe.EltwiseParameter.stable_prod_grad) +} + +// ------------------------------------------------------------------- + +// ELUParameter + +// optional float alpha = 1 [default = 1]; +inline bool ELUParameter::_internal_has_alpha() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ELUParameter::has_alpha() const { + return _internal_has_alpha(); +} +inline void ELUParameter::clear_alpha() { + alpha_ = 1; + _has_bits_[0] &= ~0x00000001u; +} +inline float ELUParameter::_internal_alpha() const { + return alpha_; +} +inline float ELUParameter::alpha() const { + // @@protoc_insertion_point(field_get:caffe.ELUParameter.alpha) + return _internal_alpha(); +} +inline void ELUParameter::_internal_set_alpha(float value) { + _has_bits_[0] |= 0x00000001u; + alpha_ = value; +} +inline void ELUParameter::set_alpha(float value) { + _internal_set_alpha(value); + // @@protoc_insertion_point(field_set:caffe.ELUParameter.alpha) +} + +// ------------------------------------------------------------------- + +// EmbedParameter + +// optional uint32 num_output = 1; +inline bool EmbedParameter::_internal_has_num_output() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool EmbedParameter::has_num_output() const { + return _internal_has_num_output(); +} +inline void EmbedParameter::clear_num_output() { + num_output_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 EmbedParameter::_internal_num_output() const { + return num_output_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 EmbedParameter::num_output() const { + // @@protoc_insertion_point(field_get:caffe.EmbedParameter.num_output) + return _internal_num_output(); +} +inline void EmbedParameter::_internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + num_output_ = value; +} +inline void EmbedParameter::set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_num_output(value); + // @@protoc_insertion_point(field_set:caffe.EmbedParameter.num_output) +} + +// optional uint32 input_dim = 2; +inline bool EmbedParameter::_internal_has_input_dim() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool EmbedParameter::has_input_dim() const { + return _internal_has_input_dim(); +} +inline void EmbedParameter::clear_input_dim() { + input_dim_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 EmbedParameter::_internal_input_dim() const { + return input_dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 EmbedParameter::input_dim() const { + // @@protoc_insertion_point(field_get:caffe.EmbedParameter.input_dim) + return _internal_input_dim(); +} +inline void EmbedParameter::_internal_set_input_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + input_dim_ = value; +} +inline void EmbedParameter::set_input_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_input_dim(value); + // @@protoc_insertion_point(field_set:caffe.EmbedParameter.input_dim) +} + +// optional bool bias_term = 3 [default = true]; +inline bool EmbedParameter::_internal_has_bias_term() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool EmbedParameter::has_bias_term() const { + return _internal_has_bias_term(); +} +inline void EmbedParameter::clear_bias_term() { + bias_term_ = true; + _has_bits_[0] &= ~0x00000010u; +} +inline bool EmbedParameter::_internal_bias_term() const { + return bias_term_; +} +inline bool EmbedParameter::bias_term() const { + // @@protoc_insertion_point(field_get:caffe.EmbedParameter.bias_term) + return _internal_bias_term(); +} +inline void EmbedParameter::_internal_set_bias_term(bool value) { + _has_bits_[0] |= 0x00000010u; + bias_term_ = value; +} +inline void EmbedParameter::set_bias_term(bool value) { + _internal_set_bias_term(value); + // @@protoc_insertion_point(field_set:caffe.EmbedParameter.bias_term) +} + +// optional .caffe.FillerParameter weight_filler = 4; +inline bool EmbedParameter::_internal_has_weight_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || weight_filler_ != nullptr); + return value; +} +inline bool EmbedParameter::has_weight_filler() const { + return _internal_has_weight_filler(); +} +inline void EmbedParameter::clear_weight_filler() { + if (weight_filler_ != nullptr) weight_filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& EmbedParameter::_internal_weight_filler() const { + const ::caffe::FillerParameter* p = weight_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& EmbedParameter::weight_filler() const { + // @@protoc_insertion_point(field_get:caffe.EmbedParameter.weight_filler) + return _internal_weight_filler(); +} +inline void EmbedParameter::unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(weight_filler_); + } + weight_filler_ = weight_filler; + if (weight_filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.EmbedParameter.weight_filler) +} +inline ::caffe::FillerParameter* EmbedParameter::release_weight_filler() { + auto temp = unsafe_arena_release_weight_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* EmbedParameter::unsafe_arena_release_weight_filler() { + // @@protoc_insertion_point(field_release:caffe.EmbedParameter.weight_filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = weight_filler_; + weight_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* EmbedParameter::_internal_mutable_weight_filler() { + _has_bits_[0] |= 0x00000001u; + if (weight_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + weight_filler_ = p; + } + return weight_filler_; +} +inline ::caffe::FillerParameter* EmbedParameter::mutable_weight_filler() { + // @@protoc_insertion_point(field_mutable:caffe.EmbedParameter.weight_filler) + return _internal_mutable_weight_filler(); +} +inline void EmbedParameter::set_allocated_weight_filler(::caffe::FillerParameter* weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete weight_filler_; + } + if (weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(weight_filler); + if (message_arena != submessage_arena) { + weight_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, weight_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + weight_filler_ = weight_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.EmbedParameter.weight_filler) +} + +// optional .caffe.FillerParameter bias_filler = 5; +inline bool EmbedParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool EmbedParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void EmbedParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::FillerParameter& EmbedParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& EmbedParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.EmbedParameter.bias_filler) + return _internal_bias_filler(); +} +inline void EmbedParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.EmbedParameter.bias_filler) +} +inline ::caffe::FillerParameter* EmbedParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* EmbedParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.EmbedParameter.bias_filler) + _has_bits_[0] &= ~0x00000002u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* EmbedParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000002u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* EmbedParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.EmbedParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void EmbedParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.EmbedParameter.bias_filler) +} + +// ------------------------------------------------------------------- + +// ExpParameter + +// optional float base = 1 [default = -1]; +inline bool ExpParameter::_internal_has_base() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ExpParameter::has_base() const { + return _internal_has_base(); +} +inline void ExpParameter::clear_base() { + base_ = -1; + _has_bits_[0] &= ~0x00000002u; +} +inline float ExpParameter::_internal_base() const { + return base_; +} +inline float ExpParameter::base() const { + // @@protoc_insertion_point(field_get:caffe.ExpParameter.base) + return _internal_base(); +} +inline void ExpParameter::_internal_set_base(float value) { + _has_bits_[0] |= 0x00000002u; + base_ = value; +} +inline void ExpParameter::set_base(float value) { + _internal_set_base(value); + // @@protoc_insertion_point(field_set:caffe.ExpParameter.base) +} + +// optional float scale = 2 [default = 1]; +inline bool ExpParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ExpParameter::has_scale() const { + return _internal_has_scale(); +} +inline void ExpParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline float ExpParameter::_internal_scale() const { + return scale_; +} +inline float ExpParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.ExpParameter.scale) + return _internal_scale(); +} +inline void ExpParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000004u; + scale_ = value; +} +inline void ExpParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.ExpParameter.scale) +} + +// optional float shift = 3 [default = 0]; +inline bool ExpParameter::_internal_has_shift() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ExpParameter::has_shift() const { + return _internal_has_shift(); +} +inline void ExpParameter::clear_shift() { + shift_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float ExpParameter::_internal_shift() const { + return shift_; +} +inline float ExpParameter::shift() const { + // @@protoc_insertion_point(field_get:caffe.ExpParameter.shift) + return _internal_shift(); +} +inline void ExpParameter::_internal_set_shift(float value) { + _has_bits_[0] |= 0x00000001u; + shift_ = value; +} +inline void ExpParameter::set_shift(float value) { + _internal_set_shift(value); + // @@protoc_insertion_point(field_set:caffe.ExpParameter.shift) +} + +// ------------------------------------------------------------------- + +// FlattenParameter + +// optional int32 axis = 1 [default = 1]; +inline bool FlattenParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FlattenParameter::has_axis() const { + return _internal_has_axis(); +} +inline void FlattenParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FlattenParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FlattenParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.FlattenParameter.axis) + return _internal_axis(); +} +inline void FlattenParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + axis_ = value; +} +inline void FlattenParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.FlattenParameter.axis) +} + +// optional int32 end_axis = 2 [default = -1]; +inline bool FlattenParameter::_internal_has_end_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FlattenParameter::has_end_axis() const { + return _internal_has_end_axis(); +} +inline void FlattenParameter::clear_end_axis() { + end_axis_ = -1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FlattenParameter::_internal_end_axis() const { + return end_axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 FlattenParameter::end_axis() const { + // @@protoc_insertion_point(field_get:caffe.FlattenParameter.end_axis) + return _internal_end_axis(); +} +inline void FlattenParameter::_internal_set_end_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + end_axis_ = value; +} +inline void FlattenParameter::set_end_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_end_axis(value); + // @@protoc_insertion_point(field_set:caffe.FlattenParameter.end_axis) +} + +// ------------------------------------------------------------------- + +// HDF5DataParameter + +// optional string source = 1; +inline bool HDF5DataParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool HDF5DataParameter::has_source() const { + return _internal_has_source(); +} +inline void HDF5DataParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& HDF5DataParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.HDF5DataParameter.source) + return _internal_source(); +} +inline void HDF5DataParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.HDF5DataParameter.source) +} +inline std::string* HDF5DataParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.HDF5DataParameter.source) + return _internal_mutable_source(); +} +inline const std::string& HDF5DataParameter::_internal_source() const { + return source_.Get(); +} +inline void HDF5DataParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void HDF5DataParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.HDF5DataParameter.source) +} +inline void HDF5DataParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.HDF5DataParameter.source) +} +inline void HDF5DataParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.HDF5DataParameter.source) +} +inline std::string* HDF5DataParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000001u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* HDF5DataParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.HDF5DataParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void HDF5DataParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.HDF5DataParameter.source) +} +inline std::string* HDF5DataParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.HDF5DataParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void HDF5DataParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.HDF5DataParameter.source) +} + +// optional uint32 batch_size = 2; +inline bool HDF5DataParameter::_internal_has_batch_size() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool HDF5DataParameter::has_batch_size() const { + return _internal_has_batch_size(); +} +inline void HDF5DataParameter::clear_batch_size() { + batch_size_ = 0u; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 HDF5DataParameter::_internal_batch_size() const { + return batch_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 HDF5DataParameter::batch_size() const { + // @@protoc_insertion_point(field_get:caffe.HDF5DataParameter.batch_size) + return _internal_batch_size(); +} +inline void HDF5DataParameter::_internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000002u; + batch_size_ = value; +} +inline void HDF5DataParameter::set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batch_size(value); + // @@protoc_insertion_point(field_set:caffe.HDF5DataParameter.batch_size) +} + +// optional bool shuffle = 3 [default = false]; +inline bool HDF5DataParameter::_internal_has_shuffle() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool HDF5DataParameter::has_shuffle() const { + return _internal_has_shuffle(); +} +inline void HDF5DataParameter::clear_shuffle() { + shuffle_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool HDF5DataParameter::_internal_shuffle() const { + return shuffle_; +} +inline bool HDF5DataParameter::shuffle() const { + // @@protoc_insertion_point(field_get:caffe.HDF5DataParameter.shuffle) + return _internal_shuffle(); +} +inline void HDF5DataParameter::_internal_set_shuffle(bool value) { + _has_bits_[0] |= 0x00000004u; + shuffle_ = value; +} +inline void HDF5DataParameter::set_shuffle(bool value) { + _internal_set_shuffle(value); + // @@protoc_insertion_point(field_set:caffe.HDF5DataParameter.shuffle) +} + +// ------------------------------------------------------------------- + +// HDF5OutputParameter + +// optional string file_name = 1; +inline bool HDF5OutputParameter::_internal_has_file_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool HDF5OutputParameter::has_file_name() const { + return _internal_has_file_name(); +} +inline void HDF5OutputParameter::clear_file_name() { + file_name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& HDF5OutputParameter::file_name() const { + // @@protoc_insertion_point(field_get:caffe.HDF5OutputParameter.file_name) + return _internal_file_name(); +} +inline void HDF5OutputParameter::set_file_name(const std::string& value) { + _internal_set_file_name(value); + // @@protoc_insertion_point(field_set:caffe.HDF5OutputParameter.file_name) +} +inline std::string* HDF5OutputParameter::mutable_file_name() { + // @@protoc_insertion_point(field_mutable:caffe.HDF5OutputParameter.file_name) + return _internal_mutable_file_name(); +} +inline const std::string& HDF5OutputParameter::_internal_file_name() const { + return file_name_.Get(); +} +inline void HDF5OutputParameter::_internal_set_file_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void HDF5OutputParameter::set_file_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + file_name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.HDF5OutputParameter.file_name) +} +inline void HDF5OutputParameter::set_file_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.HDF5OutputParameter.file_name) +} +inline void HDF5OutputParameter::set_file_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.HDF5OutputParameter.file_name) +} +inline std::string* HDF5OutputParameter::_internal_mutable_file_name() { + _has_bits_[0] |= 0x00000001u; + return file_name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* HDF5OutputParameter::release_file_name() { + // @@protoc_insertion_point(field_release:caffe.HDF5OutputParameter.file_name) + if (!_internal_has_file_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return file_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void HDF5OutputParameter::set_allocated_file_name(std::string* file_name) { + if (file_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.HDF5OutputParameter.file_name) +} +inline std::string* HDF5OutputParameter::unsafe_arena_release_file_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.HDF5OutputParameter.file_name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return file_name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void HDF5OutputParameter::unsafe_arena_set_allocated_file_name( + std::string* file_name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (file_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + file_name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + file_name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.HDF5OutputParameter.file_name) +} + +// ------------------------------------------------------------------- + +// HingeLossParameter + +// optional .caffe.HingeLossParameter.Norm norm = 1 [default = L1]; +inline bool HingeLossParameter::_internal_has_norm() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool HingeLossParameter::has_norm() const { + return _internal_has_norm(); +} +inline void HingeLossParameter::clear_norm() { + norm_ = 1; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::HingeLossParameter_Norm HingeLossParameter::_internal_norm() const { + return static_cast< ::caffe::HingeLossParameter_Norm >(norm_); +} +inline ::caffe::HingeLossParameter_Norm HingeLossParameter::norm() const { + // @@protoc_insertion_point(field_get:caffe.HingeLossParameter.norm) + return _internal_norm(); +} +inline void HingeLossParameter::_internal_set_norm(::caffe::HingeLossParameter_Norm value) { + assert(::caffe::HingeLossParameter_Norm_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + norm_ = value; +} +inline void HingeLossParameter::set_norm(::caffe::HingeLossParameter_Norm value) { + _internal_set_norm(value); + // @@protoc_insertion_point(field_set:caffe.HingeLossParameter.norm) +} + +// ------------------------------------------------------------------- + +// ImageDataParameter + +// optional string source = 1; +inline bool ImageDataParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ImageDataParameter::has_source() const { + return _internal_has_source(); +} +inline void ImageDataParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ImageDataParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.source) + return _internal_source(); +} +inline void ImageDataParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.source) +} +inline std::string* ImageDataParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.ImageDataParameter.source) + return _internal_mutable_source(); +} +inline const std::string& ImageDataParameter::_internal_source() const { + return source_.Get(); +} +inline void ImageDataParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void ImageDataParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.ImageDataParameter.source) +} +inline void ImageDataParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.ImageDataParameter.source) +} +inline void ImageDataParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.ImageDataParameter.source) +} +inline std::string* ImageDataParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000001u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* ImageDataParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.ImageDataParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void ImageDataParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.ImageDataParameter.source) +} +inline std::string* ImageDataParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.ImageDataParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void ImageDataParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ImageDataParameter.source) +} + +// optional uint32 batch_size = 4 [default = 1]; +inline bool ImageDataParameter::_internal_has_batch_size() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool ImageDataParameter::has_batch_size() const { + return _internal_has_batch_size(); +} +inline void ImageDataParameter::clear_batch_size() { + batch_size_ = 1u; + _has_bits_[0] &= ~0x00000800u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::_internal_batch_size() const { + return batch_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::batch_size() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.batch_size) + return _internal_batch_size(); +} +inline void ImageDataParameter::_internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000800u; + batch_size_ = value; +} +inline void ImageDataParameter::set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batch_size(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.batch_size) +} + +// optional uint32 rand_skip = 7 [default = 0]; +inline bool ImageDataParameter::_internal_has_rand_skip() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ImageDataParameter::has_rand_skip() const { + return _internal_has_rand_skip(); +} +inline void ImageDataParameter::clear_rand_skip() { + rand_skip_ = 0u; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::_internal_rand_skip() const { + return rand_skip_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::rand_skip() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.rand_skip) + return _internal_rand_skip(); +} +inline void ImageDataParameter::_internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000010u; + rand_skip_ = value; +} +inline void ImageDataParameter::set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_rand_skip(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.rand_skip) +} + +// optional bool shuffle = 8 [default = false]; +inline bool ImageDataParameter::_internal_has_shuffle() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool ImageDataParameter::has_shuffle() const { + return _internal_has_shuffle(); +} +inline void ImageDataParameter::clear_shuffle() { + shuffle_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool ImageDataParameter::_internal_shuffle() const { + return shuffle_; +} +inline bool ImageDataParameter::shuffle() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.shuffle) + return _internal_shuffle(); +} +inline void ImageDataParameter::_internal_set_shuffle(bool value) { + _has_bits_[0] |= 0x00000020u; + shuffle_ = value; +} +inline void ImageDataParameter::set_shuffle(bool value) { + _internal_set_shuffle(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.shuffle) +} + +// optional uint32 new_height = 9 [default = 0]; +inline bool ImageDataParameter::_internal_has_new_height() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool ImageDataParameter::has_new_height() const { + return _internal_has_new_height(); +} +inline void ImageDataParameter::clear_new_height() { + new_height_ = 0u; + _has_bits_[0] &= ~0x00000080u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::_internal_new_height() const { + return new_height_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::new_height() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.new_height) + return _internal_new_height(); +} +inline void ImageDataParameter::_internal_set_new_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000080u; + new_height_ = value; +} +inline void ImageDataParameter::set_new_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_new_height(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.new_height) +} + +// optional uint32 new_width = 10 [default = 0]; +inline bool ImageDataParameter::_internal_has_new_width() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool ImageDataParameter::has_new_width() const { + return _internal_has_new_width(); +} +inline void ImageDataParameter::clear_new_width() { + new_width_ = 0u; + _has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::_internal_new_width() const { + return new_width_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::new_width() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.new_width) + return _internal_new_width(); +} +inline void ImageDataParameter::_internal_set_new_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000100u; + new_width_ = value; +} +inline void ImageDataParameter::set_new_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_new_width(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.new_width) +} + +// optional bool is_color = 11 [default = true]; +inline bool ImageDataParameter::_internal_has_is_color() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool ImageDataParameter::has_is_color() const { + return _internal_has_is_color(); +} +inline void ImageDataParameter::clear_is_color() { + is_color_ = true; + _has_bits_[0] &= ~0x00000200u; +} +inline bool ImageDataParameter::_internal_is_color() const { + return is_color_; +} +inline bool ImageDataParameter::is_color() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.is_color) + return _internal_is_color(); +} +inline void ImageDataParameter::_internal_set_is_color(bool value) { + _has_bits_[0] |= 0x00000200u; + is_color_ = value; +} +inline void ImageDataParameter::set_is_color(bool value) { + _internal_set_is_color(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.is_color) +} + +// optional float scale = 2 [default = 1]; +inline bool ImageDataParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool ImageDataParameter::has_scale() const { + return _internal_has_scale(); +} +inline void ImageDataParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000400u; +} +inline float ImageDataParameter::_internal_scale() const { + return scale_; +} +inline float ImageDataParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.scale) + return _internal_scale(); +} +inline void ImageDataParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000400u; + scale_ = value; +} +inline void ImageDataParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.scale) +} + +// optional string mean_file = 3; +inline bool ImageDataParameter::_internal_has_mean_file() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ImageDataParameter::has_mean_file() const { + return _internal_has_mean_file(); +} +inline void ImageDataParameter::clear_mean_file() { + mean_file_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& ImageDataParameter::mean_file() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.mean_file) + return _internal_mean_file(); +} +inline void ImageDataParameter::set_mean_file(const std::string& value) { + _internal_set_mean_file(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.mean_file) +} +inline std::string* ImageDataParameter::mutable_mean_file() { + // @@protoc_insertion_point(field_mutable:caffe.ImageDataParameter.mean_file) + return _internal_mutable_mean_file(); +} +inline const std::string& ImageDataParameter::_internal_mean_file() const { + return mean_file_.Get(); +} +inline void ImageDataParameter::_internal_set_mean_file(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void ImageDataParameter::set_mean_file(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.ImageDataParameter.mean_file) +} +inline void ImageDataParameter::set_mean_file(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.ImageDataParameter.mean_file) +} +inline void ImageDataParameter::set_mean_file(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.ImageDataParameter.mean_file) +} +inline std::string* ImageDataParameter::_internal_mutable_mean_file() { + _has_bits_[0] |= 0x00000002u; + return mean_file_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* ImageDataParameter::release_mean_file() { + // @@protoc_insertion_point(field_release:caffe.ImageDataParameter.mean_file) + if (!_internal_has_mean_file()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return mean_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void ImageDataParameter::set_allocated_mean_file(std::string* mean_file) { + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), mean_file, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.ImageDataParameter.mean_file) +} +inline std::string* ImageDataParameter::unsafe_arena_release_mean_file() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.ImageDataParameter.mean_file) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return mean_file_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void ImageDataParameter::unsafe_arena_set_allocated_mean_file( + std::string* mean_file) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + mean_file, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ImageDataParameter.mean_file) +} + +// optional uint32 crop_size = 5 [default = 0]; +inline bool ImageDataParameter::_internal_has_crop_size() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ImageDataParameter::has_crop_size() const { + return _internal_has_crop_size(); +} +inline void ImageDataParameter::clear_crop_size() { + crop_size_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::_internal_crop_size() const { + return crop_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 ImageDataParameter::crop_size() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.crop_size) + return _internal_crop_size(); +} +inline void ImageDataParameter::_internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + crop_size_ = value; +} +inline void ImageDataParameter::set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_crop_size(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.crop_size) +} + +// optional bool mirror = 6 [default = false]; +inline bool ImageDataParameter::_internal_has_mirror() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool ImageDataParameter::has_mirror() const { + return _internal_has_mirror(); +} +inline void ImageDataParameter::clear_mirror() { + mirror_ = false; + _has_bits_[0] &= ~0x00000040u; +} +inline bool ImageDataParameter::_internal_mirror() const { + return mirror_; +} +inline bool ImageDataParameter::mirror() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.mirror) + return _internal_mirror(); +} +inline void ImageDataParameter::_internal_set_mirror(bool value) { + _has_bits_[0] |= 0x00000040u; + mirror_ = value; +} +inline void ImageDataParameter::set_mirror(bool value) { + _internal_set_mirror(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.mirror) +} + +// optional string root_folder = 12 [default = ""]; +inline bool ImageDataParameter::_internal_has_root_folder() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ImageDataParameter::has_root_folder() const { + return _internal_has_root_folder(); +} +inline void ImageDataParameter::clear_root_folder() { + root_folder_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& ImageDataParameter::root_folder() const { + // @@protoc_insertion_point(field_get:caffe.ImageDataParameter.root_folder) + return _internal_root_folder(); +} +inline void ImageDataParameter::set_root_folder(const std::string& value) { + _internal_set_root_folder(value); + // @@protoc_insertion_point(field_set:caffe.ImageDataParameter.root_folder) +} +inline std::string* ImageDataParameter::mutable_root_folder() { + // @@protoc_insertion_point(field_mutable:caffe.ImageDataParameter.root_folder) + return _internal_mutable_root_folder(); +} +inline const std::string& ImageDataParameter::_internal_root_folder() const { + return root_folder_.Get(); +} +inline void ImageDataParameter::_internal_set_root_folder(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void ImageDataParameter::set_root_folder(std::string&& value) { + _has_bits_[0] |= 0x00000004u; + root_folder_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.ImageDataParameter.root_folder) +} +inline void ImageDataParameter::set_root_folder(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000004u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.ImageDataParameter.root_folder) +} +inline void ImageDataParameter::set_root_folder(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000004u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.ImageDataParameter.root_folder) +} +inline std::string* ImageDataParameter::_internal_mutable_root_folder() { + _has_bits_[0] |= 0x00000004u; + return root_folder_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* ImageDataParameter::release_root_folder() { + // @@protoc_insertion_point(field_release:caffe.ImageDataParameter.root_folder) + if (!_internal_has_root_folder()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + return root_folder_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void ImageDataParameter::set_allocated_root_folder(std::string* root_folder) { + if (root_folder != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + root_folder_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root_folder, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.ImageDataParameter.root_folder) +} +inline std::string* ImageDataParameter::unsafe_arena_release_root_folder() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.ImageDataParameter.root_folder) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000004u; + return root_folder_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void ImageDataParameter::unsafe_arena_set_allocated_root_folder( + std::string* root_folder) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (root_folder != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + root_folder_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + root_folder, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ImageDataParameter.root_folder) +} + +// ------------------------------------------------------------------- + +// InfogainLossParameter + +// optional string source = 1; +inline bool InfogainLossParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool InfogainLossParameter::has_source() const { + return _internal_has_source(); +} +inline void InfogainLossParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& InfogainLossParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.InfogainLossParameter.source) + return _internal_source(); +} +inline void InfogainLossParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.InfogainLossParameter.source) +} +inline std::string* InfogainLossParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.InfogainLossParameter.source) + return _internal_mutable_source(); +} +inline const std::string& InfogainLossParameter::_internal_source() const { + return source_.Get(); +} +inline void InfogainLossParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void InfogainLossParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.InfogainLossParameter.source) +} +inline void InfogainLossParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.InfogainLossParameter.source) +} +inline void InfogainLossParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.InfogainLossParameter.source) +} +inline std::string* InfogainLossParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000001u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* InfogainLossParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.InfogainLossParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void InfogainLossParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.InfogainLossParameter.source) +} +inline std::string* InfogainLossParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.InfogainLossParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void InfogainLossParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.InfogainLossParameter.source) +} + +// optional int32 axis = 2 [default = 1]; +inline bool InfogainLossParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool InfogainLossParameter::has_axis() const { + return _internal_has_axis(); +} +inline void InfogainLossParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 InfogainLossParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 InfogainLossParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.InfogainLossParameter.axis) + return _internal_axis(); +} +inline void InfogainLossParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void InfogainLossParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.InfogainLossParameter.axis) +} + +// ------------------------------------------------------------------- + +// InnerProductParameter + +// optional uint32 num_output = 1; +inline bool InnerProductParameter::_internal_has_num_output() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool InnerProductParameter::has_num_output() const { + return _internal_has_num_output(); +} +inline void InnerProductParameter::clear_num_output() { + num_output_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 InnerProductParameter::_internal_num_output() const { + return num_output_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 InnerProductParameter::num_output() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.num_output) + return _internal_num_output(); +} +inline void InnerProductParameter::_internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + num_output_ = value; +} +inline void InnerProductParameter::set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_num_output(value); + // @@protoc_insertion_point(field_set:caffe.InnerProductParameter.num_output) +} + +// optional bool bias_term = 2 [default = true]; +inline bool InnerProductParameter::_internal_has_bias_term() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool InnerProductParameter::has_bias_term() const { + return _internal_has_bias_term(); +} +inline void InnerProductParameter::clear_bias_term() { + bias_term_ = true; + _has_bits_[0] &= ~0x00000010u; +} +inline bool InnerProductParameter::_internal_bias_term() const { + return bias_term_; +} +inline bool InnerProductParameter::bias_term() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.bias_term) + return _internal_bias_term(); +} +inline void InnerProductParameter::_internal_set_bias_term(bool value) { + _has_bits_[0] |= 0x00000010u; + bias_term_ = value; +} +inline void InnerProductParameter::set_bias_term(bool value) { + _internal_set_bias_term(value); + // @@protoc_insertion_point(field_set:caffe.InnerProductParameter.bias_term) +} + +// optional .caffe.FillerParameter weight_filler = 3; +inline bool InnerProductParameter::_internal_has_weight_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || weight_filler_ != nullptr); + return value; +} +inline bool InnerProductParameter::has_weight_filler() const { + return _internal_has_weight_filler(); +} +inline void InnerProductParameter::clear_weight_filler() { + if (weight_filler_ != nullptr) weight_filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& InnerProductParameter::_internal_weight_filler() const { + const ::caffe::FillerParameter* p = weight_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& InnerProductParameter::weight_filler() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.weight_filler) + return _internal_weight_filler(); +} +inline void InnerProductParameter::unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(weight_filler_); + } + weight_filler_ = weight_filler; + if (weight_filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.InnerProductParameter.weight_filler) +} +inline ::caffe::FillerParameter* InnerProductParameter::release_weight_filler() { + auto temp = unsafe_arena_release_weight_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* InnerProductParameter::unsafe_arena_release_weight_filler() { + // @@protoc_insertion_point(field_release:caffe.InnerProductParameter.weight_filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = weight_filler_; + weight_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* InnerProductParameter::_internal_mutable_weight_filler() { + _has_bits_[0] |= 0x00000001u; + if (weight_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + weight_filler_ = p; + } + return weight_filler_; +} +inline ::caffe::FillerParameter* InnerProductParameter::mutable_weight_filler() { + // @@protoc_insertion_point(field_mutable:caffe.InnerProductParameter.weight_filler) + return _internal_mutable_weight_filler(); +} +inline void InnerProductParameter::set_allocated_weight_filler(::caffe::FillerParameter* weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete weight_filler_; + } + if (weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(weight_filler); + if (message_arena != submessage_arena) { + weight_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, weight_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + weight_filler_ = weight_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.InnerProductParameter.weight_filler) +} + +// optional .caffe.FillerParameter bias_filler = 4; +inline bool InnerProductParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool InnerProductParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void InnerProductParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::FillerParameter& InnerProductParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& InnerProductParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.bias_filler) + return _internal_bias_filler(); +} +inline void InnerProductParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.InnerProductParameter.bias_filler) +} +inline ::caffe::FillerParameter* InnerProductParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* InnerProductParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.InnerProductParameter.bias_filler) + _has_bits_[0] &= ~0x00000002u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* InnerProductParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000002u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* InnerProductParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.InnerProductParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void InnerProductParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.InnerProductParameter.bias_filler) +} + +// optional int32 axis = 5 [default = 1]; +inline bool InnerProductParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool InnerProductParameter::has_axis() const { + return _internal_has_axis(); +} +inline void InnerProductParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000020u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 InnerProductParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 InnerProductParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.axis) + return _internal_axis(); +} +inline void InnerProductParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000020u; + axis_ = value; +} +inline void InnerProductParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.InnerProductParameter.axis) +} + +// optional bool transpose = 6 [default = false]; +inline bool InnerProductParameter::_internal_has_transpose() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool InnerProductParameter::has_transpose() const { + return _internal_has_transpose(); +} +inline void InnerProductParameter::clear_transpose() { + transpose_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool InnerProductParameter::_internal_transpose() const { + return transpose_; +} +inline bool InnerProductParameter::transpose() const { + // @@protoc_insertion_point(field_get:caffe.InnerProductParameter.transpose) + return _internal_transpose(); +} +inline void InnerProductParameter::_internal_set_transpose(bool value) { + _has_bits_[0] |= 0x00000008u; + transpose_ = value; +} +inline void InnerProductParameter::set_transpose(bool value) { + _internal_set_transpose(value); + // @@protoc_insertion_point(field_set:caffe.InnerProductParameter.transpose) +} + +// ------------------------------------------------------------------- + +// InputParameter + +// repeated .caffe.BlobShape shape = 1; +inline int InputParameter::_internal_shape_size() const { + return shape_.size(); +} +inline int InputParameter::shape_size() const { + return _internal_shape_size(); +} +inline void InputParameter::clear_shape() { + shape_.Clear(); +} +inline ::caffe::BlobShape* InputParameter::mutable_shape(int index) { + // @@protoc_insertion_point(field_mutable:caffe.InputParameter.shape) + return shape_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >* +InputParameter::mutable_shape() { + // @@protoc_insertion_point(field_mutable_list:caffe.InputParameter.shape) + return &shape_; +} +inline const ::caffe::BlobShape& InputParameter::_internal_shape(int index) const { + return shape_.Get(index); +} +inline const ::caffe::BlobShape& InputParameter::shape(int index) const { + // @@protoc_insertion_point(field_get:caffe.InputParameter.shape) + return _internal_shape(index); +} +inline ::caffe::BlobShape* InputParameter::_internal_add_shape() { + return shape_.Add(); +} +inline ::caffe::BlobShape* InputParameter::add_shape() { + // @@protoc_insertion_point(field_add:caffe.InputParameter.shape) + return _internal_add_shape(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobShape >& +InputParameter::shape() const { + // @@protoc_insertion_point(field_list:caffe.InputParameter.shape) + return shape_; +} + +// ------------------------------------------------------------------- + +// LogParameter + +// optional float base = 1 [default = -1]; +inline bool LogParameter::_internal_has_base() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool LogParameter::has_base() const { + return _internal_has_base(); +} +inline void LogParameter::clear_base() { + base_ = -1; + _has_bits_[0] &= ~0x00000002u; +} +inline float LogParameter::_internal_base() const { + return base_; +} +inline float LogParameter::base() const { + // @@protoc_insertion_point(field_get:caffe.LogParameter.base) + return _internal_base(); +} +inline void LogParameter::_internal_set_base(float value) { + _has_bits_[0] |= 0x00000002u; + base_ = value; +} +inline void LogParameter::set_base(float value) { + _internal_set_base(value); + // @@protoc_insertion_point(field_set:caffe.LogParameter.base) +} + +// optional float scale = 2 [default = 1]; +inline bool LogParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool LogParameter::has_scale() const { + return _internal_has_scale(); +} +inline void LogParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline float LogParameter::_internal_scale() const { + return scale_; +} +inline float LogParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.LogParameter.scale) + return _internal_scale(); +} +inline void LogParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000004u; + scale_ = value; +} +inline void LogParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.LogParameter.scale) +} + +// optional float shift = 3 [default = 0]; +inline bool LogParameter::_internal_has_shift() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool LogParameter::has_shift() const { + return _internal_has_shift(); +} +inline void LogParameter::clear_shift() { + shift_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float LogParameter::_internal_shift() const { + return shift_; +} +inline float LogParameter::shift() const { + // @@protoc_insertion_point(field_get:caffe.LogParameter.shift) + return _internal_shift(); +} +inline void LogParameter::_internal_set_shift(float value) { + _has_bits_[0] |= 0x00000001u; + shift_ = value; +} +inline void LogParameter::set_shift(float value) { + _internal_set_shift(value); + // @@protoc_insertion_point(field_set:caffe.LogParameter.shift) +} + +// ------------------------------------------------------------------- + +// LRNParameter + +// optional uint32 local_size = 1 [default = 5]; +inline bool LRNParameter::_internal_has_local_size() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool LRNParameter::has_local_size() const { + return _internal_has_local_size(); +} +inline void LRNParameter::clear_local_size() { + local_size_ = 5u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 LRNParameter::_internal_local_size() const { + return local_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 LRNParameter::local_size() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.local_size) + return _internal_local_size(); +} +inline void LRNParameter::_internal_set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + local_size_ = value; +} +inline void LRNParameter::set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_local_size(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.local_size) +} + +// optional float alpha = 2 [default = 1]; +inline bool LRNParameter::_internal_has_alpha() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool LRNParameter::has_alpha() const { + return _internal_has_alpha(); +} +inline void LRNParameter::clear_alpha() { + alpha_ = 1; + _has_bits_[0] &= ~0x00000008u; +} +inline float LRNParameter::_internal_alpha() const { + return alpha_; +} +inline float LRNParameter::alpha() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.alpha) + return _internal_alpha(); +} +inline void LRNParameter::_internal_set_alpha(float value) { + _has_bits_[0] |= 0x00000008u; + alpha_ = value; +} +inline void LRNParameter::set_alpha(float value) { + _internal_set_alpha(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.alpha) +} + +// optional float beta = 3 [default = 0.75]; +inline bool LRNParameter::_internal_has_beta() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool LRNParameter::has_beta() const { + return _internal_has_beta(); +} +inline void LRNParameter::clear_beta() { + beta_ = 0.75f; + _has_bits_[0] &= ~0x00000010u; +} +inline float LRNParameter::_internal_beta() const { + return beta_; +} +inline float LRNParameter::beta() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.beta) + return _internal_beta(); +} +inline void LRNParameter::_internal_set_beta(float value) { + _has_bits_[0] |= 0x00000010u; + beta_ = value; +} +inline void LRNParameter::set_beta(float value) { + _internal_set_beta(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.beta) +} + +// optional .caffe.LRNParameter.NormRegion norm_region = 4 [default = ACROSS_CHANNELS]; +inline bool LRNParameter::_internal_has_norm_region() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool LRNParameter::has_norm_region() const { + return _internal_has_norm_region(); +} +inline void LRNParameter::clear_norm_region() { + norm_region_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::LRNParameter_NormRegion LRNParameter::_internal_norm_region() const { + return static_cast< ::caffe::LRNParameter_NormRegion >(norm_region_); +} +inline ::caffe::LRNParameter_NormRegion LRNParameter::norm_region() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.norm_region) + return _internal_norm_region(); +} +inline void LRNParameter::_internal_set_norm_region(::caffe::LRNParameter_NormRegion value) { + assert(::caffe::LRNParameter_NormRegion_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + norm_region_ = value; +} +inline void LRNParameter::set_norm_region(::caffe::LRNParameter_NormRegion value) { + _internal_set_norm_region(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.norm_region) +} + +// optional float k = 5 [default = 1]; +inline bool LRNParameter::_internal_has_k() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool LRNParameter::has_k() const { + return _internal_has_k(); +} +inline void LRNParameter::clear_k() { + k_ = 1; + _has_bits_[0] &= ~0x00000020u; +} +inline float LRNParameter::_internal_k() const { + return k_; +} +inline float LRNParameter::k() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.k) + return _internal_k(); +} +inline void LRNParameter::_internal_set_k(float value) { + _has_bits_[0] |= 0x00000020u; + k_ = value; +} +inline void LRNParameter::set_k(float value) { + _internal_set_k(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.k) +} + +// optional .caffe.LRNParameter.Engine engine = 6 [default = DEFAULT]; +inline bool LRNParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool LRNParameter::has_engine() const { + return _internal_has_engine(); +} +inline void LRNParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::LRNParameter_Engine LRNParameter::_internal_engine() const { + return static_cast< ::caffe::LRNParameter_Engine >(engine_); +} +inline ::caffe::LRNParameter_Engine LRNParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.LRNParameter.engine) + return _internal_engine(); +} +inline void LRNParameter::_internal_set_engine(::caffe::LRNParameter_Engine value) { + assert(::caffe::LRNParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + engine_ = value; +} +inline void LRNParameter::set_engine(::caffe::LRNParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.LRNParameter.engine) +} + +// ------------------------------------------------------------------- + +// MemoryDataParameter + +// optional uint32 batch_size = 1; +inline bool MemoryDataParameter::_internal_has_batch_size() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool MemoryDataParameter::has_batch_size() const { + return _internal_has_batch_size(); +} +inline void MemoryDataParameter::clear_batch_size() { + batch_size_ = 0u; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::_internal_batch_size() const { + return batch_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::batch_size() const { + // @@protoc_insertion_point(field_get:caffe.MemoryDataParameter.batch_size) + return _internal_batch_size(); +} +inline void MemoryDataParameter::_internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000001u; + batch_size_ = value; +} +inline void MemoryDataParameter::set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batch_size(value); + // @@protoc_insertion_point(field_set:caffe.MemoryDataParameter.batch_size) +} + +// optional uint32 channels = 2; +inline bool MemoryDataParameter::_internal_has_channels() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool MemoryDataParameter::has_channels() const { + return _internal_has_channels(); +} +inline void MemoryDataParameter::clear_channels() { + channels_ = 0u; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::_internal_channels() const { + return channels_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::channels() const { + // @@protoc_insertion_point(field_get:caffe.MemoryDataParameter.channels) + return _internal_channels(); +} +inline void MemoryDataParameter::_internal_set_channels(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000002u; + channels_ = value; +} +inline void MemoryDataParameter::set_channels(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_channels(value); + // @@protoc_insertion_point(field_set:caffe.MemoryDataParameter.channels) +} + +// optional uint32 height = 3; +inline bool MemoryDataParameter::_internal_has_height() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool MemoryDataParameter::has_height() const { + return _internal_has_height(); +} +inline void MemoryDataParameter::clear_height() { + height_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::_internal_height() const { + return height_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::height() const { + // @@protoc_insertion_point(field_get:caffe.MemoryDataParameter.height) + return _internal_height(); +} +inline void MemoryDataParameter::_internal_set_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + height_ = value; +} +inline void MemoryDataParameter::set_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_height(value); + // @@protoc_insertion_point(field_set:caffe.MemoryDataParameter.height) +} + +// optional uint32 width = 4; +inline bool MemoryDataParameter::_internal_has_width() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool MemoryDataParameter::has_width() const { + return _internal_has_width(); +} +inline void MemoryDataParameter::clear_width() { + width_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::_internal_width() const { + return width_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 MemoryDataParameter::width() const { + // @@protoc_insertion_point(field_get:caffe.MemoryDataParameter.width) + return _internal_width(); +} +inline void MemoryDataParameter::_internal_set_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + width_ = value; +} +inline void MemoryDataParameter::set_width(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_width(value); + // @@protoc_insertion_point(field_set:caffe.MemoryDataParameter.width) +} + +// ------------------------------------------------------------------- + +// MVNParameter + +// optional bool normalize_variance = 1 [default = true]; +inline bool MVNParameter::_internal_has_normalize_variance() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool MVNParameter::has_normalize_variance() const { + return _internal_has_normalize_variance(); +} +inline void MVNParameter::clear_normalize_variance() { + normalize_variance_ = true; + _has_bits_[0] &= ~0x00000002u; +} +inline bool MVNParameter::_internal_normalize_variance() const { + return normalize_variance_; +} +inline bool MVNParameter::normalize_variance() const { + // @@protoc_insertion_point(field_get:caffe.MVNParameter.normalize_variance) + return _internal_normalize_variance(); +} +inline void MVNParameter::_internal_set_normalize_variance(bool value) { + _has_bits_[0] |= 0x00000002u; + normalize_variance_ = value; +} +inline void MVNParameter::set_normalize_variance(bool value) { + _internal_set_normalize_variance(value); + // @@protoc_insertion_point(field_set:caffe.MVNParameter.normalize_variance) +} + +// optional bool across_channels = 2 [default = false]; +inline bool MVNParameter::_internal_has_across_channels() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool MVNParameter::has_across_channels() const { + return _internal_has_across_channels(); +} +inline void MVNParameter::clear_across_channels() { + across_channels_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool MVNParameter::_internal_across_channels() const { + return across_channels_; +} +inline bool MVNParameter::across_channels() const { + // @@protoc_insertion_point(field_get:caffe.MVNParameter.across_channels) + return _internal_across_channels(); +} +inline void MVNParameter::_internal_set_across_channels(bool value) { + _has_bits_[0] |= 0x00000001u; + across_channels_ = value; +} +inline void MVNParameter::set_across_channels(bool value) { + _internal_set_across_channels(value); + // @@protoc_insertion_point(field_set:caffe.MVNParameter.across_channels) +} + +// optional float eps = 3 [default = 1e-09]; +inline bool MVNParameter::_internal_has_eps() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool MVNParameter::has_eps() const { + return _internal_has_eps(); +} +inline void MVNParameter::clear_eps() { + eps_ = 1e-09f; + _has_bits_[0] &= ~0x00000004u; +} +inline float MVNParameter::_internal_eps() const { + return eps_; +} +inline float MVNParameter::eps() const { + // @@protoc_insertion_point(field_get:caffe.MVNParameter.eps) + return _internal_eps(); +} +inline void MVNParameter::_internal_set_eps(float value) { + _has_bits_[0] |= 0x00000004u; + eps_ = value; +} +inline void MVNParameter::set_eps(float value) { + _internal_set_eps(value); + // @@protoc_insertion_point(field_set:caffe.MVNParameter.eps) +} + +// ------------------------------------------------------------------- + +// ParameterParameter + +// optional .caffe.BlobShape shape = 1; +inline bool ParameterParameter::_internal_has_shape() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || shape_ != nullptr); + return value; +} +inline bool ParameterParameter::has_shape() const { + return _internal_has_shape(); +} +inline void ParameterParameter::clear_shape() { + if (shape_ != nullptr) shape_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::BlobShape& ParameterParameter::_internal_shape() const { + const ::caffe::BlobShape* p = shape_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_BlobShape_default_instance_); +} +inline const ::caffe::BlobShape& ParameterParameter::shape() const { + // @@protoc_insertion_point(field_get:caffe.ParameterParameter.shape) + return _internal_shape(); +} +inline void ParameterParameter::unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape_); + } + shape_ = shape; + if (shape) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ParameterParameter.shape) +} +inline ::caffe::BlobShape* ParameterParameter::release_shape() { + auto temp = unsafe_arena_release_shape(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::BlobShape* ParameterParameter::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:caffe.ParameterParameter.shape) + _has_bits_[0] &= ~0x00000001u; + ::caffe::BlobShape* temp = shape_; + shape_ = nullptr; + return temp; +} +inline ::caffe::BlobShape* ParameterParameter::_internal_mutable_shape() { + _has_bits_[0] |= 0x00000001u; + if (shape_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::BlobShape>(GetArena()); + shape_ = p; + } + return shape_; +} +inline ::caffe::BlobShape* ParameterParameter::mutable_shape() { + // @@protoc_insertion_point(field_mutable:caffe.ParameterParameter.shape) + return _internal_mutable_shape(); +} +inline void ParameterParameter::set_allocated_shape(::caffe::BlobShape* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete shape_; + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(shape); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:caffe.ParameterParameter.shape) +} + +// ------------------------------------------------------------------- + +// PoolingParameter + +// optional .caffe.PoolingParameter.PoolMethod pool = 1 [default = MAX]; +inline bool PoolingParameter::_internal_has_pool() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool PoolingParameter::has_pool() const { + return _internal_has_pool(); +} +inline void PoolingParameter::clear_pool() { + pool_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::PoolingParameter_PoolMethod PoolingParameter::_internal_pool() const { + return static_cast< ::caffe::PoolingParameter_PoolMethod >(pool_); +} +inline ::caffe::PoolingParameter_PoolMethod PoolingParameter::pool() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.pool) + return _internal_pool(); +} +inline void PoolingParameter::_internal_set_pool(::caffe::PoolingParameter_PoolMethod value) { + assert(::caffe::PoolingParameter_PoolMethod_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + pool_ = value; +} +inline void PoolingParameter::set_pool(::caffe::PoolingParameter_PoolMethod value) { + _internal_set_pool(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.pool) +} + +// optional uint32 pad = 4 [default = 0]; +inline bool PoolingParameter::_internal_has_pad() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool PoolingParameter::has_pad() const { + return _internal_has_pad(); +} +inline void PoolingParameter::clear_pad() { + pad_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_pad() const { + return pad_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::pad() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.pad) + return _internal_pad(); +} +inline void PoolingParameter::_internal_set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + pad_ = value; +} +inline void PoolingParameter::set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.pad) +} + +// optional uint32 pad_h = 9 [default = 0]; +inline bool PoolingParameter::_internal_has_pad_h() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool PoolingParameter::has_pad_h() const { + return _internal_has_pad_h(); +} +inline void PoolingParameter::clear_pad_h() { + pad_h_ = 0u; + _has_bits_[0] &= ~0x00000080u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_pad_h() const { + return pad_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::pad_h() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.pad_h) + return _internal_pad_h(); +} +inline void PoolingParameter::_internal_set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000080u; + pad_h_ = value; +} +inline void PoolingParameter::set_pad_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad_h(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.pad_h) +} + +// optional uint32 pad_w = 10 [default = 0]; +inline bool PoolingParameter::_internal_has_pad_w() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool PoolingParameter::has_pad_w() const { + return _internal_has_pad_w(); +} +inline void PoolingParameter::clear_pad_w() { + pad_w_ = 0u; + _has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_pad_w() const { + return pad_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::pad_w() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.pad_w) + return _internal_pad_w(); +} +inline void PoolingParameter::_internal_set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000100u; + pad_w_ = value; +} +inline void PoolingParameter::set_pad_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad_w(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.pad_w) +} + +// optional uint32 kernel_size = 2; +inline bool PoolingParameter::_internal_has_kernel_size() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool PoolingParameter::has_kernel_size() const { + return _internal_has_kernel_size(); +} +inline void PoolingParameter::clear_kernel_size() { + kernel_size_ = 0u; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_kernel_size() const { + return kernel_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::kernel_size() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.kernel_size) + return _internal_kernel_size(); +} +inline void PoolingParameter::_internal_set_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000002u; + kernel_size_ = value; +} +inline void PoolingParameter::set_kernel_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernel_size(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.kernel_size) +} + +// optional uint32 kernel_h = 5; +inline bool PoolingParameter::_internal_has_kernel_h() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool PoolingParameter::has_kernel_h() const { + return _internal_has_kernel_h(); +} +inline void PoolingParameter::clear_kernel_h() { + kernel_h_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_kernel_h() const { + return kernel_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::kernel_h() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.kernel_h) + return _internal_kernel_h(); +} +inline void PoolingParameter::_internal_set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000008u; + kernel_h_ = value; +} +inline void PoolingParameter::set_kernel_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernel_h(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.kernel_h) +} + +// optional uint32 kernel_w = 6; +inline bool PoolingParameter::_internal_has_kernel_w() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool PoolingParameter::has_kernel_w() const { + return _internal_has_kernel_w(); +} +inline void PoolingParameter::clear_kernel_w() { + kernel_w_ = 0u; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_kernel_w() const { + return kernel_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::kernel_w() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.kernel_w) + return _internal_kernel_w(); +} +inline void PoolingParameter::_internal_set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000010u; + kernel_w_ = value; +} +inline void PoolingParameter::set_kernel_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernel_w(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.kernel_w) +} + +// optional uint32 stride = 3 [default = 1]; +inline bool PoolingParameter::_internal_has_stride() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool PoolingParameter::has_stride() const { + return _internal_has_stride(); +} +inline void PoolingParameter::clear_stride() { + stride_ = 1u; + _has_bits_[0] &= ~0x00001000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_stride() const { + return stride_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::stride() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.stride) + return _internal_stride(); +} +inline void PoolingParameter::_internal_set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00001000u; + stride_ = value; +} +inline void PoolingParameter::set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.stride) +} + +// optional uint32 stride_h = 7; +inline bool PoolingParameter::_internal_has_stride_h() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool PoolingParameter::has_stride_h() const { + return _internal_has_stride_h(); +} +inline void PoolingParameter::clear_stride_h() { + stride_h_ = 0u; + _has_bits_[0] &= ~0x00000020u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_stride_h() const { + return stride_h_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::stride_h() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.stride_h) + return _internal_stride_h(); +} +inline void PoolingParameter::_internal_set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000020u; + stride_h_ = value; +} +inline void PoolingParameter::set_stride_h(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride_h(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.stride_h) +} + +// optional uint32 stride_w = 8; +inline bool PoolingParameter::_internal_has_stride_w() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool PoolingParameter::has_stride_w() const { + return _internal_has_stride_w(); +} +inline void PoolingParameter::clear_stride_w() { + stride_w_ = 0u; + _has_bits_[0] &= ~0x00000040u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::_internal_stride_w() const { + return stride_w_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 PoolingParameter::stride_w() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.stride_w) + return _internal_stride_w(); +} +inline void PoolingParameter::_internal_set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000040u; + stride_w_ = value; +} +inline void PoolingParameter::set_stride_w(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride_w(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.stride_w) +} + +// optional .caffe.PoolingParameter.Engine engine = 11 [default = DEFAULT]; +inline bool PoolingParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool PoolingParameter::has_engine() const { + return _internal_has_engine(); +} +inline void PoolingParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::caffe::PoolingParameter_Engine PoolingParameter::_internal_engine() const { + return static_cast< ::caffe::PoolingParameter_Engine >(engine_); +} +inline ::caffe::PoolingParameter_Engine PoolingParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.engine) + return _internal_engine(); +} +inline void PoolingParameter::_internal_set_engine(::caffe::PoolingParameter_Engine value) { + assert(::caffe::PoolingParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000200u; + engine_ = value; +} +inline void PoolingParameter::set_engine(::caffe::PoolingParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.engine) +} + +// optional bool global_pooling = 12 [default = false]; +inline bool PoolingParameter::_internal_has_global_pooling() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool PoolingParameter::has_global_pooling() const { + return _internal_has_global_pooling(); +} +inline void PoolingParameter::clear_global_pooling() { + global_pooling_ = false; + _has_bits_[0] &= ~0x00000400u; +} +inline bool PoolingParameter::_internal_global_pooling() const { + return global_pooling_; +} +inline bool PoolingParameter::global_pooling() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.global_pooling) + return _internal_global_pooling(); +} +inline void PoolingParameter::_internal_set_global_pooling(bool value) { + _has_bits_[0] |= 0x00000400u; + global_pooling_ = value; +} +inline void PoolingParameter::set_global_pooling(bool value) { + _internal_set_global_pooling(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.global_pooling) +} + +// optional .caffe.PoolingParameter.RoundMode round_mode = 13 [default = CEIL]; +inline bool PoolingParameter::_internal_has_round_mode() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool PoolingParameter::has_round_mode() const { + return _internal_has_round_mode(); +} +inline void PoolingParameter::clear_round_mode() { + round_mode_ = 0; + _has_bits_[0] &= ~0x00000800u; +} +inline ::caffe::PoolingParameter_RoundMode PoolingParameter::_internal_round_mode() const { + return static_cast< ::caffe::PoolingParameter_RoundMode >(round_mode_); +} +inline ::caffe::PoolingParameter_RoundMode PoolingParameter::round_mode() const { + // @@protoc_insertion_point(field_get:caffe.PoolingParameter.round_mode) + return _internal_round_mode(); +} +inline void PoolingParameter::_internal_set_round_mode(::caffe::PoolingParameter_RoundMode value) { + assert(::caffe::PoolingParameter_RoundMode_IsValid(value)); + _has_bits_[0] |= 0x00000800u; + round_mode_ = value; +} +inline void PoolingParameter::set_round_mode(::caffe::PoolingParameter_RoundMode value) { + _internal_set_round_mode(value); + // @@protoc_insertion_point(field_set:caffe.PoolingParameter.round_mode) +} + +// ------------------------------------------------------------------- + +// PowerParameter + +// optional float power = 1 [default = 1]; +inline bool PowerParameter::_internal_has_power() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool PowerParameter::has_power() const { + return _internal_has_power(); +} +inline void PowerParameter::clear_power() { + power_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline float PowerParameter::_internal_power() const { + return power_; +} +inline float PowerParameter::power() const { + // @@protoc_insertion_point(field_get:caffe.PowerParameter.power) + return _internal_power(); +} +inline void PowerParameter::_internal_set_power(float value) { + _has_bits_[0] |= 0x00000002u; + power_ = value; +} +inline void PowerParameter::set_power(float value) { + _internal_set_power(value); + // @@protoc_insertion_point(field_set:caffe.PowerParameter.power) +} + +// optional float scale = 2 [default = 1]; +inline bool PowerParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool PowerParameter::has_scale() const { + return _internal_has_scale(); +} +inline void PowerParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline float PowerParameter::_internal_scale() const { + return scale_; +} +inline float PowerParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.PowerParameter.scale) + return _internal_scale(); +} +inline void PowerParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000004u; + scale_ = value; +} +inline void PowerParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.PowerParameter.scale) +} + +// optional float shift = 3 [default = 0]; +inline bool PowerParameter::_internal_has_shift() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool PowerParameter::has_shift() const { + return _internal_has_shift(); +} +inline void PowerParameter::clear_shift() { + shift_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float PowerParameter::_internal_shift() const { + return shift_; +} +inline float PowerParameter::shift() const { + // @@protoc_insertion_point(field_get:caffe.PowerParameter.shift) + return _internal_shift(); +} +inline void PowerParameter::_internal_set_shift(float value) { + _has_bits_[0] |= 0x00000001u; + shift_ = value; +} +inline void PowerParameter::set_shift(float value) { + _internal_set_shift(value); + // @@protoc_insertion_point(field_set:caffe.PowerParameter.shift) +} + +// ------------------------------------------------------------------- + +// PythonParameter + +// optional string module = 1; +inline bool PythonParameter::_internal_has_module() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool PythonParameter::has_module() const { + return _internal_has_module(); +} +inline void PythonParameter::clear_module() { + module_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& PythonParameter::module() const { + // @@protoc_insertion_point(field_get:caffe.PythonParameter.module) + return _internal_module(); +} +inline void PythonParameter::set_module(const std::string& value) { + _internal_set_module(value); + // @@protoc_insertion_point(field_set:caffe.PythonParameter.module) +} +inline std::string* PythonParameter::mutable_module() { + // @@protoc_insertion_point(field_mutable:caffe.PythonParameter.module) + return _internal_mutable_module(); +} +inline const std::string& PythonParameter::_internal_module() const { + return module_.Get(); +} +inline void PythonParameter::_internal_set_module(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + module_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void PythonParameter::set_module(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + module_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.PythonParameter.module) +} +inline void PythonParameter::set_module(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + module_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.PythonParameter.module) +} +inline void PythonParameter::set_module(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + module_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.PythonParameter.module) +} +inline std::string* PythonParameter::_internal_mutable_module() { + _has_bits_[0] |= 0x00000001u; + return module_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* PythonParameter::release_module() { + // @@protoc_insertion_point(field_release:caffe.PythonParameter.module) + if (!_internal_has_module()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return module_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void PythonParameter::set_allocated_module(std::string* module) { + if (module != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + module_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), module, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.PythonParameter.module) +} +inline std::string* PythonParameter::unsafe_arena_release_module() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.PythonParameter.module) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return module_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void PythonParameter::unsafe_arena_set_allocated_module( + std::string* module) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (module != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + module_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + module, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.PythonParameter.module) +} + +// optional string layer = 2; +inline bool PythonParameter::_internal_has_layer() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool PythonParameter::has_layer() const { + return _internal_has_layer(); +} +inline void PythonParameter::clear_layer() { + layer_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& PythonParameter::layer() const { + // @@protoc_insertion_point(field_get:caffe.PythonParameter.layer) + return _internal_layer(); +} +inline void PythonParameter::set_layer(const std::string& value) { + _internal_set_layer(value); + // @@protoc_insertion_point(field_set:caffe.PythonParameter.layer) +} +inline std::string* PythonParameter::mutable_layer() { + // @@protoc_insertion_point(field_mutable:caffe.PythonParameter.layer) + return _internal_mutable_layer(); +} +inline const std::string& PythonParameter::_internal_layer() const { + return layer_.Get(); +} +inline void PythonParameter::_internal_set_layer(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + layer_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void PythonParameter::set_layer(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + layer_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.PythonParameter.layer) +} +inline void PythonParameter::set_layer(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + layer_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.PythonParameter.layer) +} +inline void PythonParameter::set_layer(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + layer_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.PythonParameter.layer) +} +inline std::string* PythonParameter::_internal_mutable_layer() { + _has_bits_[0] |= 0x00000002u; + return layer_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* PythonParameter::release_layer() { + // @@protoc_insertion_point(field_release:caffe.PythonParameter.layer) + if (!_internal_has_layer()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return layer_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void PythonParameter::set_allocated_layer(std::string* layer) { + if (layer != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + layer_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), layer, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.PythonParameter.layer) +} +inline std::string* PythonParameter::unsafe_arena_release_layer() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.PythonParameter.layer) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return layer_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void PythonParameter::unsafe_arena_set_allocated_layer( + std::string* layer) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (layer != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + layer_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + layer, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.PythonParameter.layer) +} + +// optional string param_str = 3 [default = ""]; +inline bool PythonParameter::_internal_has_param_str() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool PythonParameter::has_param_str() const { + return _internal_has_param_str(); +} +inline void PythonParameter::clear_param_str() { + param_str_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& PythonParameter::param_str() const { + // @@protoc_insertion_point(field_get:caffe.PythonParameter.param_str) + return _internal_param_str(); +} +inline void PythonParameter::set_param_str(const std::string& value) { + _internal_set_param_str(value); + // @@protoc_insertion_point(field_set:caffe.PythonParameter.param_str) +} +inline std::string* PythonParameter::mutable_param_str() { + // @@protoc_insertion_point(field_mutable:caffe.PythonParameter.param_str) + return _internal_mutable_param_str(); +} +inline const std::string& PythonParameter::_internal_param_str() const { + return param_str_.Get(); +} +inline void PythonParameter::_internal_set_param_str(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + param_str_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void PythonParameter::set_param_str(std::string&& value) { + _has_bits_[0] |= 0x00000004u; + param_str_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.PythonParameter.param_str) +} +inline void PythonParameter::set_param_str(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000004u; + param_str_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.PythonParameter.param_str) +} +inline void PythonParameter::set_param_str(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000004u; + param_str_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.PythonParameter.param_str) +} +inline std::string* PythonParameter::_internal_mutable_param_str() { + _has_bits_[0] |= 0x00000004u; + return param_str_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* PythonParameter::release_param_str() { + // @@protoc_insertion_point(field_release:caffe.PythonParameter.param_str) + if (!_internal_has_param_str()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + return param_str_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void PythonParameter::set_allocated_param_str(std::string* param_str) { + if (param_str != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + param_str_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), param_str, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.PythonParameter.param_str) +} +inline std::string* PythonParameter::unsafe_arena_release_param_str() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.PythonParameter.param_str) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000004u; + return param_str_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void PythonParameter::unsafe_arena_set_allocated_param_str( + std::string* param_str) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (param_str != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + param_str_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + param_str, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.PythonParameter.param_str) +} + +// optional bool share_in_parallel = 4 [default = false]; +inline bool PythonParameter::_internal_has_share_in_parallel() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool PythonParameter::has_share_in_parallel() const { + return _internal_has_share_in_parallel(); +} +inline void PythonParameter::clear_share_in_parallel() { + share_in_parallel_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool PythonParameter::_internal_share_in_parallel() const { + return share_in_parallel_; +} +inline bool PythonParameter::share_in_parallel() const { + // @@protoc_insertion_point(field_get:caffe.PythonParameter.share_in_parallel) + return _internal_share_in_parallel(); +} +inline void PythonParameter::_internal_set_share_in_parallel(bool value) { + _has_bits_[0] |= 0x00000008u; + share_in_parallel_ = value; +} +inline void PythonParameter::set_share_in_parallel(bool value) { + _internal_set_share_in_parallel(value); + // @@protoc_insertion_point(field_set:caffe.PythonParameter.share_in_parallel) +} + +// ------------------------------------------------------------------- + +// RecurrentParameter + +// optional uint32 num_output = 1 [default = 0]; +inline bool RecurrentParameter::_internal_has_num_output() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool RecurrentParameter::has_num_output() const { + return _internal_has_num_output(); +} +inline void RecurrentParameter::clear_num_output() { + num_output_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 RecurrentParameter::_internal_num_output() const { + return num_output_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 RecurrentParameter::num_output() const { + // @@protoc_insertion_point(field_get:caffe.RecurrentParameter.num_output) + return _internal_num_output(); +} +inline void RecurrentParameter::_internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000004u; + num_output_ = value; +} +inline void RecurrentParameter::set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_num_output(value); + // @@protoc_insertion_point(field_set:caffe.RecurrentParameter.num_output) +} + +// optional .caffe.FillerParameter weight_filler = 2; +inline bool RecurrentParameter::_internal_has_weight_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || weight_filler_ != nullptr); + return value; +} +inline bool RecurrentParameter::has_weight_filler() const { + return _internal_has_weight_filler(); +} +inline void RecurrentParameter::clear_weight_filler() { + if (weight_filler_ != nullptr) weight_filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& RecurrentParameter::_internal_weight_filler() const { + const ::caffe::FillerParameter* p = weight_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& RecurrentParameter::weight_filler() const { + // @@protoc_insertion_point(field_get:caffe.RecurrentParameter.weight_filler) + return _internal_weight_filler(); +} +inline void RecurrentParameter::unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(weight_filler_); + } + weight_filler_ = weight_filler; + if (weight_filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.RecurrentParameter.weight_filler) +} +inline ::caffe::FillerParameter* RecurrentParameter::release_weight_filler() { + auto temp = unsafe_arena_release_weight_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* RecurrentParameter::unsafe_arena_release_weight_filler() { + // @@protoc_insertion_point(field_release:caffe.RecurrentParameter.weight_filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = weight_filler_; + weight_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* RecurrentParameter::_internal_mutable_weight_filler() { + _has_bits_[0] |= 0x00000001u; + if (weight_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + weight_filler_ = p; + } + return weight_filler_; +} +inline ::caffe::FillerParameter* RecurrentParameter::mutable_weight_filler() { + // @@protoc_insertion_point(field_mutable:caffe.RecurrentParameter.weight_filler) + return _internal_mutable_weight_filler(); +} +inline void RecurrentParameter::set_allocated_weight_filler(::caffe::FillerParameter* weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete weight_filler_; + } + if (weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(weight_filler); + if (message_arena != submessage_arena) { + weight_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, weight_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + weight_filler_ = weight_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.RecurrentParameter.weight_filler) +} + +// optional .caffe.FillerParameter bias_filler = 3; +inline bool RecurrentParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool RecurrentParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void RecurrentParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::FillerParameter& RecurrentParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& RecurrentParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.RecurrentParameter.bias_filler) + return _internal_bias_filler(); +} +inline void RecurrentParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.RecurrentParameter.bias_filler) +} +inline ::caffe::FillerParameter* RecurrentParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* RecurrentParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.RecurrentParameter.bias_filler) + _has_bits_[0] &= ~0x00000002u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* RecurrentParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000002u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* RecurrentParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.RecurrentParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void RecurrentParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.RecurrentParameter.bias_filler) +} + +// optional bool debug_info = 4 [default = false]; +inline bool RecurrentParameter::_internal_has_debug_info() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool RecurrentParameter::has_debug_info() const { + return _internal_has_debug_info(); +} +inline void RecurrentParameter::clear_debug_info() { + debug_info_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool RecurrentParameter::_internal_debug_info() const { + return debug_info_; +} +inline bool RecurrentParameter::debug_info() const { + // @@protoc_insertion_point(field_get:caffe.RecurrentParameter.debug_info) + return _internal_debug_info(); +} +inline void RecurrentParameter::_internal_set_debug_info(bool value) { + _has_bits_[0] |= 0x00000008u; + debug_info_ = value; +} +inline void RecurrentParameter::set_debug_info(bool value) { + _internal_set_debug_info(value); + // @@protoc_insertion_point(field_set:caffe.RecurrentParameter.debug_info) +} + +// optional bool expose_hidden = 5 [default = false]; +inline bool RecurrentParameter::_internal_has_expose_hidden() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool RecurrentParameter::has_expose_hidden() const { + return _internal_has_expose_hidden(); +} +inline void RecurrentParameter::clear_expose_hidden() { + expose_hidden_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool RecurrentParameter::_internal_expose_hidden() const { + return expose_hidden_; +} +inline bool RecurrentParameter::expose_hidden() const { + // @@protoc_insertion_point(field_get:caffe.RecurrentParameter.expose_hidden) + return _internal_expose_hidden(); +} +inline void RecurrentParameter::_internal_set_expose_hidden(bool value) { + _has_bits_[0] |= 0x00000010u; + expose_hidden_ = value; +} +inline void RecurrentParameter::set_expose_hidden(bool value) { + _internal_set_expose_hidden(value); + // @@protoc_insertion_point(field_set:caffe.RecurrentParameter.expose_hidden) +} + +// ------------------------------------------------------------------- + +// ReductionParameter + +// optional .caffe.ReductionParameter.ReductionOp operation = 1 [default = SUM]; +inline bool ReductionParameter::_internal_has_operation() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ReductionParameter::has_operation() const { + return _internal_has_operation(); +} +inline void ReductionParameter::clear_operation() { + operation_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::ReductionParameter_ReductionOp ReductionParameter::_internal_operation() const { + return static_cast< ::caffe::ReductionParameter_ReductionOp >(operation_); +} +inline ::caffe::ReductionParameter_ReductionOp ReductionParameter::operation() const { + // @@protoc_insertion_point(field_get:caffe.ReductionParameter.operation) + return _internal_operation(); +} +inline void ReductionParameter::_internal_set_operation(::caffe::ReductionParameter_ReductionOp value) { + assert(::caffe::ReductionParameter_ReductionOp_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + operation_ = value; +} +inline void ReductionParameter::set_operation(::caffe::ReductionParameter_ReductionOp value) { + _internal_set_operation(value); + // @@protoc_insertion_point(field_set:caffe.ReductionParameter.operation) +} + +// optional int32 axis = 2 [default = 0]; +inline bool ReductionParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ReductionParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ReductionParameter::clear_axis() { + axis_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReductionParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReductionParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ReductionParameter.axis) + return _internal_axis(); +} +inline void ReductionParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + axis_ = value; +} +inline void ReductionParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ReductionParameter.axis) +} + +// optional float coeff = 3 [default = 1]; +inline bool ReductionParameter::_internal_has_coeff() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ReductionParameter::has_coeff() const { + return _internal_has_coeff(); +} +inline void ReductionParameter::clear_coeff() { + coeff_ = 1; + _has_bits_[0] &= ~0x00000004u; +} +inline float ReductionParameter::_internal_coeff() const { + return coeff_; +} +inline float ReductionParameter::coeff() const { + // @@protoc_insertion_point(field_get:caffe.ReductionParameter.coeff) + return _internal_coeff(); +} +inline void ReductionParameter::_internal_set_coeff(float value) { + _has_bits_[0] |= 0x00000004u; + coeff_ = value; +} +inline void ReductionParameter::set_coeff(float value) { + _internal_set_coeff(value); + // @@protoc_insertion_point(field_set:caffe.ReductionParameter.coeff) +} + +// ------------------------------------------------------------------- + +// ReLUParameter + +// optional float negative_slope = 1 [default = 0]; +inline bool ReLUParameter::_internal_has_negative_slope() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ReLUParameter::has_negative_slope() const { + return _internal_has_negative_slope(); +} +inline void ReLUParameter::clear_negative_slope() { + negative_slope_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float ReLUParameter::_internal_negative_slope() const { + return negative_slope_; +} +inline float ReLUParameter::negative_slope() const { + // @@protoc_insertion_point(field_get:caffe.ReLUParameter.negative_slope) + return _internal_negative_slope(); +} +inline void ReLUParameter::_internal_set_negative_slope(float value) { + _has_bits_[0] |= 0x00000001u; + negative_slope_ = value; +} +inline void ReLUParameter::set_negative_slope(float value) { + _internal_set_negative_slope(value); + // @@protoc_insertion_point(field_set:caffe.ReLUParameter.negative_slope) +} + +// optional .caffe.ReLUParameter.Engine engine = 2 [default = DEFAULT]; +inline bool ReLUParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ReLUParameter::has_engine() const { + return _internal_has_engine(); +} +inline void ReLUParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::ReLUParameter_Engine ReLUParameter::_internal_engine() const { + return static_cast< ::caffe::ReLUParameter_Engine >(engine_); +} +inline ::caffe::ReLUParameter_Engine ReLUParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.ReLUParameter.engine) + return _internal_engine(); +} +inline void ReLUParameter::_internal_set_engine(::caffe::ReLUParameter_Engine value) { + assert(::caffe::ReLUParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + engine_ = value; +} +inline void ReLUParameter::set_engine(::caffe::ReLUParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.ReLUParameter.engine) +} + +// ------------------------------------------------------------------- + +// ReshapeParameter + +// optional .caffe.BlobShape shape = 1; +inline bool ReshapeParameter::_internal_has_shape() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || shape_ != nullptr); + return value; +} +inline bool ReshapeParameter::has_shape() const { + return _internal_has_shape(); +} +inline void ReshapeParameter::clear_shape() { + if (shape_ != nullptr) shape_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::BlobShape& ReshapeParameter::_internal_shape() const { + const ::caffe::BlobShape* p = shape_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_BlobShape_default_instance_); +} +inline const ::caffe::BlobShape& ReshapeParameter::shape() const { + // @@protoc_insertion_point(field_get:caffe.ReshapeParameter.shape) + return _internal_shape(); +} +inline void ReshapeParameter::unsafe_arena_set_allocated_shape( + ::caffe::BlobShape* shape) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape_); + } + shape_ = shape; + if (shape) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ReshapeParameter.shape) +} +inline ::caffe::BlobShape* ReshapeParameter::release_shape() { + auto temp = unsafe_arena_release_shape(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::BlobShape* ReshapeParameter::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:caffe.ReshapeParameter.shape) + _has_bits_[0] &= ~0x00000001u; + ::caffe::BlobShape* temp = shape_; + shape_ = nullptr; + return temp; +} +inline ::caffe::BlobShape* ReshapeParameter::_internal_mutable_shape() { + _has_bits_[0] |= 0x00000001u; + if (shape_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::BlobShape>(GetArena()); + shape_ = p; + } + return shape_; +} +inline ::caffe::BlobShape* ReshapeParameter::mutable_shape() { + // @@protoc_insertion_point(field_mutable:caffe.ReshapeParameter.shape) + return _internal_mutable_shape(); +} +inline void ReshapeParameter::set_allocated_shape(::caffe::BlobShape* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete shape_; + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(shape); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:caffe.ReshapeParameter.shape) +} + +// optional int32 axis = 2 [default = 0]; +inline bool ReshapeParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ReshapeParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ReshapeParameter::clear_axis() { + axis_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReshapeParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReshapeParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ReshapeParameter.axis) + return _internal_axis(); +} +inline void ReshapeParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void ReshapeParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ReshapeParameter.axis) +} + +// optional int32 num_axes = 3 [default = -1]; +inline bool ReshapeParameter::_internal_has_num_axes() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ReshapeParameter::has_num_axes() const { + return _internal_has_num_axes(); +} +inline void ReshapeParameter::clear_num_axes() { + num_axes_ = -1; + _has_bits_[0] &= ~0x00000004u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReshapeParameter::_internal_num_axes() const { + return num_axes_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ReshapeParameter::num_axes() const { + // @@protoc_insertion_point(field_get:caffe.ReshapeParameter.num_axes) + return _internal_num_axes(); +} +inline void ReshapeParameter::_internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000004u; + num_axes_ = value; +} +inline void ReshapeParameter::set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_num_axes(value); + // @@protoc_insertion_point(field_set:caffe.ReshapeParameter.num_axes) +} + +// ------------------------------------------------------------------- + +// ScaleParameter + +// optional int32 axis = 1 [default = 1]; +inline bool ScaleParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ScaleParameter::has_axis() const { + return _internal_has_axis(); +} +inline void ScaleParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000008u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ScaleParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ScaleParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.ScaleParameter.axis) + return _internal_axis(); +} +inline void ScaleParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000008u; + axis_ = value; +} +inline void ScaleParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.ScaleParameter.axis) +} + +// optional int32 num_axes = 2 [default = 1]; +inline bool ScaleParameter::_internal_has_num_axes() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ScaleParameter::has_num_axes() const { + return _internal_has_num_axes(); +} +inline void ScaleParameter::clear_num_axes() { + num_axes_ = 1; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ScaleParameter::_internal_num_axes() const { + return num_axes_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 ScaleParameter::num_axes() const { + // @@protoc_insertion_point(field_get:caffe.ScaleParameter.num_axes) + return _internal_num_axes(); +} +inline void ScaleParameter::_internal_set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000010u; + num_axes_ = value; +} +inline void ScaleParameter::set_num_axes(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_num_axes(value); + // @@protoc_insertion_point(field_set:caffe.ScaleParameter.num_axes) +} + +// optional .caffe.FillerParameter filler = 3; +inline bool ScaleParameter::_internal_has_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || filler_ != nullptr); + return value; +} +inline bool ScaleParameter::has_filler() const { + return _internal_has_filler(); +} +inline void ScaleParameter::clear_filler() { + if (filler_ != nullptr) filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& ScaleParameter::_internal_filler() const { + const ::caffe::FillerParameter* p = filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& ScaleParameter::filler() const { + // @@protoc_insertion_point(field_get:caffe.ScaleParameter.filler) + return _internal_filler(); +} +inline void ScaleParameter::unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(filler_); + } + filler_ = filler; + if (filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ScaleParameter.filler) +} +inline ::caffe::FillerParameter* ScaleParameter::release_filler() { + auto temp = unsafe_arena_release_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* ScaleParameter::unsafe_arena_release_filler() { + // @@protoc_insertion_point(field_release:caffe.ScaleParameter.filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = filler_; + filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* ScaleParameter::_internal_mutable_filler() { + _has_bits_[0] |= 0x00000001u; + if (filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + filler_ = p; + } + return filler_; +} +inline ::caffe::FillerParameter* ScaleParameter::mutable_filler() { + // @@protoc_insertion_point(field_mutable:caffe.ScaleParameter.filler) + return _internal_mutable_filler(); +} +inline void ScaleParameter::set_allocated_filler(::caffe::FillerParameter* filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete filler_; + } + if (filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(filler); + if (message_arena != submessage_arena) { + filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + filler_ = filler; + // @@protoc_insertion_point(field_set_allocated:caffe.ScaleParameter.filler) +} + +// optional bool bias_term = 4 [default = false]; +inline bool ScaleParameter::_internal_has_bias_term() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ScaleParameter::has_bias_term() const { + return _internal_has_bias_term(); +} +inline void ScaleParameter::clear_bias_term() { + bias_term_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool ScaleParameter::_internal_bias_term() const { + return bias_term_; +} +inline bool ScaleParameter::bias_term() const { + // @@protoc_insertion_point(field_get:caffe.ScaleParameter.bias_term) + return _internal_bias_term(); +} +inline void ScaleParameter::_internal_set_bias_term(bool value) { + _has_bits_[0] |= 0x00000004u; + bias_term_ = value; +} +inline void ScaleParameter::set_bias_term(bool value) { + _internal_set_bias_term(value); + // @@protoc_insertion_point(field_set:caffe.ScaleParameter.bias_term) +} + +// optional .caffe.FillerParameter bias_filler = 5; +inline bool ScaleParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool ScaleParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void ScaleParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::FillerParameter& ScaleParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& ScaleParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.ScaleParameter.bias_filler) + return _internal_bias_filler(); +} +inline void ScaleParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.ScaleParameter.bias_filler) +} +inline ::caffe::FillerParameter* ScaleParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* ScaleParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.ScaleParameter.bias_filler) + _has_bits_[0] &= ~0x00000002u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* ScaleParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000002u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* ScaleParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.ScaleParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void ScaleParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.ScaleParameter.bias_filler) +} + +// ------------------------------------------------------------------- + +// SigmoidParameter + +// optional .caffe.SigmoidParameter.Engine engine = 1 [default = DEFAULT]; +inline bool SigmoidParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SigmoidParameter::has_engine() const { + return _internal_has_engine(); +} +inline void SigmoidParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::SigmoidParameter_Engine SigmoidParameter::_internal_engine() const { + return static_cast< ::caffe::SigmoidParameter_Engine >(engine_); +} +inline ::caffe::SigmoidParameter_Engine SigmoidParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.SigmoidParameter.engine) + return _internal_engine(); +} +inline void SigmoidParameter::_internal_set_engine(::caffe::SigmoidParameter_Engine value) { + assert(::caffe::SigmoidParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + engine_ = value; +} +inline void SigmoidParameter::set_engine(::caffe::SigmoidParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.SigmoidParameter.engine) +} + +// ------------------------------------------------------------------- + +// SliceParameter + +// optional int32 axis = 3 [default = 1]; +inline bool SliceParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SliceParameter::has_axis() const { + return _internal_has_axis(); +} +inline void SliceParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SliceParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SliceParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.SliceParameter.axis) + return _internal_axis(); +} +inline void SliceParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void SliceParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.SliceParameter.axis) +} + +// repeated uint32 slice_point = 2; +inline int SliceParameter::_internal_slice_point_size() const { + return slice_point_.size(); +} +inline int SliceParameter::slice_point_size() const { + return _internal_slice_point_size(); +} +inline void SliceParameter::clear_slice_point() { + slice_point_.Clear(); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SliceParameter::_internal_slice_point(int index) const { + return slice_point_.Get(index); +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SliceParameter::slice_point(int index) const { + // @@protoc_insertion_point(field_get:caffe.SliceParameter.slice_point) + return _internal_slice_point(index); +} +inline void SliceParameter::set_slice_point(int index, ::PROTOBUF_NAMESPACE_ID::uint32 value) { + slice_point_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.SliceParameter.slice_point) +} +inline void SliceParameter::_internal_add_slice_point(::PROTOBUF_NAMESPACE_ID::uint32 value) { + slice_point_.Add(value); +} +inline void SliceParameter::add_slice_point(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_add_slice_point(value); + // @@protoc_insertion_point(field_add:caffe.SliceParameter.slice_point) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +SliceParameter::_internal_slice_point() const { + return slice_point_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >& +SliceParameter::slice_point() const { + // @@protoc_insertion_point(field_list:caffe.SliceParameter.slice_point) + return _internal_slice_point(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +SliceParameter::_internal_mutable_slice_point() { + return &slice_point_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::uint32 >* +SliceParameter::mutable_slice_point() { + // @@protoc_insertion_point(field_mutable_list:caffe.SliceParameter.slice_point) + return _internal_mutable_slice_point(); +} + +// optional uint32 slice_dim = 1 [default = 1]; +inline bool SliceParameter::_internal_has_slice_dim() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SliceParameter::has_slice_dim() const { + return _internal_has_slice_dim(); +} +inline void SliceParameter::clear_slice_dim() { + slice_dim_ = 1u; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SliceParameter::_internal_slice_dim() const { + return slice_dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SliceParameter::slice_dim() const { + // @@protoc_insertion_point(field_get:caffe.SliceParameter.slice_dim) + return _internal_slice_dim(); +} +inline void SliceParameter::_internal_set_slice_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000001u; + slice_dim_ = value; +} +inline void SliceParameter::set_slice_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_slice_dim(value); + // @@protoc_insertion_point(field_set:caffe.SliceParameter.slice_dim) +} + +// ------------------------------------------------------------------- + +// SoftmaxParameter + +// optional .caffe.SoftmaxParameter.Engine engine = 1 [default = DEFAULT]; +inline bool SoftmaxParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SoftmaxParameter::has_engine() const { + return _internal_has_engine(); +} +inline void SoftmaxParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::SoftmaxParameter_Engine SoftmaxParameter::_internal_engine() const { + return static_cast< ::caffe::SoftmaxParameter_Engine >(engine_); +} +inline ::caffe::SoftmaxParameter_Engine SoftmaxParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.SoftmaxParameter.engine) + return _internal_engine(); +} +inline void SoftmaxParameter::_internal_set_engine(::caffe::SoftmaxParameter_Engine value) { + assert(::caffe::SoftmaxParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + engine_ = value; +} +inline void SoftmaxParameter::set_engine(::caffe::SoftmaxParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.SoftmaxParameter.engine) +} + +// optional int32 axis = 2 [default = 1]; +inline bool SoftmaxParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SoftmaxParameter::has_axis() const { + return _internal_has_axis(); +} +inline void SoftmaxParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SoftmaxParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 SoftmaxParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.SoftmaxParameter.axis) + return _internal_axis(); +} +inline void SoftmaxParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void SoftmaxParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.SoftmaxParameter.axis) +} + +// ------------------------------------------------------------------- + +// SwishParameter + +// optional float beta = 1 [default = 1]; +inline bool SwishParameter::_internal_has_beta() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SwishParameter::has_beta() const { + return _internal_has_beta(); +} +inline void SwishParameter::clear_beta() { + beta_ = 1; + _has_bits_[0] &= ~0x00000001u; +} +inline float SwishParameter::_internal_beta() const { + return beta_; +} +inline float SwishParameter::beta() const { + // @@protoc_insertion_point(field_get:caffe.SwishParameter.beta) + return _internal_beta(); +} +inline void SwishParameter::_internal_set_beta(float value) { + _has_bits_[0] |= 0x00000001u; + beta_ = value; +} +inline void SwishParameter::set_beta(float value) { + _internal_set_beta(value); + // @@protoc_insertion_point(field_set:caffe.SwishParameter.beta) +} + +// ------------------------------------------------------------------- + +// TanHParameter + +// optional .caffe.TanHParameter.Engine engine = 1 [default = DEFAULT]; +inline bool TanHParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool TanHParameter::has_engine() const { + return _internal_has_engine(); +} +inline void TanHParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::caffe::TanHParameter_Engine TanHParameter::_internal_engine() const { + return static_cast< ::caffe::TanHParameter_Engine >(engine_); +} +inline ::caffe::TanHParameter_Engine TanHParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.TanHParameter.engine) + return _internal_engine(); +} +inline void TanHParameter::_internal_set_engine(::caffe::TanHParameter_Engine value) { + assert(::caffe::TanHParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + engine_ = value; +} +inline void TanHParameter::set_engine(::caffe::TanHParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.TanHParameter.engine) +} + +// ------------------------------------------------------------------- + +// TileParameter + +// optional int32 axis = 1 [default = 1]; +inline bool TileParameter::_internal_has_axis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool TileParameter::has_axis() const { + return _internal_has_axis(); +} +inline void TileParameter::clear_axis() { + axis_ = 1; + _has_bits_[0] &= ~0x00000002u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 TileParameter::_internal_axis() const { + return axis_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 TileParameter::axis() const { + // @@protoc_insertion_point(field_get:caffe.TileParameter.axis) + return _internal_axis(); +} +inline void TileParameter::_internal_set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000002u; + axis_ = value; +} +inline void TileParameter::set_axis(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_axis(value); + // @@protoc_insertion_point(field_set:caffe.TileParameter.axis) +} + +// optional int32 tiles = 2; +inline bool TileParameter::_internal_has_tiles() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool TileParameter::has_tiles() const { + return _internal_has_tiles(); +} +inline void TileParameter::clear_tiles() { + tiles_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 TileParameter::_internal_tiles() const { + return tiles_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 TileParameter::tiles() const { + // @@protoc_insertion_point(field_get:caffe.TileParameter.tiles) + return _internal_tiles(); +} +inline void TileParameter::_internal_set_tiles(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00000001u; + tiles_ = value; +} +inline void TileParameter::set_tiles(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_tiles(value); + // @@protoc_insertion_point(field_set:caffe.TileParameter.tiles) +} + +// ------------------------------------------------------------------- + +// ThresholdParameter + +// optional float threshold = 1 [default = 0]; +inline bool ThresholdParameter::_internal_has_threshold() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ThresholdParameter::has_threshold() const { + return _internal_has_threshold(); +} +inline void ThresholdParameter::clear_threshold() { + threshold_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline float ThresholdParameter::_internal_threshold() const { + return threshold_; +} +inline float ThresholdParameter::threshold() const { + // @@protoc_insertion_point(field_get:caffe.ThresholdParameter.threshold) + return _internal_threshold(); +} +inline void ThresholdParameter::_internal_set_threshold(float value) { + _has_bits_[0] |= 0x00000001u; + threshold_ = value; +} +inline void ThresholdParameter::set_threshold(float value) { + _internal_set_threshold(value); + // @@protoc_insertion_point(field_set:caffe.ThresholdParameter.threshold) +} + +// ------------------------------------------------------------------- + +// WindowDataParameter + +// optional string source = 1; +inline bool WindowDataParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool WindowDataParameter::has_source() const { + return _internal_has_source(); +} +inline void WindowDataParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& WindowDataParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.source) + return _internal_source(); +} +inline void WindowDataParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.source) +} +inline std::string* WindowDataParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.WindowDataParameter.source) + return _internal_mutable_source(); +} +inline const std::string& WindowDataParameter::_internal_source() const { + return source_.Get(); +} +inline void WindowDataParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void WindowDataParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.WindowDataParameter.source) +} +inline void WindowDataParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.WindowDataParameter.source) +} +inline void WindowDataParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.WindowDataParameter.source) +} +inline std::string* WindowDataParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000001u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* WindowDataParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.WindowDataParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void WindowDataParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.WindowDataParameter.source) +} +inline std::string* WindowDataParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.WindowDataParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void WindowDataParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.WindowDataParameter.source) +} + +// optional float scale = 2 [default = 1]; +inline bool WindowDataParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool WindowDataParameter::has_scale() const { + return _internal_has_scale(); +} +inline void WindowDataParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x00000200u; +} +inline float WindowDataParameter::_internal_scale() const { + return scale_; +} +inline float WindowDataParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.scale) + return _internal_scale(); +} +inline void WindowDataParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x00000200u; + scale_ = value; +} +inline void WindowDataParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.scale) +} + +// optional string mean_file = 3; +inline bool WindowDataParameter::_internal_has_mean_file() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool WindowDataParameter::has_mean_file() const { + return _internal_has_mean_file(); +} +inline void WindowDataParameter::clear_mean_file() { + mean_file_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& WindowDataParameter::mean_file() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.mean_file) + return _internal_mean_file(); +} +inline void WindowDataParameter::set_mean_file(const std::string& value) { + _internal_set_mean_file(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.mean_file) +} +inline std::string* WindowDataParameter::mutable_mean_file() { + // @@protoc_insertion_point(field_mutable:caffe.WindowDataParameter.mean_file) + return _internal_mutable_mean_file(); +} +inline const std::string& WindowDataParameter::_internal_mean_file() const { + return mean_file_.Get(); +} +inline void WindowDataParameter::_internal_set_mean_file(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void WindowDataParameter::set_mean_file(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.WindowDataParameter.mean_file) +} +inline void WindowDataParameter::set_mean_file(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.WindowDataParameter.mean_file) +} +inline void WindowDataParameter::set_mean_file(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + mean_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.WindowDataParameter.mean_file) +} +inline std::string* WindowDataParameter::_internal_mutable_mean_file() { + _has_bits_[0] |= 0x00000002u; + return mean_file_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* WindowDataParameter::release_mean_file() { + // @@protoc_insertion_point(field_release:caffe.WindowDataParameter.mean_file) + if (!_internal_has_mean_file()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return mean_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void WindowDataParameter::set_allocated_mean_file(std::string* mean_file) { + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), mean_file, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.WindowDataParameter.mean_file) +} +inline std::string* WindowDataParameter::unsafe_arena_release_mean_file() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.WindowDataParameter.mean_file) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return mean_file_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void WindowDataParameter::unsafe_arena_set_allocated_mean_file( + std::string* mean_file) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (mean_file != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + mean_file_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + mean_file, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.WindowDataParameter.mean_file) +} + +// optional uint32 batch_size = 4; +inline bool WindowDataParameter::_internal_has_batch_size() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool WindowDataParameter::has_batch_size() const { + return _internal_has_batch_size(); +} +inline void WindowDataParameter::clear_batch_size() { + batch_size_ = 0u; + _has_bits_[0] &= ~0x00000010u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::_internal_batch_size() const { + return batch_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::batch_size() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.batch_size) + return _internal_batch_size(); +} +inline void WindowDataParameter::_internal_set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000010u; + batch_size_ = value; +} +inline void WindowDataParameter::set_batch_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batch_size(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.batch_size) +} + +// optional uint32 crop_size = 5 [default = 0]; +inline bool WindowDataParameter::_internal_has_crop_size() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool WindowDataParameter::has_crop_size() const { + return _internal_has_crop_size(); +} +inline void WindowDataParameter::clear_crop_size() { + crop_size_ = 0u; + _has_bits_[0] &= ~0x00000020u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::_internal_crop_size() const { + return crop_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::crop_size() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.crop_size) + return _internal_crop_size(); +} +inline void WindowDataParameter::_internal_set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000020u; + crop_size_ = value; +} +inline void WindowDataParameter::set_crop_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_crop_size(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.crop_size) +} + +// optional bool mirror = 6 [default = false]; +inline bool WindowDataParameter::_internal_has_mirror() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool WindowDataParameter::has_mirror() const { + return _internal_has_mirror(); +} +inline void WindowDataParameter::clear_mirror() { + mirror_ = false; + _has_bits_[0] &= ~0x00000040u; +} +inline bool WindowDataParameter::_internal_mirror() const { + return mirror_; +} +inline bool WindowDataParameter::mirror() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.mirror) + return _internal_mirror(); +} +inline void WindowDataParameter::_internal_set_mirror(bool value) { + _has_bits_[0] |= 0x00000040u; + mirror_ = value; +} +inline void WindowDataParameter::set_mirror(bool value) { + _internal_set_mirror(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.mirror) +} + +// optional float fg_threshold = 7 [default = 0.5]; +inline bool WindowDataParameter::_internal_has_fg_threshold() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool WindowDataParameter::has_fg_threshold() const { + return _internal_has_fg_threshold(); +} +inline void WindowDataParameter::clear_fg_threshold() { + fg_threshold_ = 0.5f; + _has_bits_[0] &= ~0x00000400u; +} +inline float WindowDataParameter::_internal_fg_threshold() const { + return fg_threshold_; +} +inline float WindowDataParameter::fg_threshold() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.fg_threshold) + return _internal_fg_threshold(); +} +inline void WindowDataParameter::_internal_set_fg_threshold(float value) { + _has_bits_[0] |= 0x00000400u; + fg_threshold_ = value; +} +inline void WindowDataParameter::set_fg_threshold(float value) { + _internal_set_fg_threshold(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.fg_threshold) +} + +// optional float bg_threshold = 8 [default = 0.5]; +inline bool WindowDataParameter::_internal_has_bg_threshold() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool WindowDataParameter::has_bg_threshold() const { + return _internal_has_bg_threshold(); +} +inline void WindowDataParameter::clear_bg_threshold() { + bg_threshold_ = 0.5f; + _has_bits_[0] &= ~0x00000800u; +} +inline float WindowDataParameter::_internal_bg_threshold() const { + return bg_threshold_; +} +inline float WindowDataParameter::bg_threshold() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.bg_threshold) + return _internal_bg_threshold(); +} +inline void WindowDataParameter::_internal_set_bg_threshold(float value) { + _has_bits_[0] |= 0x00000800u; + bg_threshold_ = value; +} +inline void WindowDataParameter::set_bg_threshold(float value) { + _internal_set_bg_threshold(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.bg_threshold) +} + +// optional float fg_fraction = 9 [default = 0.25]; +inline bool WindowDataParameter::_internal_has_fg_fraction() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool WindowDataParameter::has_fg_fraction() const { + return _internal_has_fg_fraction(); +} +inline void WindowDataParameter::clear_fg_fraction() { + fg_fraction_ = 0.25f; + _has_bits_[0] &= ~0x00001000u; +} +inline float WindowDataParameter::_internal_fg_fraction() const { + return fg_fraction_; +} +inline float WindowDataParameter::fg_fraction() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.fg_fraction) + return _internal_fg_fraction(); +} +inline void WindowDataParameter::_internal_set_fg_fraction(float value) { + _has_bits_[0] |= 0x00001000u; + fg_fraction_ = value; +} +inline void WindowDataParameter::set_fg_fraction(float value) { + _internal_set_fg_fraction(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.fg_fraction) +} + +// optional uint32 context_pad = 10 [default = 0]; +inline bool WindowDataParameter::_internal_has_context_pad() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool WindowDataParameter::has_context_pad() const { + return _internal_has_context_pad(); +} +inline void WindowDataParameter::clear_context_pad() { + context_pad_ = 0u; + _has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::_internal_context_pad() const { + return context_pad_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 WindowDataParameter::context_pad() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.context_pad) + return _internal_context_pad(); +} +inline void WindowDataParameter::_internal_set_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000100u; + context_pad_ = value; +} +inline void WindowDataParameter::set_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_context_pad(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.context_pad) +} + +// optional string crop_mode = 11 [default = "warp"]; +inline bool WindowDataParameter::_internal_has_crop_mode() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool WindowDataParameter::has_crop_mode() const { + return _internal_has_crop_mode(); +} +inline void WindowDataParameter::clear_crop_mode() { + crop_mode_.ClearToDefault(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), GetArena()); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& WindowDataParameter::crop_mode() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.crop_mode) + return _internal_crop_mode(); +} +inline void WindowDataParameter::set_crop_mode(const std::string& value) { + _internal_set_crop_mode(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.crop_mode) +} +inline std::string* WindowDataParameter::mutable_crop_mode() { + // @@protoc_insertion_point(field_mutable:caffe.WindowDataParameter.crop_mode) + return _internal_mutable_crop_mode(); +} +inline const std::string& WindowDataParameter::_internal_crop_mode() const { + return crop_mode_.Get(); +} +inline void WindowDataParameter::_internal_set_crop_mode(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + crop_mode_.Set(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), value, GetArena()); +} +inline void WindowDataParameter::set_crop_mode(std::string&& value) { + _has_bits_[0] |= 0x00000004u; + crop_mode_.Set( + &::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.WindowDataParameter.crop_mode) +} +inline void WindowDataParameter::set_crop_mode(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000004u; + crop_mode_.Set(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.WindowDataParameter.crop_mode) +} +inline void WindowDataParameter::set_crop_mode(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000004u; + crop_mode_.Set(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.WindowDataParameter.crop_mode) +} +inline std::string* WindowDataParameter::_internal_mutable_crop_mode() { + _has_bits_[0] |= 0x00000004u; + return crop_mode_.Mutable(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), GetArena()); +} +inline std::string* WindowDataParameter::release_crop_mode() { + // @@protoc_insertion_point(field_release:caffe.WindowDataParameter.crop_mode) + if (!_internal_has_crop_mode()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + return crop_mode_.ReleaseNonDefault(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), GetArena()); +} +inline void WindowDataParameter::set_allocated_crop_mode(std::string* crop_mode) { + if (crop_mode != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + crop_mode_.SetAllocated(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), crop_mode, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.WindowDataParameter.crop_mode) +} +inline std::string* WindowDataParameter::unsafe_arena_release_crop_mode() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.WindowDataParameter.crop_mode) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000004u; + return crop_mode_.UnsafeArenaRelease(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), + GetArena()); +} +inline void WindowDataParameter::unsafe_arena_set_allocated_crop_mode( + std::string* crop_mode) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (crop_mode != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + crop_mode_.UnsafeArenaSetAllocated(&::caffe::WindowDataParameter::_i_give_permission_to_break_this_code_default_crop_mode_.get(), + crop_mode, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.WindowDataParameter.crop_mode) +} + +// optional bool cache_images = 12 [default = false]; +inline bool WindowDataParameter::_internal_has_cache_images() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool WindowDataParameter::has_cache_images() const { + return _internal_has_cache_images(); +} +inline void WindowDataParameter::clear_cache_images() { + cache_images_ = false; + _has_bits_[0] &= ~0x00000080u; +} +inline bool WindowDataParameter::_internal_cache_images() const { + return cache_images_; +} +inline bool WindowDataParameter::cache_images() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.cache_images) + return _internal_cache_images(); +} +inline void WindowDataParameter::_internal_set_cache_images(bool value) { + _has_bits_[0] |= 0x00000080u; + cache_images_ = value; +} +inline void WindowDataParameter::set_cache_images(bool value) { + _internal_set_cache_images(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.cache_images) +} + +// optional string root_folder = 13 [default = ""]; +inline bool WindowDataParameter::_internal_has_root_folder() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool WindowDataParameter::has_root_folder() const { + return _internal_has_root_folder(); +} +inline void WindowDataParameter::clear_root_folder() { + root_folder_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000008u; +} +inline const std::string& WindowDataParameter::root_folder() const { + // @@protoc_insertion_point(field_get:caffe.WindowDataParameter.root_folder) + return _internal_root_folder(); +} +inline void WindowDataParameter::set_root_folder(const std::string& value) { + _internal_set_root_folder(value); + // @@protoc_insertion_point(field_set:caffe.WindowDataParameter.root_folder) +} +inline std::string* WindowDataParameter::mutable_root_folder() { + // @@protoc_insertion_point(field_mutable:caffe.WindowDataParameter.root_folder) + return _internal_mutable_root_folder(); +} +inline const std::string& WindowDataParameter::_internal_root_folder() const { + return root_folder_.Get(); +} +inline void WindowDataParameter::_internal_set_root_folder(const std::string& value) { + _has_bits_[0] |= 0x00000008u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void WindowDataParameter::set_root_folder(std::string&& value) { + _has_bits_[0] |= 0x00000008u; + root_folder_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.WindowDataParameter.root_folder) +} +inline void WindowDataParameter::set_root_folder(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000008u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.WindowDataParameter.root_folder) +} +inline void WindowDataParameter::set_root_folder(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000008u; + root_folder_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.WindowDataParameter.root_folder) +} +inline std::string* WindowDataParameter::_internal_mutable_root_folder() { + _has_bits_[0] |= 0x00000008u; + return root_folder_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* WindowDataParameter::release_root_folder() { + // @@protoc_insertion_point(field_release:caffe.WindowDataParameter.root_folder) + if (!_internal_has_root_folder()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000008u; + return root_folder_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void WindowDataParameter::set_allocated_root_folder(std::string* root_folder) { + if (root_folder != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + root_folder_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root_folder, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.WindowDataParameter.root_folder) +} +inline std::string* WindowDataParameter::unsafe_arena_release_root_folder() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.WindowDataParameter.root_folder) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000008u; + return root_folder_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void WindowDataParameter::unsafe_arena_set_allocated_root_folder( + std::string* root_folder) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (root_folder != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + root_folder_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + root_folder, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.WindowDataParameter.root_folder) +} + +// ------------------------------------------------------------------- + +// SPPParameter + +// optional uint32 pyramid_height = 1; +inline bool SPPParameter::_internal_has_pyramid_height() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SPPParameter::has_pyramid_height() const { + return _internal_has_pyramid_height(); +} +inline void SPPParameter::clear_pyramid_height() { + pyramid_height_ = 0u; + _has_bits_[0] &= ~0x00000001u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SPPParameter::_internal_pyramid_height() const { + return pyramid_height_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 SPPParameter::pyramid_height() const { + // @@protoc_insertion_point(field_get:caffe.SPPParameter.pyramid_height) + return _internal_pyramid_height(); +} +inline void SPPParameter::_internal_set_pyramid_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000001u; + pyramid_height_ = value; +} +inline void SPPParameter::set_pyramid_height(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pyramid_height(value); + // @@protoc_insertion_point(field_set:caffe.SPPParameter.pyramid_height) +} + +// optional .caffe.SPPParameter.PoolMethod pool = 2 [default = MAX]; +inline bool SPPParameter::_internal_has_pool() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SPPParameter::has_pool() const { + return _internal_has_pool(); +} +inline void SPPParameter::clear_pool() { + pool_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::caffe::SPPParameter_PoolMethod SPPParameter::_internal_pool() const { + return static_cast< ::caffe::SPPParameter_PoolMethod >(pool_); +} +inline ::caffe::SPPParameter_PoolMethod SPPParameter::pool() const { + // @@protoc_insertion_point(field_get:caffe.SPPParameter.pool) + return _internal_pool(); +} +inline void SPPParameter::_internal_set_pool(::caffe::SPPParameter_PoolMethod value) { + assert(::caffe::SPPParameter_PoolMethod_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + pool_ = value; +} +inline void SPPParameter::set_pool(::caffe::SPPParameter_PoolMethod value) { + _internal_set_pool(value); + // @@protoc_insertion_point(field_set:caffe.SPPParameter.pool) +} + +// optional .caffe.SPPParameter.Engine engine = 6 [default = DEFAULT]; +inline bool SPPParameter::_internal_has_engine() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SPPParameter::has_engine() const { + return _internal_has_engine(); +} +inline void SPPParameter::clear_engine() { + engine_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::caffe::SPPParameter_Engine SPPParameter::_internal_engine() const { + return static_cast< ::caffe::SPPParameter_Engine >(engine_); +} +inline ::caffe::SPPParameter_Engine SPPParameter::engine() const { + // @@protoc_insertion_point(field_get:caffe.SPPParameter.engine) + return _internal_engine(); +} +inline void SPPParameter::_internal_set_engine(::caffe::SPPParameter_Engine value) { + assert(::caffe::SPPParameter_Engine_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + engine_ = value; +} +inline void SPPParameter::set_engine(::caffe::SPPParameter_Engine value) { + _internal_set_engine(value); + // @@protoc_insertion_point(field_set:caffe.SPPParameter.engine) +} + +// ------------------------------------------------------------------- + +// V1LayerParameter + +// repeated string bottom = 2; +inline int V1LayerParameter::_internal_bottom_size() const { + return bottom_.size(); +} +inline int V1LayerParameter::bottom_size() const { + return _internal_bottom_size(); +} +inline void V1LayerParameter::clear_bottom() { + bottom_.Clear(); +} +inline std::string* V1LayerParameter::add_bottom() { + // @@protoc_insertion_point(field_add_mutable:caffe.V1LayerParameter.bottom) + return _internal_add_bottom(); +} +inline const std::string& V1LayerParameter::_internal_bottom(int index) const { + return bottom_.Get(index); +} +inline const std::string& V1LayerParameter::bottom(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.bottom) + return _internal_bottom(index); +} +inline std::string* V1LayerParameter::mutable_bottom(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.bottom) + return bottom_.Mutable(index); +} +inline void V1LayerParameter::set_bottom(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.bottom) + bottom_.Mutable(index)->assign(value); +} +inline void V1LayerParameter::set_bottom(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.bottom) + bottom_.Mutable(index)->assign(std::move(value)); +} +inline void V1LayerParameter::set_bottom(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + bottom_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.V1LayerParameter.bottom) +} +inline void V1LayerParameter::set_bottom(int index, const char* value, size_t size) { + bottom_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.V1LayerParameter.bottom) +} +inline std::string* V1LayerParameter::_internal_add_bottom() { + return bottom_.Add(); +} +inline void V1LayerParameter::add_bottom(const std::string& value) { + bottom_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.bottom) +} +inline void V1LayerParameter::add_bottom(std::string&& value) { + bottom_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.bottom) +} +inline void V1LayerParameter::add_bottom(const char* value) { + GOOGLE_DCHECK(value != nullptr); + bottom_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.V1LayerParameter.bottom) +} +inline void V1LayerParameter::add_bottom(const char* value, size_t size) { + bottom_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.V1LayerParameter.bottom) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +V1LayerParameter::bottom() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.bottom) + return bottom_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +V1LayerParameter::mutable_bottom() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.bottom) + return &bottom_; +} + +// repeated string top = 3; +inline int V1LayerParameter::_internal_top_size() const { + return top_.size(); +} +inline int V1LayerParameter::top_size() const { + return _internal_top_size(); +} +inline void V1LayerParameter::clear_top() { + top_.Clear(); +} +inline std::string* V1LayerParameter::add_top() { + // @@protoc_insertion_point(field_add_mutable:caffe.V1LayerParameter.top) + return _internal_add_top(); +} +inline const std::string& V1LayerParameter::_internal_top(int index) const { + return top_.Get(index); +} +inline const std::string& V1LayerParameter::top(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.top) + return _internal_top(index); +} +inline std::string* V1LayerParameter::mutable_top(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.top) + return top_.Mutable(index); +} +inline void V1LayerParameter::set_top(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.top) + top_.Mutable(index)->assign(value); +} +inline void V1LayerParameter::set_top(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.top) + top_.Mutable(index)->assign(std::move(value)); +} +inline void V1LayerParameter::set_top(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + top_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.V1LayerParameter.top) +} +inline void V1LayerParameter::set_top(int index, const char* value, size_t size) { + top_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.V1LayerParameter.top) +} +inline std::string* V1LayerParameter::_internal_add_top() { + return top_.Add(); +} +inline void V1LayerParameter::add_top(const std::string& value) { + top_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.top) +} +inline void V1LayerParameter::add_top(std::string&& value) { + top_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.top) +} +inline void V1LayerParameter::add_top(const char* value) { + GOOGLE_DCHECK(value != nullptr); + top_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.V1LayerParameter.top) +} +inline void V1LayerParameter::add_top(const char* value, size_t size) { + top_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.V1LayerParameter.top) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +V1LayerParameter::top() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.top) + return top_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +V1LayerParameter::mutable_top() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.top) + return &top_; +} + +// optional string name = 4; +inline bool V1LayerParameter::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool V1LayerParameter::has_name() const { + return _internal_has_name(); +} +inline void V1LayerParameter::clear_name() { + name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& V1LayerParameter::name() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.name) + return _internal_name(); +} +inline void V1LayerParameter::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.name) +} +inline std::string* V1LayerParameter::mutable_name() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.name) + return _internal_mutable_name(); +} +inline const std::string& V1LayerParameter::_internal_name() const { + return name_.Get(); +} +inline void V1LayerParameter::_internal_set_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void V1LayerParameter::set_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V1LayerParameter.name) +} +inline void V1LayerParameter::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V1LayerParameter.name) +} +inline void V1LayerParameter::set_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V1LayerParameter.name) +} +inline std::string* V1LayerParameter::_internal_mutable_name() { + _has_bits_[0] |= 0x00000001u; + return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* V1LayerParameter::release_name() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.name) + if (!_internal_has_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void V1LayerParameter::set_allocated_name(std::string* name) { + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.name) +} +inline std::string* V1LayerParameter::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V1LayerParameter.name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_name( + std::string* name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.name) +} + +// repeated .caffe.NetStateRule include = 32; +inline int V1LayerParameter::_internal_include_size() const { + return include_.size(); +} +inline int V1LayerParameter::include_size() const { + return _internal_include_size(); +} +inline void V1LayerParameter::clear_include() { + include_.Clear(); +} +inline ::caffe::NetStateRule* V1LayerParameter::mutable_include(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.include) + return include_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* +V1LayerParameter::mutable_include() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.include) + return &include_; +} +inline const ::caffe::NetStateRule& V1LayerParameter::_internal_include(int index) const { + return include_.Get(index); +} +inline const ::caffe::NetStateRule& V1LayerParameter::include(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.include) + return _internal_include(index); +} +inline ::caffe::NetStateRule* V1LayerParameter::_internal_add_include() { + return include_.Add(); +} +inline ::caffe::NetStateRule* V1LayerParameter::add_include() { + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.include) + return _internal_add_include(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& +V1LayerParameter::include() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.include) + return include_; +} + +// repeated .caffe.NetStateRule exclude = 33; +inline int V1LayerParameter::_internal_exclude_size() const { + return exclude_.size(); +} +inline int V1LayerParameter::exclude_size() const { + return _internal_exclude_size(); +} +inline void V1LayerParameter::clear_exclude() { + exclude_.Clear(); +} +inline ::caffe::NetStateRule* V1LayerParameter::mutable_exclude(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.exclude) + return exclude_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >* +V1LayerParameter::mutable_exclude() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.exclude) + return &exclude_; +} +inline const ::caffe::NetStateRule& V1LayerParameter::_internal_exclude(int index) const { + return exclude_.Get(index); +} +inline const ::caffe::NetStateRule& V1LayerParameter::exclude(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.exclude) + return _internal_exclude(index); +} +inline ::caffe::NetStateRule* V1LayerParameter::_internal_add_exclude() { + return exclude_.Add(); +} +inline ::caffe::NetStateRule* V1LayerParameter::add_exclude() { + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.exclude) + return _internal_add_exclude(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::NetStateRule >& +V1LayerParameter::exclude() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.exclude) + return exclude_; +} + +// optional .caffe.V1LayerParameter.LayerType type = 5; +inline bool V1LayerParameter::_internal_has_type() const { + bool value = (_has_bits_[1] & 0x00000001u) != 0; + return value; +} +inline bool V1LayerParameter::has_type() const { + return _internal_has_type(); +} +inline void V1LayerParameter::clear_type() { + type_ = 0; + _has_bits_[1] &= ~0x00000001u; +} +inline ::caffe::V1LayerParameter_LayerType V1LayerParameter::_internal_type() const { + return static_cast< ::caffe::V1LayerParameter_LayerType >(type_); +} +inline ::caffe::V1LayerParameter_LayerType V1LayerParameter::type() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.type) + return _internal_type(); +} +inline void V1LayerParameter::_internal_set_type(::caffe::V1LayerParameter_LayerType value) { + assert(::caffe::V1LayerParameter_LayerType_IsValid(value)); + _has_bits_[1] |= 0x00000001u; + type_ = value; +} +inline void V1LayerParameter::set_type(::caffe::V1LayerParameter_LayerType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.type) +} + +// repeated .caffe.BlobProto blobs = 6; +inline int V1LayerParameter::_internal_blobs_size() const { + return blobs_.size(); +} +inline int V1LayerParameter::blobs_size() const { + return _internal_blobs_size(); +} +inline void V1LayerParameter::clear_blobs() { + blobs_.Clear(); +} +inline ::caffe::BlobProto* V1LayerParameter::mutable_blobs(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.blobs) + return blobs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* +V1LayerParameter::mutable_blobs() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.blobs) + return &blobs_; +} +inline const ::caffe::BlobProto& V1LayerParameter::_internal_blobs(int index) const { + return blobs_.Get(index); +} +inline const ::caffe::BlobProto& V1LayerParameter::blobs(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.blobs) + return _internal_blobs(index); +} +inline ::caffe::BlobProto* V1LayerParameter::_internal_add_blobs() { + return blobs_.Add(); +} +inline ::caffe::BlobProto* V1LayerParameter::add_blobs() { + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.blobs) + return _internal_add_blobs(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& +V1LayerParameter::blobs() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.blobs) + return blobs_; +} + +// repeated string param = 1001; +inline int V1LayerParameter::_internal_param_size() const { + return param_.size(); +} +inline int V1LayerParameter::param_size() const { + return _internal_param_size(); +} +inline void V1LayerParameter::clear_param() { + param_.Clear(); +} +inline std::string* V1LayerParameter::add_param() { + // @@protoc_insertion_point(field_add_mutable:caffe.V1LayerParameter.param) + return _internal_add_param(); +} +inline const std::string& V1LayerParameter::_internal_param(int index) const { + return param_.Get(index); +} +inline const std::string& V1LayerParameter::param(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.param) + return _internal_param(index); +} +inline std::string* V1LayerParameter::mutable_param(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.param) + return param_.Mutable(index); +} +inline void V1LayerParameter::set_param(int index, const std::string& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.param) + param_.Mutable(index)->assign(value); +} +inline void V1LayerParameter::set_param(int index, std::string&& value) { + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.param) + param_.Mutable(index)->assign(std::move(value)); +} +inline void V1LayerParameter::set_param(int index, const char* value) { + GOOGLE_DCHECK(value != nullptr); + param_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:caffe.V1LayerParameter.param) +} +inline void V1LayerParameter::set_param(int index, const char* value, size_t size) { + param_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:caffe.V1LayerParameter.param) +} +inline std::string* V1LayerParameter::_internal_add_param() { + return param_.Add(); +} +inline void V1LayerParameter::add_param(const std::string& value) { + param_.Add()->assign(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.param) +} +inline void V1LayerParameter::add_param(std::string&& value) { + param_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.param) +} +inline void V1LayerParameter::add_param(const char* value) { + GOOGLE_DCHECK(value != nullptr); + param_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:caffe.V1LayerParameter.param) +} +inline void V1LayerParameter::add_param(const char* value, size_t size) { + param_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:caffe.V1LayerParameter.param) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField& +V1LayerParameter::param() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.param) + return param_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField* +V1LayerParameter::mutable_param() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.param) + return ¶m_; +} + +// repeated .caffe.V1LayerParameter.DimCheckMode blob_share_mode = 1002; +inline int V1LayerParameter::_internal_blob_share_mode_size() const { + return blob_share_mode_.size(); +} +inline int V1LayerParameter::blob_share_mode_size() const { + return _internal_blob_share_mode_size(); +} +inline void V1LayerParameter::clear_blob_share_mode() { + blob_share_mode_.Clear(); +} +inline ::caffe::V1LayerParameter_DimCheckMode V1LayerParameter::_internal_blob_share_mode(int index) const { + return static_cast< ::caffe::V1LayerParameter_DimCheckMode >(blob_share_mode_.Get(index)); +} +inline ::caffe::V1LayerParameter_DimCheckMode V1LayerParameter::blob_share_mode(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.blob_share_mode) + return _internal_blob_share_mode(index); +} +inline void V1LayerParameter::set_blob_share_mode(int index, ::caffe::V1LayerParameter_DimCheckMode value) { + assert(::caffe::V1LayerParameter_DimCheckMode_IsValid(value)); + blob_share_mode_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.blob_share_mode) +} +inline void V1LayerParameter::_internal_add_blob_share_mode(::caffe::V1LayerParameter_DimCheckMode value) { + assert(::caffe::V1LayerParameter_DimCheckMode_IsValid(value)); + blob_share_mode_.Add(value); +} +inline void V1LayerParameter::add_blob_share_mode(::caffe::V1LayerParameter_DimCheckMode value) { + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.blob_share_mode) + _internal_add_blob_share_mode(value); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +V1LayerParameter::blob_share_mode() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.blob_share_mode) + return blob_share_mode_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +V1LayerParameter::_internal_mutable_blob_share_mode() { + return &blob_share_mode_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +V1LayerParameter::mutable_blob_share_mode() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.blob_share_mode) + return _internal_mutable_blob_share_mode(); +} + +// repeated float blobs_lr = 7; +inline int V1LayerParameter::_internal_blobs_lr_size() const { + return blobs_lr_.size(); +} +inline int V1LayerParameter::blobs_lr_size() const { + return _internal_blobs_lr_size(); +} +inline void V1LayerParameter::clear_blobs_lr() { + blobs_lr_.Clear(); +} +inline float V1LayerParameter::_internal_blobs_lr(int index) const { + return blobs_lr_.Get(index); +} +inline float V1LayerParameter::blobs_lr(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.blobs_lr) + return _internal_blobs_lr(index); +} +inline void V1LayerParameter::set_blobs_lr(int index, float value) { + blobs_lr_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.blobs_lr) +} +inline void V1LayerParameter::_internal_add_blobs_lr(float value) { + blobs_lr_.Add(value); +} +inline void V1LayerParameter::add_blobs_lr(float value) { + _internal_add_blobs_lr(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.blobs_lr) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::_internal_blobs_lr() const { + return blobs_lr_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::blobs_lr() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.blobs_lr) + return _internal_blobs_lr(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::_internal_mutable_blobs_lr() { + return &blobs_lr_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::mutable_blobs_lr() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.blobs_lr) + return _internal_mutable_blobs_lr(); +} + +// repeated float weight_decay = 8; +inline int V1LayerParameter::_internal_weight_decay_size() const { + return weight_decay_.size(); +} +inline int V1LayerParameter::weight_decay_size() const { + return _internal_weight_decay_size(); +} +inline void V1LayerParameter::clear_weight_decay() { + weight_decay_.Clear(); +} +inline float V1LayerParameter::_internal_weight_decay(int index) const { + return weight_decay_.Get(index); +} +inline float V1LayerParameter::weight_decay(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.weight_decay) + return _internal_weight_decay(index); +} +inline void V1LayerParameter::set_weight_decay(int index, float value) { + weight_decay_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.weight_decay) +} +inline void V1LayerParameter::_internal_add_weight_decay(float value) { + weight_decay_.Add(value); +} +inline void V1LayerParameter::add_weight_decay(float value) { + _internal_add_weight_decay(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.weight_decay) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::_internal_weight_decay() const { + return weight_decay_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::weight_decay() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.weight_decay) + return _internal_weight_decay(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::_internal_mutable_weight_decay() { + return &weight_decay_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::mutable_weight_decay() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.weight_decay) + return _internal_mutable_weight_decay(); +} + +// repeated float loss_weight = 35; +inline int V1LayerParameter::_internal_loss_weight_size() const { + return loss_weight_.size(); +} +inline int V1LayerParameter::loss_weight_size() const { + return _internal_loss_weight_size(); +} +inline void V1LayerParameter::clear_loss_weight() { + loss_weight_.Clear(); +} +inline float V1LayerParameter::_internal_loss_weight(int index) const { + return loss_weight_.Get(index); +} +inline float V1LayerParameter::loss_weight(int index) const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.loss_weight) + return _internal_loss_weight(index); +} +inline void V1LayerParameter::set_loss_weight(int index, float value) { + loss_weight_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V1LayerParameter.loss_weight) +} +inline void V1LayerParameter::_internal_add_loss_weight(float value) { + loss_weight_.Add(value); +} +inline void V1LayerParameter::add_loss_weight(float value) { + _internal_add_loss_weight(value); + // @@protoc_insertion_point(field_add:caffe.V1LayerParameter.loss_weight) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::_internal_loss_weight() const { + return loss_weight_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V1LayerParameter::loss_weight() const { + // @@protoc_insertion_point(field_list:caffe.V1LayerParameter.loss_weight) + return _internal_loss_weight(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::_internal_mutable_loss_weight() { + return &loss_weight_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V1LayerParameter::mutable_loss_weight() { + // @@protoc_insertion_point(field_mutable_list:caffe.V1LayerParameter.loss_weight) + return _internal_mutable_loss_weight(); +} + +// optional .caffe.AccuracyParameter accuracy_param = 27; +inline bool V1LayerParameter::_internal_has_accuracy_param() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + PROTOBUF_ASSUME(!value || accuracy_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_accuracy_param() const { + return _internal_has_accuracy_param(); +} +inline void V1LayerParameter::clear_accuracy_param() { + if (accuracy_param_ != nullptr) accuracy_param_->Clear(); + _has_bits_[0] &= ~0x00100000u; +} +inline const ::caffe::AccuracyParameter& V1LayerParameter::_internal_accuracy_param() const { + const ::caffe::AccuracyParameter* p = accuracy_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_AccuracyParameter_default_instance_); +} +inline const ::caffe::AccuracyParameter& V1LayerParameter::accuracy_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.accuracy_param) + return _internal_accuracy_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_accuracy_param( + ::caffe::AccuracyParameter* accuracy_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(accuracy_param_); + } + accuracy_param_ = accuracy_param; + if (accuracy_param) { + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.accuracy_param) +} +inline ::caffe::AccuracyParameter* V1LayerParameter::release_accuracy_param() { + auto temp = unsafe_arena_release_accuracy_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::AccuracyParameter* V1LayerParameter::unsafe_arena_release_accuracy_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.accuracy_param) + _has_bits_[0] &= ~0x00100000u; + ::caffe::AccuracyParameter* temp = accuracy_param_; + accuracy_param_ = nullptr; + return temp; +} +inline ::caffe::AccuracyParameter* V1LayerParameter::_internal_mutable_accuracy_param() { + _has_bits_[0] |= 0x00100000u; + if (accuracy_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::AccuracyParameter>(GetArena()); + accuracy_param_ = p; + } + return accuracy_param_; +} +inline ::caffe::AccuracyParameter* V1LayerParameter::mutable_accuracy_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.accuracy_param) + return _internal_mutable_accuracy_param(); +} +inline void V1LayerParameter::set_allocated_accuracy_param(::caffe::AccuracyParameter* accuracy_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete accuracy_param_; + } + if (accuracy_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(accuracy_param); + if (message_arena != submessage_arena) { + accuracy_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, accuracy_param, submessage_arena); + } + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + accuracy_param_ = accuracy_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.accuracy_param) +} + +// optional .caffe.ArgMaxParameter argmax_param = 23; +inline bool V1LayerParameter::_internal_has_argmax_param() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + PROTOBUF_ASSUME(!value || argmax_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_argmax_param() const { + return _internal_has_argmax_param(); +} +inline void V1LayerParameter::clear_argmax_param() { + if (argmax_param_ != nullptr) argmax_param_->Clear(); + _has_bits_[0] &= ~0x00010000u; +} +inline const ::caffe::ArgMaxParameter& V1LayerParameter::_internal_argmax_param() const { + const ::caffe::ArgMaxParameter* p = argmax_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ArgMaxParameter_default_instance_); +} +inline const ::caffe::ArgMaxParameter& V1LayerParameter::argmax_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.argmax_param) + return _internal_argmax_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_argmax_param( + ::caffe::ArgMaxParameter* argmax_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(argmax_param_); + } + argmax_param_ = argmax_param; + if (argmax_param) { + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.argmax_param) +} +inline ::caffe::ArgMaxParameter* V1LayerParameter::release_argmax_param() { + auto temp = unsafe_arena_release_argmax_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ArgMaxParameter* V1LayerParameter::unsafe_arena_release_argmax_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.argmax_param) + _has_bits_[0] &= ~0x00010000u; + ::caffe::ArgMaxParameter* temp = argmax_param_; + argmax_param_ = nullptr; + return temp; +} +inline ::caffe::ArgMaxParameter* V1LayerParameter::_internal_mutable_argmax_param() { + _has_bits_[0] |= 0x00010000u; + if (argmax_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ArgMaxParameter>(GetArena()); + argmax_param_ = p; + } + return argmax_param_; +} +inline ::caffe::ArgMaxParameter* V1LayerParameter::mutable_argmax_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.argmax_param) + return _internal_mutable_argmax_param(); +} +inline void V1LayerParameter::set_allocated_argmax_param(::caffe::ArgMaxParameter* argmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete argmax_param_; + } + if (argmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(argmax_param); + if (message_arena != submessage_arena) { + argmax_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, argmax_param, submessage_arena); + } + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + argmax_param_ = argmax_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.argmax_param) +} + +// optional .caffe.ConcatParameter concat_param = 9; +inline bool V1LayerParameter::_internal_has_concat_param() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || concat_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_concat_param() const { + return _internal_has_concat_param(); +} +inline void V1LayerParameter::clear_concat_param() { + if (concat_param_ != nullptr) concat_param_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +inline const ::caffe::ConcatParameter& V1LayerParameter::_internal_concat_param() const { + const ::caffe::ConcatParameter* p = concat_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ConcatParameter_default_instance_); +} +inline const ::caffe::ConcatParameter& V1LayerParameter::concat_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.concat_param) + return _internal_concat_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_concat_param( + ::caffe::ConcatParameter* concat_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(concat_param_); + } + concat_param_ = concat_param; + if (concat_param) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.concat_param) +} +inline ::caffe::ConcatParameter* V1LayerParameter::release_concat_param() { + auto temp = unsafe_arena_release_concat_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ConcatParameter* V1LayerParameter::unsafe_arena_release_concat_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.concat_param) + _has_bits_[0] &= ~0x00000004u; + ::caffe::ConcatParameter* temp = concat_param_; + concat_param_ = nullptr; + return temp; +} +inline ::caffe::ConcatParameter* V1LayerParameter::_internal_mutable_concat_param() { + _has_bits_[0] |= 0x00000004u; + if (concat_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ConcatParameter>(GetArena()); + concat_param_ = p; + } + return concat_param_; +} +inline ::caffe::ConcatParameter* V1LayerParameter::mutable_concat_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.concat_param) + return _internal_mutable_concat_param(); +} +inline void V1LayerParameter::set_allocated_concat_param(::caffe::ConcatParameter* concat_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete concat_param_; + } + if (concat_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(concat_param); + if (message_arena != submessage_arena) { + concat_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, concat_param, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + concat_param_ = concat_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.concat_param) +} + +// optional .caffe.ContrastiveLossParameter contrastive_loss_param = 40; +inline bool V1LayerParameter::_internal_has_contrastive_loss_param() const { + bool value = (_has_bits_[0] & 0x20000000u) != 0; + PROTOBUF_ASSUME(!value || contrastive_loss_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_contrastive_loss_param() const { + return _internal_has_contrastive_loss_param(); +} +inline void V1LayerParameter::clear_contrastive_loss_param() { + if (contrastive_loss_param_ != nullptr) contrastive_loss_param_->Clear(); + _has_bits_[0] &= ~0x20000000u; +} +inline const ::caffe::ContrastiveLossParameter& V1LayerParameter::_internal_contrastive_loss_param() const { + const ::caffe::ContrastiveLossParameter* p = contrastive_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ContrastiveLossParameter_default_instance_); +} +inline const ::caffe::ContrastiveLossParameter& V1LayerParameter::contrastive_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.contrastive_loss_param) + return _internal_contrastive_loss_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_contrastive_loss_param( + ::caffe::ContrastiveLossParameter* contrastive_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(contrastive_loss_param_); + } + contrastive_loss_param_ = contrastive_loss_param; + if (contrastive_loss_param) { + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.contrastive_loss_param) +} +inline ::caffe::ContrastiveLossParameter* V1LayerParameter::release_contrastive_loss_param() { + auto temp = unsafe_arena_release_contrastive_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ContrastiveLossParameter* V1LayerParameter::unsafe_arena_release_contrastive_loss_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.contrastive_loss_param) + _has_bits_[0] &= ~0x20000000u; + ::caffe::ContrastiveLossParameter* temp = contrastive_loss_param_; + contrastive_loss_param_ = nullptr; + return temp; +} +inline ::caffe::ContrastiveLossParameter* V1LayerParameter::_internal_mutable_contrastive_loss_param() { + _has_bits_[0] |= 0x20000000u; + if (contrastive_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ContrastiveLossParameter>(GetArena()); + contrastive_loss_param_ = p; + } + return contrastive_loss_param_; +} +inline ::caffe::ContrastiveLossParameter* V1LayerParameter::mutable_contrastive_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.contrastive_loss_param) + return _internal_mutable_contrastive_loss_param(); +} +inline void V1LayerParameter::set_allocated_contrastive_loss_param(::caffe::ContrastiveLossParameter* contrastive_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete contrastive_loss_param_; + } + if (contrastive_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(contrastive_loss_param); + if (message_arena != submessage_arena) { + contrastive_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, contrastive_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + contrastive_loss_param_ = contrastive_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.contrastive_loss_param) +} + +// optional .caffe.ConvolutionParameter convolution_param = 10; +inline bool V1LayerParameter::_internal_has_convolution_param() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || convolution_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_convolution_param() const { + return _internal_has_convolution_param(); +} +inline void V1LayerParameter::clear_convolution_param() { + if (convolution_param_ != nullptr) convolution_param_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +inline const ::caffe::ConvolutionParameter& V1LayerParameter::_internal_convolution_param() const { + const ::caffe::ConvolutionParameter* p = convolution_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ConvolutionParameter_default_instance_); +} +inline const ::caffe::ConvolutionParameter& V1LayerParameter::convolution_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.convolution_param) + return _internal_convolution_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_convolution_param( + ::caffe::ConvolutionParameter* convolution_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(convolution_param_); + } + convolution_param_ = convolution_param; + if (convolution_param) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.convolution_param) +} +inline ::caffe::ConvolutionParameter* V1LayerParameter::release_convolution_param() { + auto temp = unsafe_arena_release_convolution_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ConvolutionParameter* V1LayerParameter::unsafe_arena_release_convolution_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.convolution_param) + _has_bits_[0] &= ~0x00000008u; + ::caffe::ConvolutionParameter* temp = convolution_param_; + convolution_param_ = nullptr; + return temp; +} +inline ::caffe::ConvolutionParameter* V1LayerParameter::_internal_mutable_convolution_param() { + _has_bits_[0] |= 0x00000008u; + if (convolution_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ConvolutionParameter>(GetArena()); + convolution_param_ = p; + } + return convolution_param_; +} +inline ::caffe::ConvolutionParameter* V1LayerParameter::mutable_convolution_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.convolution_param) + return _internal_mutable_convolution_param(); +} +inline void V1LayerParameter::set_allocated_convolution_param(::caffe::ConvolutionParameter* convolution_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete convolution_param_; + } + if (convolution_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(convolution_param); + if (message_arena != submessage_arena) { + convolution_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, convolution_param, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + convolution_param_ = convolution_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.convolution_param) +} + +// optional .caffe.DataParameter data_param = 11; +inline bool V1LayerParameter::_internal_has_data_param() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_data_param() const { + return _internal_has_data_param(); +} +inline void V1LayerParameter::clear_data_param() { + if (data_param_ != nullptr) data_param_->Clear(); + _has_bits_[0] &= ~0x00000010u; +} +inline const ::caffe::DataParameter& V1LayerParameter::_internal_data_param() const { + const ::caffe::DataParameter* p = data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DataParameter_default_instance_); +} +inline const ::caffe::DataParameter& V1LayerParameter::data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.data_param) + return _internal_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_data_param( + ::caffe::DataParameter* data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(data_param_); + } + data_param_ = data_param; + if (data_param) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.data_param) +} +inline ::caffe::DataParameter* V1LayerParameter::release_data_param() { + auto temp = unsafe_arena_release_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DataParameter* V1LayerParameter::unsafe_arena_release_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.data_param) + _has_bits_[0] &= ~0x00000010u; + ::caffe::DataParameter* temp = data_param_; + data_param_ = nullptr; + return temp; +} +inline ::caffe::DataParameter* V1LayerParameter::_internal_mutable_data_param() { + _has_bits_[0] |= 0x00000010u; + if (data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DataParameter>(GetArena()); + data_param_ = p; + } + return data_param_; +} +inline ::caffe::DataParameter* V1LayerParameter::mutable_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.data_param) + return _internal_mutable_data_param(); +} +inline void V1LayerParameter::set_allocated_data_param(::caffe::DataParameter* data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete data_param_; + } + if (data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(data_param); + if (message_arena != submessage_arena) { + data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, data_param, submessage_arena); + } + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + data_param_ = data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.data_param) +} + +// optional .caffe.DropoutParameter dropout_param = 12; +inline bool V1LayerParameter::_internal_has_dropout_param() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || dropout_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_dropout_param() const { + return _internal_has_dropout_param(); +} +inline void V1LayerParameter::clear_dropout_param() { + if (dropout_param_ != nullptr) dropout_param_->Clear(); + _has_bits_[0] &= ~0x00000020u; +} +inline const ::caffe::DropoutParameter& V1LayerParameter::_internal_dropout_param() const { + const ::caffe::DropoutParameter* p = dropout_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DropoutParameter_default_instance_); +} +inline const ::caffe::DropoutParameter& V1LayerParameter::dropout_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.dropout_param) + return _internal_dropout_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_dropout_param( + ::caffe::DropoutParameter* dropout_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dropout_param_); + } + dropout_param_ = dropout_param; + if (dropout_param) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.dropout_param) +} +inline ::caffe::DropoutParameter* V1LayerParameter::release_dropout_param() { + auto temp = unsafe_arena_release_dropout_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DropoutParameter* V1LayerParameter::unsafe_arena_release_dropout_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.dropout_param) + _has_bits_[0] &= ~0x00000020u; + ::caffe::DropoutParameter* temp = dropout_param_; + dropout_param_ = nullptr; + return temp; +} +inline ::caffe::DropoutParameter* V1LayerParameter::_internal_mutable_dropout_param() { + _has_bits_[0] |= 0x00000020u; + if (dropout_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DropoutParameter>(GetArena()); + dropout_param_ = p; + } + return dropout_param_; +} +inline ::caffe::DropoutParameter* V1LayerParameter::mutable_dropout_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.dropout_param) + return _internal_mutable_dropout_param(); +} +inline void V1LayerParameter::set_allocated_dropout_param(::caffe::DropoutParameter* dropout_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete dropout_param_; + } + if (dropout_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(dropout_param); + if (message_arena != submessage_arena) { + dropout_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dropout_param, submessage_arena); + } + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + dropout_param_ = dropout_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.dropout_param) +} + +// optional .caffe.DummyDataParameter dummy_data_param = 26; +inline bool V1LayerParameter::_internal_has_dummy_data_param() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + PROTOBUF_ASSUME(!value || dummy_data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_dummy_data_param() const { + return _internal_has_dummy_data_param(); +} +inline void V1LayerParameter::clear_dummy_data_param() { + if (dummy_data_param_ != nullptr) dummy_data_param_->Clear(); + _has_bits_[0] &= ~0x00080000u; +} +inline const ::caffe::DummyDataParameter& V1LayerParameter::_internal_dummy_data_param() const { + const ::caffe::DummyDataParameter* p = dummy_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_DummyDataParameter_default_instance_); +} +inline const ::caffe::DummyDataParameter& V1LayerParameter::dummy_data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.dummy_data_param) + return _internal_dummy_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_dummy_data_param( + ::caffe::DummyDataParameter* dummy_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dummy_data_param_); + } + dummy_data_param_ = dummy_data_param; + if (dummy_data_param) { + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.dummy_data_param) +} +inline ::caffe::DummyDataParameter* V1LayerParameter::release_dummy_data_param() { + auto temp = unsafe_arena_release_dummy_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::DummyDataParameter* V1LayerParameter::unsafe_arena_release_dummy_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.dummy_data_param) + _has_bits_[0] &= ~0x00080000u; + ::caffe::DummyDataParameter* temp = dummy_data_param_; + dummy_data_param_ = nullptr; + return temp; +} +inline ::caffe::DummyDataParameter* V1LayerParameter::_internal_mutable_dummy_data_param() { + _has_bits_[0] |= 0x00080000u; + if (dummy_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::DummyDataParameter>(GetArena()); + dummy_data_param_ = p; + } + return dummy_data_param_; +} +inline ::caffe::DummyDataParameter* V1LayerParameter::mutable_dummy_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.dummy_data_param) + return _internal_mutable_dummy_data_param(); +} +inline void V1LayerParameter::set_allocated_dummy_data_param(::caffe::DummyDataParameter* dummy_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete dummy_data_param_; + } + if (dummy_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(dummy_data_param); + if (message_arena != submessage_arena) { + dummy_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dummy_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + dummy_data_param_ = dummy_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.dummy_data_param) +} + +// optional .caffe.EltwiseParameter eltwise_param = 24; +inline bool V1LayerParameter::_internal_has_eltwise_param() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + PROTOBUF_ASSUME(!value || eltwise_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_eltwise_param() const { + return _internal_has_eltwise_param(); +} +inline void V1LayerParameter::clear_eltwise_param() { + if (eltwise_param_ != nullptr) eltwise_param_->Clear(); + _has_bits_[0] &= ~0x00020000u; +} +inline const ::caffe::EltwiseParameter& V1LayerParameter::_internal_eltwise_param() const { + const ::caffe::EltwiseParameter* p = eltwise_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_EltwiseParameter_default_instance_); +} +inline const ::caffe::EltwiseParameter& V1LayerParameter::eltwise_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.eltwise_param) + return _internal_eltwise_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_eltwise_param( + ::caffe::EltwiseParameter* eltwise_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(eltwise_param_); + } + eltwise_param_ = eltwise_param; + if (eltwise_param) { + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.eltwise_param) +} +inline ::caffe::EltwiseParameter* V1LayerParameter::release_eltwise_param() { + auto temp = unsafe_arena_release_eltwise_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::EltwiseParameter* V1LayerParameter::unsafe_arena_release_eltwise_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.eltwise_param) + _has_bits_[0] &= ~0x00020000u; + ::caffe::EltwiseParameter* temp = eltwise_param_; + eltwise_param_ = nullptr; + return temp; +} +inline ::caffe::EltwiseParameter* V1LayerParameter::_internal_mutable_eltwise_param() { + _has_bits_[0] |= 0x00020000u; + if (eltwise_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::EltwiseParameter>(GetArena()); + eltwise_param_ = p; + } + return eltwise_param_; +} +inline ::caffe::EltwiseParameter* V1LayerParameter::mutable_eltwise_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.eltwise_param) + return _internal_mutable_eltwise_param(); +} +inline void V1LayerParameter::set_allocated_eltwise_param(::caffe::EltwiseParameter* eltwise_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete eltwise_param_; + } + if (eltwise_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(eltwise_param); + if (message_arena != submessage_arena) { + eltwise_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, eltwise_param, submessage_arena); + } + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + eltwise_param_ = eltwise_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.eltwise_param) +} + +// optional .caffe.ExpParameter exp_param = 41; +inline bool V1LayerParameter::_internal_has_exp_param() const { + bool value = (_has_bits_[0] & 0x40000000u) != 0; + PROTOBUF_ASSUME(!value || exp_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_exp_param() const { + return _internal_has_exp_param(); +} +inline void V1LayerParameter::clear_exp_param() { + if (exp_param_ != nullptr) exp_param_->Clear(); + _has_bits_[0] &= ~0x40000000u; +} +inline const ::caffe::ExpParameter& V1LayerParameter::_internal_exp_param() const { + const ::caffe::ExpParameter* p = exp_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ExpParameter_default_instance_); +} +inline const ::caffe::ExpParameter& V1LayerParameter::exp_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.exp_param) + return _internal_exp_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_exp_param( + ::caffe::ExpParameter* exp_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(exp_param_); + } + exp_param_ = exp_param; + if (exp_param) { + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.exp_param) +} +inline ::caffe::ExpParameter* V1LayerParameter::release_exp_param() { + auto temp = unsafe_arena_release_exp_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ExpParameter* V1LayerParameter::unsafe_arena_release_exp_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.exp_param) + _has_bits_[0] &= ~0x40000000u; + ::caffe::ExpParameter* temp = exp_param_; + exp_param_ = nullptr; + return temp; +} +inline ::caffe::ExpParameter* V1LayerParameter::_internal_mutable_exp_param() { + _has_bits_[0] |= 0x40000000u; + if (exp_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ExpParameter>(GetArena()); + exp_param_ = p; + } + return exp_param_; +} +inline ::caffe::ExpParameter* V1LayerParameter::mutable_exp_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.exp_param) + return _internal_mutable_exp_param(); +} +inline void V1LayerParameter::set_allocated_exp_param(::caffe::ExpParameter* exp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete exp_param_; + } + if (exp_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(exp_param); + if (message_arena != submessage_arena) { + exp_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, exp_param, submessage_arena); + } + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + exp_param_ = exp_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.exp_param) +} + +// optional .caffe.HDF5DataParameter hdf5_data_param = 13; +inline bool V1LayerParameter::_internal_has_hdf5_data_param() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || hdf5_data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_hdf5_data_param() const { + return _internal_has_hdf5_data_param(); +} +inline void V1LayerParameter::clear_hdf5_data_param() { + if (hdf5_data_param_ != nullptr) hdf5_data_param_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::caffe::HDF5DataParameter& V1LayerParameter::_internal_hdf5_data_param() const { + const ::caffe::HDF5DataParameter* p = hdf5_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HDF5DataParameter_default_instance_); +} +inline const ::caffe::HDF5DataParameter& V1LayerParameter::hdf5_data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.hdf5_data_param) + return _internal_hdf5_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_hdf5_data_param( + ::caffe::HDF5DataParameter* hdf5_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hdf5_data_param_); + } + hdf5_data_param_ = hdf5_data_param; + if (hdf5_data_param) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.hdf5_data_param) +} +inline ::caffe::HDF5DataParameter* V1LayerParameter::release_hdf5_data_param() { + auto temp = unsafe_arena_release_hdf5_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HDF5DataParameter* V1LayerParameter::unsafe_arena_release_hdf5_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.hdf5_data_param) + _has_bits_[0] &= ~0x00000040u; + ::caffe::HDF5DataParameter* temp = hdf5_data_param_; + hdf5_data_param_ = nullptr; + return temp; +} +inline ::caffe::HDF5DataParameter* V1LayerParameter::_internal_mutable_hdf5_data_param() { + _has_bits_[0] |= 0x00000040u; + if (hdf5_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HDF5DataParameter>(GetArena()); + hdf5_data_param_ = p; + } + return hdf5_data_param_; +} +inline ::caffe::HDF5DataParameter* V1LayerParameter::mutable_hdf5_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.hdf5_data_param) + return _internal_mutable_hdf5_data_param(); +} +inline void V1LayerParameter::set_allocated_hdf5_data_param(::caffe::HDF5DataParameter* hdf5_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hdf5_data_param_; + } + if (hdf5_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hdf5_data_param); + if (message_arena != submessage_arena) { + hdf5_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hdf5_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + hdf5_data_param_ = hdf5_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.hdf5_data_param) +} + +// optional .caffe.HDF5OutputParameter hdf5_output_param = 14; +inline bool V1LayerParameter::_internal_has_hdf5_output_param() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || hdf5_output_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_hdf5_output_param() const { + return _internal_has_hdf5_output_param(); +} +inline void V1LayerParameter::clear_hdf5_output_param() { + if (hdf5_output_param_ != nullptr) hdf5_output_param_->Clear(); + _has_bits_[0] &= ~0x00000080u; +} +inline const ::caffe::HDF5OutputParameter& V1LayerParameter::_internal_hdf5_output_param() const { + const ::caffe::HDF5OutputParameter* p = hdf5_output_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HDF5OutputParameter_default_instance_); +} +inline const ::caffe::HDF5OutputParameter& V1LayerParameter::hdf5_output_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.hdf5_output_param) + return _internal_hdf5_output_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hdf5_output_param_); + } + hdf5_output_param_ = hdf5_output_param; + if (hdf5_output_param) { + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.hdf5_output_param) +} +inline ::caffe::HDF5OutputParameter* V1LayerParameter::release_hdf5_output_param() { + auto temp = unsafe_arena_release_hdf5_output_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HDF5OutputParameter* V1LayerParameter::unsafe_arena_release_hdf5_output_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.hdf5_output_param) + _has_bits_[0] &= ~0x00000080u; + ::caffe::HDF5OutputParameter* temp = hdf5_output_param_; + hdf5_output_param_ = nullptr; + return temp; +} +inline ::caffe::HDF5OutputParameter* V1LayerParameter::_internal_mutable_hdf5_output_param() { + _has_bits_[0] |= 0x00000080u; + if (hdf5_output_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HDF5OutputParameter>(GetArena()); + hdf5_output_param_ = p; + } + return hdf5_output_param_; +} +inline ::caffe::HDF5OutputParameter* V1LayerParameter::mutable_hdf5_output_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.hdf5_output_param) + return _internal_mutable_hdf5_output_param(); +} +inline void V1LayerParameter::set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hdf5_output_param_; + } + if (hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hdf5_output_param); + if (message_arena != submessage_arena) { + hdf5_output_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hdf5_output_param, submessage_arena); + } + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + hdf5_output_param_ = hdf5_output_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.hdf5_output_param) +} + +// optional .caffe.HingeLossParameter hinge_loss_param = 29; +inline bool V1LayerParameter::_internal_has_hinge_loss_param() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + PROTOBUF_ASSUME(!value || hinge_loss_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_hinge_loss_param() const { + return _internal_has_hinge_loss_param(); +} +inline void V1LayerParameter::clear_hinge_loss_param() { + if (hinge_loss_param_ != nullptr) hinge_loss_param_->Clear(); + _has_bits_[0] &= ~0x00200000u; +} +inline const ::caffe::HingeLossParameter& V1LayerParameter::_internal_hinge_loss_param() const { + const ::caffe::HingeLossParameter* p = hinge_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HingeLossParameter_default_instance_); +} +inline const ::caffe::HingeLossParameter& V1LayerParameter::hinge_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.hinge_loss_param) + return _internal_hinge_loss_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_hinge_loss_param( + ::caffe::HingeLossParameter* hinge_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hinge_loss_param_); + } + hinge_loss_param_ = hinge_loss_param; + if (hinge_loss_param) { + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.hinge_loss_param) +} +inline ::caffe::HingeLossParameter* V1LayerParameter::release_hinge_loss_param() { + auto temp = unsafe_arena_release_hinge_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HingeLossParameter* V1LayerParameter::unsafe_arena_release_hinge_loss_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.hinge_loss_param) + _has_bits_[0] &= ~0x00200000u; + ::caffe::HingeLossParameter* temp = hinge_loss_param_; + hinge_loss_param_ = nullptr; + return temp; +} +inline ::caffe::HingeLossParameter* V1LayerParameter::_internal_mutable_hinge_loss_param() { + _has_bits_[0] |= 0x00200000u; + if (hinge_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HingeLossParameter>(GetArena()); + hinge_loss_param_ = p; + } + return hinge_loss_param_; +} +inline ::caffe::HingeLossParameter* V1LayerParameter::mutable_hinge_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.hinge_loss_param) + return _internal_mutable_hinge_loss_param(); +} +inline void V1LayerParameter::set_allocated_hinge_loss_param(::caffe::HingeLossParameter* hinge_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hinge_loss_param_; + } + if (hinge_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hinge_loss_param); + if (message_arena != submessage_arena) { + hinge_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hinge_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + hinge_loss_param_ = hinge_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.hinge_loss_param) +} + +// optional .caffe.ImageDataParameter image_data_param = 15; +inline bool V1LayerParameter::_internal_has_image_data_param() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || image_data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_image_data_param() const { + return _internal_has_image_data_param(); +} +inline void V1LayerParameter::clear_image_data_param() { + if (image_data_param_ != nullptr) image_data_param_->Clear(); + _has_bits_[0] &= ~0x00000100u; +} +inline const ::caffe::ImageDataParameter& V1LayerParameter::_internal_image_data_param() const { + const ::caffe::ImageDataParameter* p = image_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ImageDataParameter_default_instance_); +} +inline const ::caffe::ImageDataParameter& V1LayerParameter::image_data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.image_data_param) + return _internal_image_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_image_data_param( + ::caffe::ImageDataParameter* image_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(image_data_param_); + } + image_data_param_ = image_data_param; + if (image_data_param) { + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.image_data_param) +} +inline ::caffe::ImageDataParameter* V1LayerParameter::release_image_data_param() { + auto temp = unsafe_arena_release_image_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ImageDataParameter* V1LayerParameter::unsafe_arena_release_image_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.image_data_param) + _has_bits_[0] &= ~0x00000100u; + ::caffe::ImageDataParameter* temp = image_data_param_; + image_data_param_ = nullptr; + return temp; +} +inline ::caffe::ImageDataParameter* V1LayerParameter::_internal_mutable_image_data_param() { + _has_bits_[0] |= 0x00000100u; + if (image_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ImageDataParameter>(GetArena()); + image_data_param_ = p; + } + return image_data_param_; +} +inline ::caffe::ImageDataParameter* V1LayerParameter::mutable_image_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.image_data_param) + return _internal_mutable_image_data_param(); +} +inline void V1LayerParameter::set_allocated_image_data_param(::caffe::ImageDataParameter* image_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete image_data_param_; + } + if (image_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(image_data_param); + if (message_arena != submessage_arena) { + image_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, image_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + image_data_param_ = image_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.image_data_param) +} + +// optional .caffe.InfogainLossParameter infogain_loss_param = 16; +inline bool V1LayerParameter::_internal_has_infogain_loss_param() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + PROTOBUF_ASSUME(!value || infogain_loss_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_infogain_loss_param() const { + return _internal_has_infogain_loss_param(); +} +inline void V1LayerParameter::clear_infogain_loss_param() { + if (infogain_loss_param_ != nullptr) infogain_loss_param_->Clear(); + _has_bits_[0] &= ~0x00000200u; +} +inline const ::caffe::InfogainLossParameter& V1LayerParameter::_internal_infogain_loss_param() const { + const ::caffe::InfogainLossParameter* p = infogain_loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_InfogainLossParameter_default_instance_); +} +inline const ::caffe::InfogainLossParameter& V1LayerParameter::infogain_loss_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.infogain_loss_param) + return _internal_infogain_loss_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_infogain_loss_param( + ::caffe::InfogainLossParameter* infogain_loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(infogain_loss_param_); + } + infogain_loss_param_ = infogain_loss_param; + if (infogain_loss_param) { + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.infogain_loss_param) +} +inline ::caffe::InfogainLossParameter* V1LayerParameter::release_infogain_loss_param() { + auto temp = unsafe_arena_release_infogain_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::InfogainLossParameter* V1LayerParameter::unsafe_arena_release_infogain_loss_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.infogain_loss_param) + _has_bits_[0] &= ~0x00000200u; + ::caffe::InfogainLossParameter* temp = infogain_loss_param_; + infogain_loss_param_ = nullptr; + return temp; +} +inline ::caffe::InfogainLossParameter* V1LayerParameter::_internal_mutable_infogain_loss_param() { + _has_bits_[0] |= 0x00000200u; + if (infogain_loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::InfogainLossParameter>(GetArena()); + infogain_loss_param_ = p; + } + return infogain_loss_param_; +} +inline ::caffe::InfogainLossParameter* V1LayerParameter::mutable_infogain_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.infogain_loss_param) + return _internal_mutable_infogain_loss_param(); +} +inline void V1LayerParameter::set_allocated_infogain_loss_param(::caffe::InfogainLossParameter* infogain_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete infogain_loss_param_; + } + if (infogain_loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(infogain_loss_param); + if (message_arena != submessage_arena) { + infogain_loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, infogain_loss_param, submessage_arena); + } + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + infogain_loss_param_ = infogain_loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.infogain_loss_param) +} + +// optional .caffe.InnerProductParameter inner_product_param = 17; +inline bool V1LayerParameter::_internal_has_inner_product_param() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + PROTOBUF_ASSUME(!value || inner_product_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_inner_product_param() const { + return _internal_has_inner_product_param(); +} +inline void V1LayerParameter::clear_inner_product_param() { + if (inner_product_param_ != nullptr) inner_product_param_->Clear(); + _has_bits_[0] &= ~0x00000400u; +} +inline const ::caffe::InnerProductParameter& V1LayerParameter::_internal_inner_product_param() const { + const ::caffe::InnerProductParameter* p = inner_product_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_InnerProductParameter_default_instance_); +} +inline const ::caffe::InnerProductParameter& V1LayerParameter::inner_product_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.inner_product_param) + return _internal_inner_product_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_inner_product_param( + ::caffe::InnerProductParameter* inner_product_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(inner_product_param_); + } + inner_product_param_ = inner_product_param; + if (inner_product_param) { + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.inner_product_param) +} +inline ::caffe::InnerProductParameter* V1LayerParameter::release_inner_product_param() { + auto temp = unsafe_arena_release_inner_product_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::InnerProductParameter* V1LayerParameter::unsafe_arena_release_inner_product_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.inner_product_param) + _has_bits_[0] &= ~0x00000400u; + ::caffe::InnerProductParameter* temp = inner_product_param_; + inner_product_param_ = nullptr; + return temp; +} +inline ::caffe::InnerProductParameter* V1LayerParameter::_internal_mutable_inner_product_param() { + _has_bits_[0] |= 0x00000400u; + if (inner_product_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::InnerProductParameter>(GetArena()); + inner_product_param_ = p; + } + return inner_product_param_; +} +inline ::caffe::InnerProductParameter* V1LayerParameter::mutable_inner_product_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.inner_product_param) + return _internal_mutable_inner_product_param(); +} +inline void V1LayerParameter::set_allocated_inner_product_param(::caffe::InnerProductParameter* inner_product_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete inner_product_param_; + } + if (inner_product_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(inner_product_param); + if (message_arena != submessage_arena) { + inner_product_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, inner_product_param, submessage_arena); + } + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + inner_product_param_ = inner_product_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.inner_product_param) +} + +// optional .caffe.LRNParameter lrn_param = 18; +inline bool V1LayerParameter::_internal_has_lrn_param() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || lrn_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_lrn_param() const { + return _internal_has_lrn_param(); +} +inline void V1LayerParameter::clear_lrn_param() { + if (lrn_param_ != nullptr) lrn_param_->Clear(); + _has_bits_[0] &= ~0x00000800u; +} +inline const ::caffe::LRNParameter& V1LayerParameter::_internal_lrn_param() const { + const ::caffe::LRNParameter* p = lrn_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_LRNParameter_default_instance_); +} +inline const ::caffe::LRNParameter& V1LayerParameter::lrn_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.lrn_param) + return _internal_lrn_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_lrn_param( + ::caffe::LRNParameter* lrn_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(lrn_param_); + } + lrn_param_ = lrn_param; + if (lrn_param) { + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.lrn_param) +} +inline ::caffe::LRNParameter* V1LayerParameter::release_lrn_param() { + auto temp = unsafe_arena_release_lrn_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::LRNParameter* V1LayerParameter::unsafe_arena_release_lrn_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.lrn_param) + _has_bits_[0] &= ~0x00000800u; + ::caffe::LRNParameter* temp = lrn_param_; + lrn_param_ = nullptr; + return temp; +} +inline ::caffe::LRNParameter* V1LayerParameter::_internal_mutable_lrn_param() { + _has_bits_[0] |= 0x00000800u; + if (lrn_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::LRNParameter>(GetArena()); + lrn_param_ = p; + } + return lrn_param_; +} +inline ::caffe::LRNParameter* V1LayerParameter::mutable_lrn_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.lrn_param) + return _internal_mutable_lrn_param(); +} +inline void V1LayerParameter::set_allocated_lrn_param(::caffe::LRNParameter* lrn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete lrn_param_; + } + if (lrn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(lrn_param); + if (message_arena != submessage_arena) { + lrn_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, lrn_param, submessage_arena); + } + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + lrn_param_ = lrn_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.lrn_param) +} + +// optional .caffe.MemoryDataParameter memory_data_param = 22; +inline bool V1LayerParameter::_internal_has_memory_data_param() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + PROTOBUF_ASSUME(!value || memory_data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_memory_data_param() const { + return _internal_has_memory_data_param(); +} +inline void V1LayerParameter::clear_memory_data_param() { + if (memory_data_param_ != nullptr) memory_data_param_->Clear(); + _has_bits_[0] &= ~0x00008000u; +} +inline const ::caffe::MemoryDataParameter& V1LayerParameter::_internal_memory_data_param() const { + const ::caffe::MemoryDataParameter* p = memory_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_MemoryDataParameter_default_instance_); +} +inline const ::caffe::MemoryDataParameter& V1LayerParameter::memory_data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.memory_data_param) + return _internal_memory_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_memory_data_param( + ::caffe::MemoryDataParameter* memory_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(memory_data_param_); + } + memory_data_param_ = memory_data_param; + if (memory_data_param) { + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.memory_data_param) +} +inline ::caffe::MemoryDataParameter* V1LayerParameter::release_memory_data_param() { + auto temp = unsafe_arena_release_memory_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::MemoryDataParameter* V1LayerParameter::unsafe_arena_release_memory_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.memory_data_param) + _has_bits_[0] &= ~0x00008000u; + ::caffe::MemoryDataParameter* temp = memory_data_param_; + memory_data_param_ = nullptr; + return temp; +} +inline ::caffe::MemoryDataParameter* V1LayerParameter::_internal_mutable_memory_data_param() { + _has_bits_[0] |= 0x00008000u; + if (memory_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::MemoryDataParameter>(GetArena()); + memory_data_param_ = p; + } + return memory_data_param_; +} +inline ::caffe::MemoryDataParameter* V1LayerParameter::mutable_memory_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.memory_data_param) + return _internal_mutable_memory_data_param(); +} +inline void V1LayerParameter::set_allocated_memory_data_param(::caffe::MemoryDataParameter* memory_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete memory_data_param_; + } + if (memory_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(memory_data_param); + if (message_arena != submessage_arena) { + memory_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, memory_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + memory_data_param_ = memory_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.memory_data_param) +} + +// optional .caffe.MVNParameter mvn_param = 34; +inline bool V1LayerParameter::_internal_has_mvn_param() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + PROTOBUF_ASSUME(!value || mvn_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_mvn_param() const { + return _internal_has_mvn_param(); +} +inline void V1LayerParameter::clear_mvn_param() { + if (mvn_param_ != nullptr) mvn_param_->Clear(); + _has_bits_[0] &= ~0x01000000u; +} +inline const ::caffe::MVNParameter& V1LayerParameter::_internal_mvn_param() const { + const ::caffe::MVNParameter* p = mvn_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_MVNParameter_default_instance_); +} +inline const ::caffe::MVNParameter& V1LayerParameter::mvn_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.mvn_param) + return _internal_mvn_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_mvn_param( + ::caffe::MVNParameter* mvn_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(mvn_param_); + } + mvn_param_ = mvn_param; + if (mvn_param) { + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.mvn_param) +} +inline ::caffe::MVNParameter* V1LayerParameter::release_mvn_param() { + auto temp = unsafe_arena_release_mvn_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::MVNParameter* V1LayerParameter::unsafe_arena_release_mvn_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.mvn_param) + _has_bits_[0] &= ~0x01000000u; + ::caffe::MVNParameter* temp = mvn_param_; + mvn_param_ = nullptr; + return temp; +} +inline ::caffe::MVNParameter* V1LayerParameter::_internal_mutable_mvn_param() { + _has_bits_[0] |= 0x01000000u; + if (mvn_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::MVNParameter>(GetArena()); + mvn_param_ = p; + } + return mvn_param_; +} +inline ::caffe::MVNParameter* V1LayerParameter::mutable_mvn_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.mvn_param) + return _internal_mutable_mvn_param(); +} +inline void V1LayerParameter::set_allocated_mvn_param(::caffe::MVNParameter* mvn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete mvn_param_; + } + if (mvn_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(mvn_param); + if (message_arena != submessage_arena) { + mvn_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, mvn_param, submessage_arena); + } + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + mvn_param_ = mvn_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.mvn_param) +} + +// optional .caffe.PoolingParameter pooling_param = 19; +inline bool V1LayerParameter::_internal_has_pooling_param() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + PROTOBUF_ASSUME(!value || pooling_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_pooling_param() const { + return _internal_has_pooling_param(); +} +inline void V1LayerParameter::clear_pooling_param() { + if (pooling_param_ != nullptr) pooling_param_->Clear(); + _has_bits_[0] &= ~0x00001000u; +} +inline const ::caffe::PoolingParameter& V1LayerParameter::_internal_pooling_param() const { + const ::caffe::PoolingParameter* p = pooling_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PoolingParameter_default_instance_); +} +inline const ::caffe::PoolingParameter& V1LayerParameter::pooling_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.pooling_param) + return _internal_pooling_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_pooling_param( + ::caffe::PoolingParameter* pooling_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(pooling_param_); + } + pooling_param_ = pooling_param; + if (pooling_param) { + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.pooling_param) +} +inline ::caffe::PoolingParameter* V1LayerParameter::release_pooling_param() { + auto temp = unsafe_arena_release_pooling_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PoolingParameter* V1LayerParameter::unsafe_arena_release_pooling_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.pooling_param) + _has_bits_[0] &= ~0x00001000u; + ::caffe::PoolingParameter* temp = pooling_param_; + pooling_param_ = nullptr; + return temp; +} +inline ::caffe::PoolingParameter* V1LayerParameter::_internal_mutable_pooling_param() { + _has_bits_[0] |= 0x00001000u; + if (pooling_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PoolingParameter>(GetArena()); + pooling_param_ = p; + } + return pooling_param_; +} +inline ::caffe::PoolingParameter* V1LayerParameter::mutable_pooling_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.pooling_param) + return _internal_mutable_pooling_param(); +} +inline void V1LayerParameter::set_allocated_pooling_param(::caffe::PoolingParameter* pooling_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete pooling_param_; + } + if (pooling_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(pooling_param); + if (message_arena != submessage_arena) { + pooling_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, pooling_param, submessage_arena); + } + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + pooling_param_ = pooling_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.pooling_param) +} + +// optional .caffe.PowerParameter power_param = 21; +inline bool V1LayerParameter::_internal_has_power_param() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + PROTOBUF_ASSUME(!value || power_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_power_param() const { + return _internal_has_power_param(); +} +inline void V1LayerParameter::clear_power_param() { + if (power_param_ != nullptr) power_param_->Clear(); + _has_bits_[0] &= ~0x00004000u; +} +inline const ::caffe::PowerParameter& V1LayerParameter::_internal_power_param() const { + const ::caffe::PowerParameter* p = power_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_PowerParameter_default_instance_); +} +inline const ::caffe::PowerParameter& V1LayerParameter::power_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.power_param) + return _internal_power_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_power_param( + ::caffe::PowerParameter* power_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(power_param_); + } + power_param_ = power_param; + if (power_param) { + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.power_param) +} +inline ::caffe::PowerParameter* V1LayerParameter::release_power_param() { + auto temp = unsafe_arena_release_power_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::PowerParameter* V1LayerParameter::unsafe_arena_release_power_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.power_param) + _has_bits_[0] &= ~0x00004000u; + ::caffe::PowerParameter* temp = power_param_; + power_param_ = nullptr; + return temp; +} +inline ::caffe::PowerParameter* V1LayerParameter::_internal_mutable_power_param() { + _has_bits_[0] |= 0x00004000u; + if (power_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::PowerParameter>(GetArena()); + power_param_ = p; + } + return power_param_; +} +inline ::caffe::PowerParameter* V1LayerParameter::mutable_power_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.power_param) + return _internal_mutable_power_param(); +} +inline void V1LayerParameter::set_allocated_power_param(::caffe::PowerParameter* power_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete power_param_; + } + if (power_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(power_param); + if (message_arena != submessage_arena) { + power_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, power_param, submessage_arena); + } + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + power_param_ = power_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.power_param) +} + +// optional .caffe.ReLUParameter relu_param = 30; +inline bool V1LayerParameter::_internal_has_relu_param() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + PROTOBUF_ASSUME(!value || relu_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_relu_param() const { + return _internal_has_relu_param(); +} +inline void V1LayerParameter::clear_relu_param() { + if (relu_param_ != nullptr) relu_param_->Clear(); + _has_bits_[0] &= ~0x00400000u; +} +inline const ::caffe::ReLUParameter& V1LayerParameter::_internal_relu_param() const { + const ::caffe::ReLUParameter* p = relu_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ReLUParameter_default_instance_); +} +inline const ::caffe::ReLUParameter& V1LayerParameter::relu_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.relu_param) + return _internal_relu_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_relu_param( + ::caffe::ReLUParameter* relu_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(relu_param_); + } + relu_param_ = relu_param; + if (relu_param) { + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.relu_param) +} +inline ::caffe::ReLUParameter* V1LayerParameter::release_relu_param() { + auto temp = unsafe_arena_release_relu_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ReLUParameter* V1LayerParameter::unsafe_arena_release_relu_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.relu_param) + _has_bits_[0] &= ~0x00400000u; + ::caffe::ReLUParameter* temp = relu_param_; + relu_param_ = nullptr; + return temp; +} +inline ::caffe::ReLUParameter* V1LayerParameter::_internal_mutable_relu_param() { + _has_bits_[0] |= 0x00400000u; + if (relu_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ReLUParameter>(GetArena()); + relu_param_ = p; + } + return relu_param_; +} +inline ::caffe::ReLUParameter* V1LayerParameter::mutable_relu_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.relu_param) + return _internal_mutable_relu_param(); +} +inline void V1LayerParameter::set_allocated_relu_param(::caffe::ReLUParameter* relu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete relu_param_; + } + if (relu_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(relu_param); + if (message_arena != submessage_arena) { + relu_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, relu_param, submessage_arena); + } + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + relu_param_ = relu_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.relu_param) +} + +// optional .caffe.SigmoidParameter sigmoid_param = 38; +inline bool V1LayerParameter::_internal_has_sigmoid_param() const { + bool value = (_has_bits_[0] & 0x08000000u) != 0; + PROTOBUF_ASSUME(!value || sigmoid_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_sigmoid_param() const { + return _internal_has_sigmoid_param(); +} +inline void V1LayerParameter::clear_sigmoid_param() { + if (sigmoid_param_ != nullptr) sigmoid_param_->Clear(); + _has_bits_[0] &= ~0x08000000u; +} +inline const ::caffe::SigmoidParameter& V1LayerParameter::_internal_sigmoid_param() const { + const ::caffe::SigmoidParameter* p = sigmoid_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SigmoidParameter_default_instance_); +} +inline const ::caffe::SigmoidParameter& V1LayerParameter::sigmoid_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.sigmoid_param) + return _internal_sigmoid_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_sigmoid_param( + ::caffe::SigmoidParameter* sigmoid_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(sigmoid_param_); + } + sigmoid_param_ = sigmoid_param; + if (sigmoid_param) { + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.sigmoid_param) +} +inline ::caffe::SigmoidParameter* V1LayerParameter::release_sigmoid_param() { + auto temp = unsafe_arena_release_sigmoid_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SigmoidParameter* V1LayerParameter::unsafe_arena_release_sigmoid_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.sigmoid_param) + _has_bits_[0] &= ~0x08000000u; + ::caffe::SigmoidParameter* temp = sigmoid_param_; + sigmoid_param_ = nullptr; + return temp; +} +inline ::caffe::SigmoidParameter* V1LayerParameter::_internal_mutable_sigmoid_param() { + _has_bits_[0] |= 0x08000000u; + if (sigmoid_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SigmoidParameter>(GetArena()); + sigmoid_param_ = p; + } + return sigmoid_param_; +} +inline ::caffe::SigmoidParameter* V1LayerParameter::mutable_sigmoid_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.sigmoid_param) + return _internal_mutable_sigmoid_param(); +} +inline void V1LayerParameter::set_allocated_sigmoid_param(::caffe::SigmoidParameter* sigmoid_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete sigmoid_param_; + } + if (sigmoid_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(sigmoid_param); + if (message_arena != submessage_arena) { + sigmoid_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, sigmoid_param, submessage_arena); + } + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + sigmoid_param_ = sigmoid_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.sigmoid_param) +} + +// optional .caffe.SoftmaxParameter softmax_param = 39; +inline bool V1LayerParameter::_internal_has_softmax_param() const { + bool value = (_has_bits_[0] & 0x10000000u) != 0; + PROTOBUF_ASSUME(!value || softmax_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_softmax_param() const { + return _internal_has_softmax_param(); +} +inline void V1LayerParameter::clear_softmax_param() { + if (softmax_param_ != nullptr) softmax_param_->Clear(); + _has_bits_[0] &= ~0x10000000u; +} +inline const ::caffe::SoftmaxParameter& V1LayerParameter::_internal_softmax_param() const { + const ::caffe::SoftmaxParameter* p = softmax_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SoftmaxParameter_default_instance_); +} +inline const ::caffe::SoftmaxParameter& V1LayerParameter::softmax_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.softmax_param) + return _internal_softmax_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_softmax_param( + ::caffe::SoftmaxParameter* softmax_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(softmax_param_); + } + softmax_param_ = softmax_param; + if (softmax_param) { + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.softmax_param) +} +inline ::caffe::SoftmaxParameter* V1LayerParameter::release_softmax_param() { + auto temp = unsafe_arena_release_softmax_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SoftmaxParameter* V1LayerParameter::unsafe_arena_release_softmax_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.softmax_param) + _has_bits_[0] &= ~0x10000000u; + ::caffe::SoftmaxParameter* temp = softmax_param_; + softmax_param_ = nullptr; + return temp; +} +inline ::caffe::SoftmaxParameter* V1LayerParameter::_internal_mutable_softmax_param() { + _has_bits_[0] |= 0x10000000u; + if (softmax_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SoftmaxParameter>(GetArena()); + softmax_param_ = p; + } + return softmax_param_; +} +inline ::caffe::SoftmaxParameter* V1LayerParameter::mutable_softmax_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.softmax_param) + return _internal_mutable_softmax_param(); +} +inline void V1LayerParameter::set_allocated_softmax_param(::caffe::SoftmaxParameter* softmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete softmax_param_; + } + if (softmax_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(softmax_param); + if (message_arena != submessage_arena) { + softmax_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, softmax_param, submessage_arena); + } + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + softmax_param_ = softmax_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.softmax_param) +} + +// optional .caffe.SliceParameter slice_param = 31; +inline bool V1LayerParameter::_internal_has_slice_param() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + PROTOBUF_ASSUME(!value || slice_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_slice_param() const { + return _internal_has_slice_param(); +} +inline void V1LayerParameter::clear_slice_param() { + if (slice_param_ != nullptr) slice_param_->Clear(); + _has_bits_[0] &= ~0x00800000u; +} +inline const ::caffe::SliceParameter& V1LayerParameter::_internal_slice_param() const { + const ::caffe::SliceParameter* p = slice_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_SliceParameter_default_instance_); +} +inline const ::caffe::SliceParameter& V1LayerParameter::slice_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.slice_param) + return _internal_slice_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_slice_param( + ::caffe::SliceParameter* slice_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(slice_param_); + } + slice_param_ = slice_param; + if (slice_param) { + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.slice_param) +} +inline ::caffe::SliceParameter* V1LayerParameter::release_slice_param() { + auto temp = unsafe_arena_release_slice_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::SliceParameter* V1LayerParameter::unsafe_arena_release_slice_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.slice_param) + _has_bits_[0] &= ~0x00800000u; + ::caffe::SliceParameter* temp = slice_param_; + slice_param_ = nullptr; + return temp; +} +inline ::caffe::SliceParameter* V1LayerParameter::_internal_mutable_slice_param() { + _has_bits_[0] |= 0x00800000u; + if (slice_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::SliceParameter>(GetArena()); + slice_param_ = p; + } + return slice_param_; +} +inline ::caffe::SliceParameter* V1LayerParameter::mutable_slice_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.slice_param) + return _internal_mutable_slice_param(); +} +inline void V1LayerParameter::set_allocated_slice_param(::caffe::SliceParameter* slice_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete slice_param_; + } + if (slice_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(slice_param); + if (message_arena != submessage_arena) { + slice_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, slice_param, submessage_arena); + } + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + slice_param_ = slice_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.slice_param) +} + +// optional .caffe.TanHParameter tanh_param = 37; +inline bool V1LayerParameter::_internal_has_tanh_param() const { + bool value = (_has_bits_[0] & 0x04000000u) != 0; + PROTOBUF_ASSUME(!value || tanh_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_tanh_param() const { + return _internal_has_tanh_param(); +} +inline void V1LayerParameter::clear_tanh_param() { + if (tanh_param_ != nullptr) tanh_param_->Clear(); + _has_bits_[0] &= ~0x04000000u; +} +inline const ::caffe::TanHParameter& V1LayerParameter::_internal_tanh_param() const { + const ::caffe::TanHParameter* p = tanh_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_TanHParameter_default_instance_); +} +inline const ::caffe::TanHParameter& V1LayerParameter::tanh_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.tanh_param) + return _internal_tanh_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_tanh_param( + ::caffe::TanHParameter* tanh_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tanh_param_); + } + tanh_param_ = tanh_param; + if (tanh_param) { + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.tanh_param) +} +inline ::caffe::TanHParameter* V1LayerParameter::release_tanh_param() { + auto temp = unsafe_arena_release_tanh_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::TanHParameter* V1LayerParameter::unsafe_arena_release_tanh_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.tanh_param) + _has_bits_[0] &= ~0x04000000u; + ::caffe::TanHParameter* temp = tanh_param_; + tanh_param_ = nullptr; + return temp; +} +inline ::caffe::TanHParameter* V1LayerParameter::_internal_mutable_tanh_param() { + _has_bits_[0] |= 0x04000000u; + if (tanh_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::TanHParameter>(GetArena()); + tanh_param_ = p; + } + return tanh_param_; +} +inline ::caffe::TanHParameter* V1LayerParameter::mutable_tanh_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.tanh_param) + return _internal_mutable_tanh_param(); +} +inline void V1LayerParameter::set_allocated_tanh_param(::caffe::TanHParameter* tanh_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete tanh_param_; + } + if (tanh_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(tanh_param); + if (message_arena != submessage_arena) { + tanh_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tanh_param, submessage_arena); + } + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + tanh_param_ = tanh_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.tanh_param) +} + +// optional .caffe.ThresholdParameter threshold_param = 25; +inline bool V1LayerParameter::_internal_has_threshold_param() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + PROTOBUF_ASSUME(!value || threshold_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_threshold_param() const { + return _internal_has_threshold_param(); +} +inline void V1LayerParameter::clear_threshold_param() { + if (threshold_param_ != nullptr) threshold_param_->Clear(); + _has_bits_[0] &= ~0x00040000u; +} +inline const ::caffe::ThresholdParameter& V1LayerParameter::_internal_threshold_param() const { + const ::caffe::ThresholdParameter* p = threshold_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_ThresholdParameter_default_instance_); +} +inline const ::caffe::ThresholdParameter& V1LayerParameter::threshold_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.threshold_param) + return _internal_threshold_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_threshold_param( + ::caffe::ThresholdParameter* threshold_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(threshold_param_); + } + threshold_param_ = threshold_param; + if (threshold_param) { + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.threshold_param) +} +inline ::caffe::ThresholdParameter* V1LayerParameter::release_threshold_param() { + auto temp = unsafe_arena_release_threshold_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::ThresholdParameter* V1LayerParameter::unsafe_arena_release_threshold_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.threshold_param) + _has_bits_[0] &= ~0x00040000u; + ::caffe::ThresholdParameter* temp = threshold_param_; + threshold_param_ = nullptr; + return temp; +} +inline ::caffe::ThresholdParameter* V1LayerParameter::_internal_mutable_threshold_param() { + _has_bits_[0] |= 0x00040000u; + if (threshold_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::ThresholdParameter>(GetArena()); + threshold_param_ = p; + } + return threshold_param_; +} +inline ::caffe::ThresholdParameter* V1LayerParameter::mutable_threshold_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.threshold_param) + return _internal_mutable_threshold_param(); +} +inline void V1LayerParameter::set_allocated_threshold_param(::caffe::ThresholdParameter* threshold_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete threshold_param_; + } + if (threshold_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(threshold_param); + if (message_arena != submessage_arena) { + threshold_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, threshold_param, submessage_arena); + } + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + threshold_param_ = threshold_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.threshold_param) +} + +// optional .caffe.WindowDataParameter window_data_param = 20; +inline bool V1LayerParameter::_internal_has_window_data_param() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + PROTOBUF_ASSUME(!value || window_data_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_window_data_param() const { + return _internal_has_window_data_param(); +} +inline void V1LayerParameter::clear_window_data_param() { + if (window_data_param_ != nullptr) window_data_param_->Clear(); + _has_bits_[0] &= ~0x00002000u; +} +inline const ::caffe::WindowDataParameter& V1LayerParameter::_internal_window_data_param() const { + const ::caffe::WindowDataParameter* p = window_data_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_WindowDataParameter_default_instance_); +} +inline const ::caffe::WindowDataParameter& V1LayerParameter::window_data_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.window_data_param) + return _internal_window_data_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_window_data_param( + ::caffe::WindowDataParameter* window_data_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(window_data_param_); + } + window_data_param_ = window_data_param; + if (window_data_param) { + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.window_data_param) +} +inline ::caffe::WindowDataParameter* V1LayerParameter::release_window_data_param() { + auto temp = unsafe_arena_release_window_data_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::WindowDataParameter* V1LayerParameter::unsafe_arena_release_window_data_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.window_data_param) + _has_bits_[0] &= ~0x00002000u; + ::caffe::WindowDataParameter* temp = window_data_param_; + window_data_param_ = nullptr; + return temp; +} +inline ::caffe::WindowDataParameter* V1LayerParameter::_internal_mutable_window_data_param() { + _has_bits_[0] |= 0x00002000u; + if (window_data_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::WindowDataParameter>(GetArena()); + window_data_param_ = p; + } + return window_data_param_; +} +inline ::caffe::WindowDataParameter* V1LayerParameter::mutable_window_data_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.window_data_param) + return _internal_mutable_window_data_param(); +} +inline void V1LayerParameter::set_allocated_window_data_param(::caffe::WindowDataParameter* window_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete window_data_param_; + } + if (window_data_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(window_data_param); + if (message_arena != submessage_arena) { + window_data_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, window_data_param, submessage_arena); + } + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + window_data_param_ = window_data_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.window_data_param) +} + +// optional .caffe.TransformationParameter transform_param = 36; +inline bool V1LayerParameter::_internal_has_transform_param() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + PROTOBUF_ASSUME(!value || transform_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_transform_param() const { + return _internal_has_transform_param(); +} +inline void V1LayerParameter::clear_transform_param() { + if (transform_param_ != nullptr) transform_param_->Clear(); + _has_bits_[0] &= ~0x02000000u; +} +inline const ::caffe::TransformationParameter& V1LayerParameter::_internal_transform_param() const { + const ::caffe::TransformationParameter* p = transform_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_TransformationParameter_default_instance_); +} +inline const ::caffe::TransformationParameter& V1LayerParameter::transform_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.transform_param) + return _internal_transform_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_transform_param( + ::caffe::TransformationParameter* transform_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(transform_param_); + } + transform_param_ = transform_param; + if (transform_param) { + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.transform_param) +} +inline ::caffe::TransformationParameter* V1LayerParameter::release_transform_param() { + auto temp = unsafe_arena_release_transform_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::TransformationParameter* V1LayerParameter::unsafe_arena_release_transform_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.transform_param) + _has_bits_[0] &= ~0x02000000u; + ::caffe::TransformationParameter* temp = transform_param_; + transform_param_ = nullptr; + return temp; +} +inline ::caffe::TransformationParameter* V1LayerParameter::_internal_mutable_transform_param() { + _has_bits_[0] |= 0x02000000u; + if (transform_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::TransformationParameter>(GetArena()); + transform_param_ = p; + } + return transform_param_; +} +inline ::caffe::TransformationParameter* V1LayerParameter::mutable_transform_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.transform_param) + return _internal_mutable_transform_param(); +} +inline void V1LayerParameter::set_allocated_transform_param(::caffe::TransformationParameter* transform_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete transform_param_; + } + if (transform_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(transform_param); + if (message_arena != submessage_arena) { + transform_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, transform_param, submessage_arena); + } + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + transform_param_ = transform_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.transform_param) +} + +// optional .caffe.LossParameter loss_param = 42; +inline bool V1LayerParameter::_internal_has_loss_param() const { + bool value = (_has_bits_[0] & 0x80000000u) != 0; + PROTOBUF_ASSUME(!value || loss_param_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_loss_param() const { + return _internal_has_loss_param(); +} +inline void V1LayerParameter::clear_loss_param() { + if (loss_param_ != nullptr) loss_param_->Clear(); + _has_bits_[0] &= ~0x80000000u; +} +inline const ::caffe::LossParameter& V1LayerParameter::_internal_loss_param() const { + const ::caffe::LossParameter* p = loss_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_LossParameter_default_instance_); +} +inline const ::caffe::LossParameter& V1LayerParameter::loss_param() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.loss_param) + return _internal_loss_param(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_loss_param( + ::caffe::LossParameter* loss_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(loss_param_); + } + loss_param_ = loss_param; + if (loss_param) { + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.loss_param) +} +inline ::caffe::LossParameter* V1LayerParameter::release_loss_param() { + auto temp = unsafe_arena_release_loss_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::LossParameter* V1LayerParameter::unsafe_arena_release_loss_param() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.loss_param) + _has_bits_[0] &= ~0x80000000u; + ::caffe::LossParameter* temp = loss_param_; + loss_param_ = nullptr; + return temp; +} +inline ::caffe::LossParameter* V1LayerParameter::_internal_mutable_loss_param() { + _has_bits_[0] |= 0x80000000u; + if (loss_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::LossParameter>(GetArena()); + loss_param_ = p; + } + return loss_param_; +} +inline ::caffe::LossParameter* V1LayerParameter::mutable_loss_param() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.loss_param) + return _internal_mutable_loss_param(); +} +inline void V1LayerParameter::set_allocated_loss_param(::caffe::LossParameter* loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete loss_param_; + } + if (loss_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(loss_param); + if (message_arena != submessage_arena) { + loss_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, loss_param, submessage_arena); + } + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + loss_param_ = loss_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.loss_param) +} + +// optional .caffe.V0LayerParameter layer = 1; +inline bool V1LayerParameter::_internal_has_layer() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || layer_ != nullptr); + return value; +} +inline bool V1LayerParameter::has_layer() const { + return _internal_has_layer(); +} +inline void V1LayerParameter::clear_layer() { + if (layer_ != nullptr) layer_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::caffe::V0LayerParameter& V1LayerParameter::_internal_layer() const { + const ::caffe::V0LayerParameter* p = layer_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_V0LayerParameter_default_instance_); +} +inline const ::caffe::V0LayerParameter& V1LayerParameter::layer() const { + // @@protoc_insertion_point(field_get:caffe.V1LayerParameter.layer) + return _internal_layer(); +} +inline void V1LayerParameter::unsafe_arena_set_allocated_layer( + ::caffe::V0LayerParameter* layer) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(layer_); + } + layer_ = layer; + if (layer) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V1LayerParameter.layer) +} +inline ::caffe::V0LayerParameter* V1LayerParameter::release_layer() { + auto temp = unsafe_arena_release_layer(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::V0LayerParameter* V1LayerParameter::unsafe_arena_release_layer() { + // @@protoc_insertion_point(field_release:caffe.V1LayerParameter.layer) + _has_bits_[0] &= ~0x00000002u; + ::caffe::V0LayerParameter* temp = layer_; + layer_ = nullptr; + return temp; +} +inline ::caffe::V0LayerParameter* V1LayerParameter::_internal_mutable_layer() { + _has_bits_[0] |= 0x00000002u; + if (layer_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::V0LayerParameter>(GetArena()); + layer_ = p; + } + return layer_; +} +inline ::caffe::V0LayerParameter* V1LayerParameter::mutable_layer() { + // @@protoc_insertion_point(field_mutable:caffe.V1LayerParameter.layer) + return _internal_mutable_layer(); +} +inline void V1LayerParameter::set_allocated_layer(::caffe::V0LayerParameter* layer) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete layer_; + } + if (layer) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(layer); + if (message_arena != submessage_arena) { + layer = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, layer, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + layer_ = layer; + // @@protoc_insertion_point(field_set_allocated:caffe.V1LayerParameter.layer) +} + +// ------------------------------------------------------------------- + +// V0LayerParameter + +// optional string name = 1; +inline bool V0LayerParameter::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool V0LayerParameter::has_name() const { + return _internal_has_name(); +} +inline void V0LayerParameter::clear_name() { + name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& V0LayerParameter::name() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.name) + return _internal_name(); +} +inline void V0LayerParameter::set_name(const std::string& value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.name) +} +inline std::string* V0LayerParameter::mutable_name() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.name) + return _internal_mutable_name(); +} +inline const std::string& V0LayerParameter::_internal_name() const { + return name_.Get(); +} +inline void V0LayerParameter::_internal_set_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void V0LayerParameter::set_name(std::string&& value) { + _has_bits_[0] |= 0x00000001u; + name_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V0LayerParameter.name) +} +inline void V0LayerParameter::set_name(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V0LayerParameter.name) +} +inline void V0LayerParameter::set_name(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000001u; + name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V0LayerParameter.name) +} +inline std::string* V0LayerParameter::_internal_mutable_name() { + _has_bits_[0] |= 0x00000001u; + return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* V0LayerParameter::release_name() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.name) + if (!_internal_has_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void V0LayerParameter::set_allocated_name(std::string* name) { + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.name) +} +inline std::string* V0LayerParameter::unsafe_arena_release_name() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V0LayerParameter.name) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000001u; + return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_name( + std::string* name) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + name, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.name) +} + +// optional string type = 2; +inline bool V0LayerParameter::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool V0LayerParameter::has_type() const { + return _internal_has_type(); +} +inline void V0LayerParameter::clear_type() { + type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& V0LayerParameter::type() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.type) + return _internal_type(); +} +inline void V0LayerParameter::set_type(const std::string& value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.type) +} +inline std::string* V0LayerParameter::mutable_type() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.type) + return _internal_mutable_type(); +} +inline const std::string& V0LayerParameter::_internal_type() const { + return type_.Get(); +} +inline void V0LayerParameter::_internal_set_type(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void V0LayerParameter::set_type(std::string&& value) { + _has_bits_[0] |= 0x00000002u; + type_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V0LayerParameter.type) +} +inline void V0LayerParameter::set_type(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V0LayerParameter.type) +} +inline void V0LayerParameter::set_type(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000002u; + type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V0LayerParameter.type) +} +inline std::string* V0LayerParameter::_internal_mutable_type() { + _has_bits_[0] |= 0x00000002u; + return type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* V0LayerParameter::release_type() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.type) + if (!_internal_has_type()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + return type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void V0LayerParameter::set_allocated_type(std::string* type) { + if (type != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.type) +} +inline std::string* V0LayerParameter::unsafe_arena_release_type() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V0LayerParameter.type) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000002u; + return type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_type( + std::string* type) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (type != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + type, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.type) +} + +// optional uint32 num_output = 3; +inline bool V0LayerParameter::_internal_has_num_output() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool V0LayerParameter::has_num_output() const { + return _internal_has_num_output(); +} +inline void V0LayerParameter::clear_num_output() { + num_output_ = 0u; + _has_bits_[0] &= ~0x00000100u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_num_output() const { + return num_output_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::num_output() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.num_output) + return _internal_num_output(); +} +inline void V0LayerParameter::_internal_set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000100u; + num_output_ = value; +} +inline void V0LayerParameter::set_num_output(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_num_output(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.num_output) +} + +// optional bool biasterm = 4 [default = true]; +inline bool V0LayerParameter::_internal_has_biasterm() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + return value; +} +inline bool V0LayerParameter::has_biasterm() const { + return _internal_has_biasterm(); +} +inline void V0LayerParameter::clear_biasterm() { + biasterm_ = true; + _has_bits_[0] &= ~0x00800000u; +} +inline bool V0LayerParameter::_internal_biasterm() const { + return biasterm_; +} +inline bool V0LayerParameter::biasterm() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.biasterm) + return _internal_biasterm(); +} +inline void V0LayerParameter::_internal_set_biasterm(bool value) { + _has_bits_[0] |= 0x00800000u; + biasterm_ = value; +} +inline void V0LayerParameter::set_biasterm(bool value) { + _internal_set_biasterm(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.biasterm) +} + +// optional .caffe.FillerParameter weight_filler = 5; +inline bool V0LayerParameter::_internal_has_weight_filler() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || weight_filler_ != nullptr); + return value; +} +inline bool V0LayerParameter::has_weight_filler() const { + return _internal_has_weight_filler(); +} +inline void V0LayerParameter::clear_weight_filler() { + if (weight_filler_ != nullptr) weight_filler_->Clear(); + _has_bits_[0] &= ~0x00000020u; +} +inline const ::caffe::FillerParameter& V0LayerParameter::_internal_weight_filler() const { + const ::caffe::FillerParameter* p = weight_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& V0LayerParameter::weight_filler() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.weight_filler) + return _internal_weight_filler(); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_weight_filler( + ::caffe::FillerParameter* weight_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(weight_filler_); + } + weight_filler_ = weight_filler; + if (weight_filler) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.weight_filler) +} +inline ::caffe::FillerParameter* V0LayerParameter::release_weight_filler() { + auto temp = unsafe_arena_release_weight_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* V0LayerParameter::unsafe_arena_release_weight_filler() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.weight_filler) + _has_bits_[0] &= ~0x00000020u; + ::caffe::FillerParameter* temp = weight_filler_; + weight_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* V0LayerParameter::_internal_mutable_weight_filler() { + _has_bits_[0] |= 0x00000020u; + if (weight_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + weight_filler_ = p; + } + return weight_filler_; +} +inline ::caffe::FillerParameter* V0LayerParameter::mutable_weight_filler() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.weight_filler) + return _internal_mutable_weight_filler(); +} +inline void V0LayerParameter::set_allocated_weight_filler(::caffe::FillerParameter* weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete weight_filler_; + } + if (weight_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(weight_filler); + if (message_arena != submessage_arena) { + weight_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, weight_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + weight_filler_ = weight_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.weight_filler) +} + +// optional .caffe.FillerParameter bias_filler = 6; +inline bool V0LayerParameter::_internal_has_bias_filler() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || bias_filler_ != nullptr); + return value; +} +inline bool V0LayerParameter::has_bias_filler() const { + return _internal_has_bias_filler(); +} +inline void V0LayerParameter::clear_bias_filler() { + if (bias_filler_ != nullptr) bias_filler_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::caffe::FillerParameter& V0LayerParameter::_internal_bias_filler() const { + const ::caffe::FillerParameter* p = bias_filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& V0LayerParameter::bias_filler() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.bias_filler) + return _internal_bias_filler(); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_bias_filler( + ::caffe::FillerParameter* bias_filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bias_filler_); + } + bias_filler_ = bias_filler; + if (bias_filler) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.bias_filler) +} +inline ::caffe::FillerParameter* V0LayerParameter::release_bias_filler() { + auto temp = unsafe_arena_release_bias_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* V0LayerParameter::unsafe_arena_release_bias_filler() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.bias_filler) + _has_bits_[0] &= ~0x00000040u; + ::caffe::FillerParameter* temp = bias_filler_; + bias_filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* V0LayerParameter::_internal_mutable_bias_filler() { + _has_bits_[0] |= 0x00000040u; + if (bias_filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + bias_filler_ = p; + } + return bias_filler_; +} +inline ::caffe::FillerParameter* V0LayerParameter::mutable_bias_filler() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.bias_filler) + return _internal_mutable_bias_filler(); +} +inline void V0LayerParameter::set_allocated_bias_filler(::caffe::FillerParameter* bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete bias_filler_; + } + if (bias_filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(bias_filler); + if (message_arena != submessage_arena) { + bias_filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bias_filler, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + bias_filler_ = bias_filler; + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.bias_filler) +} + +// optional uint32 pad = 7 [default = 0]; +inline bool V0LayerParameter::_internal_has_pad() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool V0LayerParameter::has_pad() const { + return _internal_has_pad(); +} +inline void V0LayerParameter::clear_pad() { + pad_ = 0u; + _has_bits_[0] &= ~0x00000200u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_pad() const { + return pad_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::pad() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.pad) + return _internal_pad(); +} +inline void V0LayerParameter::_internal_set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000200u; + pad_ = value; +} +inline void V0LayerParameter::set_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_pad(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.pad) +} + +// optional uint32 kernelsize = 8; +inline bool V0LayerParameter::_internal_has_kernelsize() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool V0LayerParameter::has_kernelsize() const { + return _internal_has_kernelsize(); +} +inline void V0LayerParameter::clear_kernelsize() { + kernelsize_ = 0u; + _has_bits_[0] &= ~0x00000400u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_kernelsize() const { + return kernelsize_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::kernelsize() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.kernelsize) + return _internal_kernelsize(); +} +inline void V0LayerParameter::_internal_set_kernelsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00000400u; + kernelsize_ = value; +} +inline void V0LayerParameter::set_kernelsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_kernelsize(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.kernelsize) +} + +// optional uint32 group = 9 [default = 1]; +inline bool V0LayerParameter::_internal_has_group() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_group() const { + return _internal_has_group(); +} +inline void V0LayerParameter::clear_group() { + group_ = 1u; + _has_bits_[0] &= ~0x01000000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_group() const { + return group_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::group() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.group) + return _internal_group(); +} +inline void V0LayerParameter::_internal_set_group(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x01000000u; + group_ = value; +} +inline void V0LayerParameter::set_group(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_group(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.group) +} + +// optional uint32 stride = 10 [default = 1]; +inline bool V0LayerParameter::_internal_has_stride() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_stride() const { + return _internal_has_stride(); +} +inline void V0LayerParameter::clear_stride() { + stride_ = 1u; + _has_bits_[0] &= ~0x02000000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_stride() const { + return stride_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::stride() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.stride) + return _internal_stride(); +} +inline void V0LayerParameter::_internal_set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x02000000u; + stride_ = value; +} +inline void V0LayerParameter::set_stride(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_stride(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.stride) +} + +// optional .caffe.V0LayerParameter.PoolMethod pool = 11 [default = MAX]; +inline bool V0LayerParameter::_internal_has_pool() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool V0LayerParameter::has_pool() const { + return _internal_has_pool(); +} +inline void V0LayerParameter::clear_pool() { + pool_ = 0; + _has_bits_[0] &= ~0x00000800u; +} +inline ::caffe::V0LayerParameter_PoolMethod V0LayerParameter::_internal_pool() const { + return static_cast< ::caffe::V0LayerParameter_PoolMethod >(pool_); +} +inline ::caffe::V0LayerParameter_PoolMethod V0LayerParameter::pool() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.pool) + return _internal_pool(); +} +inline void V0LayerParameter::_internal_set_pool(::caffe::V0LayerParameter_PoolMethod value) { + assert(::caffe::V0LayerParameter_PoolMethod_IsValid(value)); + _has_bits_[0] |= 0x00000800u; + pool_ = value; +} +inline void V0LayerParameter::set_pool(::caffe::V0LayerParameter_PoolMethod value) { + _internal_set_pool(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.pool) +} + +// optional float dropout_ratio = 12 [default = 0.5]; +inline bool V0LayerParameter::_internal_has_dropout_ratio() const { + bool value = (_has_bits_[0] & 0x04000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_dropout_ratio() const { + return _internal_has_dropout_ratio(); +} +inline void V0LayerParameter::clear_dropout_ratio() { + dropout_ratio_ = 0.5f; + _has_bits_[0] &= ~0x04000000u; +} +inline float V0LayerParameter::_internal_dropout_ratio() const { + return dropout_ratio_; +} +inline float V0LayerParameter::dropout_ratio() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.dropout_ratio) + return _internal_dropout_ratio(); +} +inline void V0LayerParameter::_internal_set_dropout_ratio(float value) { + _has_bits_[0] |= 0x04000000u; + dropout_ratio_ = value; +} +inline void V0LayerParameter::set_dropout_ratio(float value) { + _internal_set_dropout_ratio(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.dropout_ratio) +} + +// optional uint32 local_size = 13 [default = 5]; +inline bool V0LayerParameter::_internal_has_local_size() const { + bool value = (_has_bits_[0] & 0x08000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_local_size() const { + return _internal_has_local_size(); +} +inline void V0LayerParameter::clear_local_size() { + local_size_ = 5u; + _has_bits_[0] &= ~0x08000000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_local_size() const { + return local_size_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::local_size() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.local_size) + return _internal_local_size(); +} +inline void V0LayerParameter::_internal_set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x08000000u; + local_size_ = value; +} +inline void V0LayerParameter::set_local_size(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_local_size(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.local_size) +} + +// optional float alpha = 14 [default = 1]; +inline bool V0LayerParameter::_internal_has_alpha() const { + bool value = (_has_bits_[0] & 0x10000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_alpha() const { + return _internal_has_alpha(); +} +inline void V0LayerParameter::clear_alpha() { + alpha_ = 1; + _has_bits_[0] &= ~0x10000000u; +} +inline float V0LayerParameter::_internal_alpha() const { + return alpha_; +} +inline float V0LayerParameter::alpha() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.alpha) + return _internal_alpha(); +} +inline void V0LayerParameter::_internal_set_alpha(float value) { + _has_bits_[0] |= 0x10000000u; + alpha_ = value; +} +inline void V0LayerParameter::set_alpha(float value) { + _internal_set_alpha(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.alpha) +} + +// optional float beta = 15 [default = 0.75]; +inline bool V0LayerParameter::_internal_has_beta() const { + bool value = (_has_bits_[0] & 0x20000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_beta() const { + return _internal_has_beta(); +} +inline void V0LayerParameter::clear_beta() { + beta_ = 0.75f; + _has_bits_[0] &= ~0x20000000u; +} +inline float V0LayerParameter::_internal_beta() const { + return beta_; +} +inline float V0LayerParameter::beta() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.beta) + return _internal_beta(); +} +inline void V0LayerParameter::_internal_set_beta(float value) { + _has_bits_[0] |= 0x20000000u; + beta_ = value; +} +inline void V0LayerParameter::set_beta(float value) { + _internal_set_beta(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.beta) +} + +// optional float k = 22 [default = 1]; +inline bool V0LayerParameter::_internal_has_k() const { + bool value = (_has_bits_[0] & 0x80000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_k() const { + return _internal_has_k(); +} +inline void V0LayerParameter::clear_k() { + k_ = 1; + _has_bits_[0] &= ~0x80000000u; +} +inline float V0LayerParameter::_internal_k() const { + return k_; +} +inline float V0LayerParameter::k() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.k) + return _internal_k(); +} +inline void V0LayerParameter::_internal_set_k(float value) { + _has_bits_[0] |= 0x80000000u; + k_ = value; +} +inline void V0LayerParameter::set_k(float value) { + _internal_set_k(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.k) +} + +// optional string source = 16; +inline bool V0LayerParameter::_internal_has_source() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool V0LayerParameter::has_source() const { + return _internal_has_source(); +} +inline void V0LayerParameter::clear_source() { + source_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& V0LayerParameter::source() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.source) + return _internal_source(); +} +inline void V0LayerParameter::set_source(const std::string& value) { + _internal_set_source(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.source) +} +inline std::string* V0LayerParameter::mutable_source() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.source) + return _internal_mutable_source(); +} +inline const std::string& V0LayerParameter::_internal_source() const { + return source_.Get(); +} +inline void V0LayerParameter::_internal_set_source(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void V0LayerParameter::set_source(std::string&& value) { + _has_bits_[0] |= 0x00000004u; + source_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V0LayerParameter.source) +} +inline void V0LayerParameter::set_source(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000004u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V0LayerParameter.source) +} +inline void V0LayerParameter::set_source(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000004u; + source_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V0LayerParameter.source) +} +inline std::string* V0LayerParameter::_internal_mutable_source() { + _has_bits_[0] |= 0x00000004u; + return source_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* V0LayerParameter::release_source() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.source) + if (!_internal_has_source()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + return source_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void V0LayerParameter::set_allocated_source(std::string* source) { + if (source != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + source_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.source) +} +inline std::string* V0LayerParameter::unsafe_arena_release_source() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V0LayerParameter.source) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000004u; + return source_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_source( + std::string* source) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (source != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + source_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + source, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.source) +} + +// optional float scale = 17 [default = 1]; +inline bool V0LayerParameter::_internal_has_scale() const { + bool value = (_has_bits_[0] & 0x40000000u) != 0; + return value; +} +inline bool V0LayerParameter::has_scale() const { + return _internal_has_scale(); +} +inline void V0LayerParameter::clear_scale() { + scale_ = 1; + _has_bits_[0] &= ~0x40000000u; +} +inline float V0LayerParameter::_internal_scale() const { + return scale_; +} +inline float V0LayerParameter::scale() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.scale) + return _internal_scale(); +} +inline void V0LayerParameter::_internal_set_scale(float value) { + _has_bits_[0] |= 0x40000000u; + scale_ = value; +} +inline void V0LayerParameter::set_scale(float value) { + _internal_set_scale(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.scale) +} + +// optional string meanfile = 18; +inline bool V0LayerParameter::_internal_has_meanfile() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool V0LayerParameter::has_meanfile() const { + return _internal_has_meanfile(); +} +inline void V0LayerParameter::clear_meanfile() { + meanfile_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); + _has_bits_[0] &= ~0x00000008u; +} +inline const std::string& V0LayerParameter::meanfile() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.meanfile) + return _internal_meanfile(); +} +inline void V0LayerParameter::set_meanfile(const std::string& value) { + _internal_set_meanfile(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.meanfile) +} +inline std::string* V0LayerParameter::mutable_meanfile() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.meanfile) + return _internal_mutable_meanfile(); +} +inline const std::string& V0LayerParameter::_internal_meanfile() const { + return meanfile_.Get(); +} +inline void V0LayerParameter::_internal_set_meanfile(const std::string& value) { + _has_bits_[0] |= 0x00000008u; + meanfile_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArena()); +} +inline void V0LayerParameter::set_meanfile(std::string&& value) { + _has_bits_[0] |= 0x00000008u; + meanfile_.Set( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V0LayerParameter.meanfile) +} +inline void V0LayerParameter::set_meanfile(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000008u; + meanfile_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V0LayerParameter.meanfile) +} +inline void V0LayerParameter::set_meanfile(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000008u; + meanfile_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V0LayerParameter.meanfile) +} +inline std::string* V0LayerParameter::_internal_mutable_meanfile() { + _has_bits_[0] |= 0x00000008u; + return meanfile_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline std::string* V0LayerParameter::release_meanfile() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.meanfile) + if (!_internal_has_meanfile()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000008u; + return meanfile_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); +} +inline void V0LayerParameter::set_allocated_meanfile(std::string* meanfile) { + if (meanfile != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + meanfile_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), meanfile, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.meanfile) +} +inline std::string* V0LayerParameter::unsafe_arena_release_meanfile() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V0LayerParameter.meanfile) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000008u; + return meanfile_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + GetArena()); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_meanfile( + std::string* meanfile) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (meanfile != nullptr) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + meanfile_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + meanfile, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.meanfile) +} + +// optional uint32 batchsize = 19; +inline bool V0LayerParameter::_internal_has_batchsize() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool V0LayerParameter::has_batchsize() const { + return _internal_has_batchsize(); +} +inline void V0LayerParameter::clear_batchsize() { + batchsize_ = 0u; + _has_bits_[0] &= ~0x00001000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_batchsize() const { + return batchsize_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::batchsize() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.batchsize) + return _internal_batchsize(); +} +inline void V0LayerParameter::_internal_set_batchsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00001000u; + batchsize_ = value; +} +inline void V0LayerParameter::set_batchsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_batchsize(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.batchsize) +} + +// optional uint32 cropsize = 20 [default = 0]; +inline bool V0LayerParameter::_internal_has_cropsize() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + return value; +} +inline bool V0LayerParameter::has_cropsize() const { + return _internal_has_cropsize(); +} +inline void V0LayerParameter::clear_cropsize() { + cropsize_ = 0u; + _has_bits_[0] &= ~0x00002000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_cropsize() const { + return cropsize_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::cropsize() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.cropsize) + return _internal_cropsize(); +} +inline void V0LayerParameter::_internal_set_cropsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00002000u; + cropsize_ = value; +} +inline void V0LayerParameter::set_cropsize(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_cropsize(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.cropsize) +} + +// optional bool mirror = 21 [default = false]; +inline bool V0LayerParameter::_internal_has_mirror() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + return value; +} +inline bool V0LayerParameter::has_mirror() const { + return _internal_has_mirror(); +} +inline void V0LayerParameter::clear_mirror() { + mirror_ = false; + _has_bits_[0] &= ~0x00008000u; +} +inline bool V0LayerParameter::_internal_mirror() const { + return mirror_; +} +inline bool V0LayerParameter::mirror() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.mirror) + return _internal_mirror(); +} +inline void V0LayerParameter::_internal_set_mirror(bool value) { + _has_bits_[0] |= 0x00008000u; + mirror_ = value; +} +inline void V0LayerParameter::set_mirror(bool value) { + _internal_set_mirror(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.mirror) +} + +// repeated .caffe.BlobProto blobs = 50; +inline int V0LayerParameter::_internal_blobs_size() const { + return blobs_.size(); +} +inline int V0LayerParameter::blobs_size() const { + return _internal_blobs_size(); +} +inline void V0LayerParameter::clear_blobs() { + blobs_.Clear(); +} +inline ::caffe::BlobProto* V0LayerParameter::mutable_blobs(int index) { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.blobs) + return blobs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >* +V0LayerParameter::mutable_blobs() { + // @@protoc_insertion_point(field_mutable_list:caffe.V0LayerParameter.blobs) + return &blobs_; +} +inline const ::caffe::BlobProto& V0LayerParameter::_internal_blobs(int index) const { + return blobs_.Get(index); +} +inline const ::caffe::BlobProto& V0LayerParameter::blobs(int index) const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.blobs) + return _internal_blobs(index); +} +inline ::caffe::BlobProto* V0LayerParameter::_internal_add_blobs() { + return blobs_.Add(); +} +inline ::caffe::BlobProto* V0LayerParameter::add_blobs() { + // @@protoc_insertion_point(field_add:caffe.V0LayerParameter.blobs) + return _internal_add_blobs(); +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::caffe::BlobProto >& +V0LayerParameter::blobs() const { + // @@protoc_insertion_point(field_list:caffe.V0LayerParameter.blobs) + return blobs_; +} + +// repeated float blobs_lr = 51; +inline int V0LayerParameter::_internal_blobs_lr_size() const { + return blobs_lr_.size(); +} +inline int V0LayerParameter::blobs_lr_size() const { + return _internal_blobs_lr_size(); +} +inline void V0LayerParameter::clear_blobs_lr() { + blobs_lr_.Clear(); +} +inline float V0LayerParameter::_internal_blobs_lr(int index) const { + return blobs_lr_.Get(index); +} +inline float V0LayerParameter::blobs_lr(int index) const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.blobs_lr) + return _internal_blobs_lr(index); +} +inline void V0LayerParameter::set_blobs_lr(int index, float value) { + blobs_lr_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.blobs_lr) +} +inline void V0LayerParameter::_internal_add_blobs_lr(float value) { + blobs_lr_.Add(value); +} +inline void V0LayerParameter::add_blobs_lr(float value) { + _internal_add_blobs_lr(value); + // @@protoc_insertion_point(field_add:caffe.V0LayerParameter.blobs_lr) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V0LayerParameter::_internal_blobs_lr() const { + return blobs_lr_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V0LayerParameter::blobs_lr() const { + // @@protoc_insertion_point(field_list:caffe.V0LayerParameter.blobs_lr) + return _internal_blobs_lr(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V0LayerParameter::_internal_mutable_blobs_lr() { + return &blobs_lr_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V0LayerParameter::mutable_blobs_lr() { + // @@protoc_insertion_point(field_mutable_list:caffe.V0LayerParameter.blobs_lr) + return _internal_mutable_blobs_lr(); +} + +// repeated float weight_decay = 52; +inline int V0LayerParameter::_internal_weight_decay_size() const { + return weight_decay_.size(); +} +inline int V0LayerParameter::weight_decay_size() const { + return _internal_weight_decay_size(); +} +inline void V0LayerParameter::clear_weight_decay() { + weight_decay_.Clear(); +} +inline float V0LayerParameter::_internal_weight_decay(int index) const { + return weight_decay_.Get(index); +} +inline float V0LayerParameter::weight_decay(int index) const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.weight_decay) + return _internal_weight_decay(index); +} +inline void V0LayerParameter::set_weight_decay(int index, float value) { + weight_decay_.Set(index, value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.weight_decay) +} +inline void V0LayerParameter::_internal_add_weight_decay(float value) { + weight_decay_.Add(value); +} +inline void V0LayerParameter::add_weight_decay(float value) { + _internal_add_weight_decay(value); + // @@protoc_insertion_point(field_add:caffe.V0LayerParameter.weight_decay) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V0LayerParameter::_internal_weight_decay() const { + return weight_decay_; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& +V0LayerParameter::weight_decay() const { + // @@protoc_insertion_point(field_list:caffe.V0LayerParameter.weight_decay) + return _internal_weight_decay(); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V0LayerParameter::_internal_mutable_weight_decay() { + return &weight_decay_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* +V0LayerParameter::mutable_weight_decay() { + // @@protoc_insertion_point(field_mutable_list:caffe.V0LayerParameter.weight_decay) + return _internal_mutable_weight_decay(); +} + +// optional uint32 rand_skip = 53 [default = 0]; +inline bool V0LayerParameter::_internal_has_rand_skip() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + return value; +} +inline bool V0LayerParameter::has_rand_skip() const { + return _internal_has_rand_skip(); +} +inline void V0LayerParameter::clear_rand_skip() { + rand_skip_ = 0u; + _has_bits_[0] &= ~0x00020000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_rand_skip() const { + return rand_skip_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::rand_skip() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.rand_skip) + return _internal_rand_skip(); +} +inline void V0LayerParameter::_internal_set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00020000u; + rand_skip_ = value; +} +inline void V0LayerParameter::set_rand_skip(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_rand_skip(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.rand_skip) +} + +// optional float det_fg_threshold = 54 [default = 0.5]; +inline bool V0LayerParameter::_internal_has_det_fg_threshold() const { + bool value = (_has_bits_[1] & 0x00000001u) != 0; + return value; +} +inline bool V0LayerParameter::has_det_fg_threshold() const { + return _internal_has_det_fg_threshold(); +} +inline void V0LayerParameter::clear_det_fg_threshold() { + det_fg_threshold_ = 0.5f; + _has_bits_[1] &= ~0x00000001u; +} +inline float V0LayerParameter::_internal_det_fg_threshold() const { + return det_fg_threshold_; +} +inline float V0LayerParameter::det_fg_threshold() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.det_fg_threshold) + return _internal_det_fg_threshold(); +} +inline void V0LayerParameter::_internal_set_det_fg_threshold(float value) { + _has_bits_[1] |= 0x00000001u; + det_fg_threshold_ = value; +} +inline void V0LayerParameter::set_det_fg_threshold(float value) { + _internal_set_det_fg_threshold(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.det_fg_threshold) +} + +// optional float det_bg_threshold = 55 [default = 0.5]; +inline bool V0LayerParameter::_internal_has_det_bg_threshold() const { + bool value = (_has_bits_[1] & 0x00000002u) != 0; + return value; +} +inline bool V0LayerParameter::has_det_bg_threshold() const { + return _internal_has_det_bg_threshold(); +} +inline void V0LayerParameter::clear_det_bg_threshold() { + det_bg_threshold_ = 0.5f; + _has_bits_[1] &= ~0x00000002u; +} +inline float V0LayerParameter::_internal_det_bg_threshold() const { + return det_bg_threshold_; +} +inline float V0LayerParameter::det_bg_threshold() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.det_bg_threshold) + return _internal_det_bg_threshold(); +} +inline void V0LayerParameter::_internal_set_det_bg_threshold(float value) { + _has_bits_[1] |= 0x00000002u; + det_bg_threshold_ = value; +} +inline void V0LayerParameter::set_det_bg_threshold(float value) { + _internal_set_det_bg_threshold(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.det_bg_threshold) +} + +// optional float det_fg_fraction = 56 [default = 0.25]; +inline bool V0LayerParameter::_internal_has_det_fg_fraction() const { + bool value = (_has_bits_[1] & 0x00000004u) != 0; + return value; +} +inline bool V0LayerParameter::has_det_fg_fraction() const { + return _internal_has_det_fg_fraction(); +} +inline void V0LayerParameter::clear_det_fg_fraction() { + det_fg_fraction_ = 0.25f; + _has_bits_[1] &= ~0x00000004u; +} +inline float V0LayerParameter::_internal_det_fg_fraction() const { + return det_fg_fraction_; +} +inline float V0LayerParameter::det_fg_fraction() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.det_fg_fraction) + return _internal_det_fg_fraction(); +} +inline void V0LayerParameter::_internal_set_det_fg_fraction(float value) { + _has_bits_[1] |= 0x00000004u; + det_fg_fraction_ = value; +} +inline void V0LayerParameter::set_det_fg_fraction(float value) { + _internal_set_det_fg_fraction(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.det_fg_fraction) +} + +// optional uint32 det_context_pad = 58 [default = 0]; +inline bool V0LayerParameter::_internal_has_det_context_pad() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + return value; +} +inline bool V0LayerParameter::has_det_context_pad() const { + return _internal_has_det_context_pad(); +} +inline void V0LayerParameter::clear_det_context_pad() { + det_context_pad_ = 0u; + _has_bits_[0] &= ~0x00040000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_det_context_pad() const { + return det_context_pad_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::det_context_pad() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.det_context_pad) + return _internal_det_context_pad(); +} +inline void V0LayerParameter::_internal_set_det_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00040000u; + det_context_pad_ = value; +} +inline void V0LayerParameter::set_det_context_pad(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_det_context_pad(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.det_context_pad) +} + +// optional string det_crop_mode = 59 [default = "warp"]; +inline bool V0LayerParameter::_internal_has_det_crop_mode() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool V0LayerParameter::has_det_crop_mode() const { + return _internal_has_det_crop_mode(); +} +inline void V0LayerParameter::clear_det_crop_mode() { + det_crop_mode_.ClearToDefault(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), GetArena()); + _has_bits_[0] &= ~0x00000010u; +} +inline const std::string& V0LayerParameter::det_crop_mode() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.det_crop_mode) + return _internal_det_crop_mode(); +} +inline void V0LayerParameter::set_det_crop_mode(const std::string& value) { + _internal_set_det_crop_mode(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.det_crop_mode) +} +inline std::string* V0LayerParameter::mutable_det_crop_mode() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.det_crop_mode) + return _internal_mutable_det_crop_mode(); +} +inline const std::string& V0LayerParameter::_internal_det_crop_mode() const { + return det_crop_mode_.Get(); +} +inline void V0LayerParameter::_internal_set_det_crop_mode(const std::string& value) { + _has_bits_[0] |= 0x00000010u; + det_crop_mode_.Set(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), value, GetArena()); +} +inline void V0LayerParameter::set_det_crop_mode(std::string&& value) { + _has_bits_[0] |= 0x00000010u; + det_crop_mode_.Set( + &::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), ::std::move(value), GetArena()); + // @@protoc_insertion_point(field_set_rvalue:caffe.V0LayerParameter.det_crop_mode) +} +inline void V0LayerParameter::set_det_crop_mode(const char* value) { + GOOGLE_DCHECK(value != nullptr); + _has_bits_[0] |= 0x00000010u; + det_crop_mode_.Set(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), ::std::string(value), + GetArena()); + // @@protoc_insertion_point(field_set_char:caffe.V0LayerParameter.det_crop_mode) +} +inline void V0LayerParameter::set_det_crop_mode(const char* value, + size_t size) { + _has_bits_[0] |= 0x00000010u; + det_crop_mode_.Set(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), ::std::string( + reinterpret_cast(value), size), GetArena()); + // @@protoc_insertion_point(field_set_pointer:caffe.V0LayerParameter.det_crop_mode) +} +inline std::string* V0LayerParameter::_internal_mutable_det_crop_mode() { + _has_bits_[0] |= 0x00000010u; + return det_crop_mode_.Mutable(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), GetArena()); +} +inline std::string* V0LayerParameter::release_det_crop_mode() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.det_crop_mode) + if (!_internal_has_det_crop_mode()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000010u; + return det_crop_mode_.ReleaseNonDefault(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), GetArena()); +} +inline void V0LayerParameter::set_allocated_det_crop_mode(std::string* det_crop_mode) { + if (det_crop_mode != nullptr) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + det_crop_mode_.SetAllocated(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), det_crop_mode, + GetArena()); + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.det_crop_mode) +} +inline std::string* V0LayerParameter::unsafe_arena_release_det_crop_mode() { + // @@protoc_insertion_point(field_unsafe_arena_release:caffe.V0LayerParameter.det_crop_mode) + GOOGLE_DCHECK(GetArena() != nullptr); + _has_bits_[0] &= ~0x00000010u; + return det_crop_mode_.UnsafeArenaRelease(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), + GetArena()); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_det_crop_mode( + std::string* det_crop_mode) { + GOOGLE_DCHECK(GetArena() != nullptr); + if (det_crop_mode != nullptr) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + det_crop_mode_.UnsafeArenaSetAllocated(&::caffe::V0LayerParameter::_i_give_permission_to_break_this_code_default_det_crop_mode_.get(), + det_crop_mode, GetArena()); + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.det_crop_mode) +} + +// optional int32 new_num = 60 [default = 0]; +inline bool V0LayerParameter::_internal_has_new_num() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + return value; +} +inline bool V0LayerParameter::has_new_num() const { + return _internal_has_new_num(); +} +inline void V0LayerParameter::clear_new_num() { + new_num_ = 0; + _has_bits_[0] &= ~0x00080000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::_internal_new_num() const { + return new_num_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::new_num() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.new_num) + return _internal_new_num(); +} +inline void V0LayerParameter::_internal_set_new_num(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00080000u; + new_num_ = value; +} +inline void V0LayerParameter::set_new_num(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_new_num(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.new_num) +} + +// optional int32 new_channels = 61 [default = 0]; +inline bool V0LayerParameter::_internal_has_new_channels() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + return value; +} +inline bool V0LayerParameter::has_new_channels() const { + return _internal_has_new_channels(); +} +inline void V0LayerParameter::clear_new_channels() { + new_channels_ = 0; + _has_bits_[0] &= ~0x00100000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::_internal_new_channels() const { + return new_channels_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::new_channels() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.new_channels) + return _internal_new_channels(); +} +inline void V0LayerParameter::_internal_set_new_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00100000u; + new_channels_ = value; +} +inline void V0LayerParameter::set_new_channels(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_new_channels(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.new_channels) +} + +// optional int32 new_height = 62 [default = 0]; +inline bool V0LayerParameter::_internal_has_new_height() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + return value; +} +inline bool V0LayerParameter::has_new_height() const { + return _internal_has_new_height(); +} +inline void V0LayerParameter::clear_new_height() { + new_height_ = 0; + _has_bits_[0] &= ~0x00200000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::_internal_new_height() const { + return new_height_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::new_height() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.new_height) + return _internal_new_height(); +} +inline void V0LayerParameter::_internal_set_new_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00200000u; + new_height_ = value; +} +inline void V0LayerParameter::set_new_height(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_new_height(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.new_height) +} + +// optional int32 new_width = 63 [default = 0]; +inline bool V0LayerParameter::_internal_has_new_width() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + return value; +} +inline bool V0LayerParameter::has_new_width() const { + return _internal_has_new_width(); +} +inline void V0LayerParameter::clear_new_width() { + new_width_ = 0; + _has_bits_[0] &= ~0x00004000u; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::_internal_new_width() const { + return new_width_; +} +inline ::PROTOBUF_NAMESPACE_ID::int32 V0LayerParameter::new_width() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.new_width) + return _internal_new_width(); +} +inline void V0LayerParameter::_internal_set_new_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _has_bits_[0] |= 0x00004000u; + new_width_ = value; +} +inline void V0LayerParameter::set_new_width(::PROTOBUF_NAMESPACE_ID::int32 value) { + _internal_set_new_width(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.new_width) +} + +// optional bool shuffle_images = 64 [default = false]; +inline bool V0LayerParameter::_internal_has_shuffle_images() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + return value; +} +inline bool V0LayerParameter::has_shuffle_images() const { + return _internal_has_shuffle_images(); +} +inline void V0LayerParameter::clear_shuffle_images() { + shuffle_images_ = false; + _has_bits_[0] &= ~0x00010000u; +} +inline bool V0LayerParameter::_internal_shuffle_images() const { + return shuffle_images_; +} +inline bool V0LayerParameter::shuffle_images() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.shuffle_images) + return _internal_shuffle_images(); +} +inline void V0LayerParameter::_internal_set_shuffle_images(bool value) { + _has_bits_[0] |= 0x00010000u; + shuffle_images_ = value; +} +inline void V0LayerParameter::set_shuffle_images(bool value) { + _internal_set_shuffle_images(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.shuffle_images) +} + +// optional uint32 concat_dim = 65 [default = 1]; +inline bool V0LayerParameter::_internal_has_concat_dim() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + return value; +} +inline bool V0LayerParameter::has_concat_dim() const { + return _internal_has_concat_dim(); +} +inline void V0LayerParameter::clear_concat_dim() { + concat_dim_ = 1u; + _has_bits_[0] &= ~0x00400000u; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::_internal_concat_dim() const { + return concat_dim_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint32 V0LayerParameter::concat_dim() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.concat_dim) + return _internal_concat_dim(); +} +inline void V0LayerParameter::_internal_set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _has_bits_[0] |= 0x00400000u; + concat_dim_ = value; +} +inline void V0LayerParameter::set_concat_dim(::PROTOBUF_NAMESPACE_ID::uint32 value) { + _internal_set_concat_dim(value); + // @@protoc_insertion_point(field_set:caffe.V0LayerParameter.concat_dim) +} + +// optional .caffe.HDF5OutputParameter hdf5_output_param = 1001; +inline bool V0LayerParameter::_internal_has_hdf5_output_param() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || hdf5_output_param_ != nullptr); + return value; +} +inline bool V0LayerParameter::has_hdf5_output_param() const { + return _internal_has_hdf5_output_param(); +} +inline void V0LayerParameter::clear_hdf5_output_param() { + if (hdf5_output_param_ != nullptr) hdf5_output_param_->Clear(); + _has_bits_[0] &= ~0x00000080u; +} +inline const ::caffe::HDF5OutputParameter& V0LayerParameter::_internal_hdf5_output_param() const { + const ::caffe::HDF5OutputParameter* p = hdf5_output_param_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_HDF5OutputParameter_default_instance_); +} +inline const ::caffe::HDF5OutputParameter& V0LayerParameter::hdf5_output_param() const { + // @@protoc_insertion_point(field_get:caffe.V0LayerParameter.hdf5_output_param) + return _internal_hdf5_output_param(); +} +inline void V0LayerParameter::unsafe_arena_set_allocated_hdf5_output_param( + ::caffe::HDF5OutputParameter* hdf5_output_param) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hdf5_output_param_); + } + hdf5_output_param_ = hdf5_output_param; + if (hdf5_output_param) { + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.V0LayerParameter.hdf5_output_param) +} +inline ::caffe::HDF5OutputParameter* V0LayerParameter::release_hdf5_output_param() { + auto temp = unsafe_arena_release_hdf5_output_param(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::HDF5OutputParameter* V0LayerParameter::unsafe_arena_release_hdf5_output_param() { + // @@protoc_insertion_point(field_release:caffe.V0LayerParameter.hdf5_output_param) + _has_bits_[0] &= ~0x00000080u; + ::caffe::HDF5OutputParameter* temp = hdf5_output_param_; + hdf5_output_param_ = nullptr; + return temp; +} +inline ::caffe::HDF5OutputParameter* V0LayerParameter::_internal_mutable_hdf5_output_param() { + _has_bits_[0] |= 0x00000080u; + if (hdf5_output_param_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::HDF5OutputParameter>(GetArena()); + hdf5_output_param_ = p; + } + return hdf5_output_param_; +} +inline ::caffe::HDF5OutputParameter* V0LayerParameter::mutable_hdf5_output_param() { + // @@protoc_insertion_point(field_mutable:caffe.V0LayerParameter.hdf5_output_param) + return _internal_mutable_hdf5_output_param(); +} +inline void V0LayerParameter::set_allocated_hdf5_output_param(::caffe::HDF5OutputParameter* hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete hdf5_output_param_; + } + if (hdf5_output_param) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(hdf5_output_param); + if (message_arena != submessage_arena) { + hdf5_output_param = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hdf5_output_param, submessage_arena); + } + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + hdf5_output_param_ = hdf5_output_param; + // @@protoc_insertion_point(field_set_allocated:caffe.V0LayerParameter.hdf5_output_param) +} + +// ------------------------------------------------------------------- + +// PReLUParameter + +// optional .caffe.FillerParameter filler = 1; +inline bool PReLUParameter::_internal_has_filler() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || filler_ != nullptr); + return value; +} +inline bool PReLUParameter::has_filler() const { + return _internal_has_filler(); +} +inline void PReLUParameter::clear_filler() { + if (filler_ != nullptr) filler_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::caffe::FillerParameter& PReLUParameter::_internal_filler() const { + const ::caffe::FillerParameter* p = filler_; + return p != nullptr ? *p : *reinterpret_cast( + &::caffe::_FillerParameter_default_instance_); +} +inline const ::caffe::FillerParameter& PReLUParameter::filler() const { + // @@protoc_insertion_point(field_get:caffe.PReLUParameter.filler) + return _internal_filler(); +} +inline void PReLUParameter::unsafe_arena_set_allocated_filler( + ::caffe::FillerParameter* filler) { + if (GetArena() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(filler_); + } + filler_ = filler; + if (filler) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:caffe.PReLUParameter.filler) +} +inline ::caffe::FillerParameter* PReLUParameter::release_filler() { + auto temp = unsafe_arena_release_filler(); + if (GetArena() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + return temp; +} +inline ::caffe::FillerParameter* PReLUParameter::unsafe_arena_release_filler() { + // @@protoc_insertion_point(field_release:caffe.PReLUParameter.filler) + _has_bits_[0] &= ~0x00000001u; + ::caffe::FillerParameter* temp = filler_; + filler_ = nullptr; + return temp; +} +inline ::caffe::FillerParameter* PReLUParameter::_internal_mutable_filler() { + _has_bits_[0] |= 0x00000001u; + if (filler_ == nullptr) { + auto* p = CreateMaybeMessage<::caffe::FillerParameter>(GetArena()); + filler_ = p; + } + return filler_; +} +inline ::caffe::FillerParameter* PReLUParameter::mutable_filler() { + // @@protoc_insertion_point(field_mutable:caffe.PReLUParameter.filler) + return _internal_mutable_filler(); +} +inline void PReLUParameter::set_allocated_filler(::caffe::FillerParameter* filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); + if (message_arena == nullptr) { + delete filler_; + } + if (filler) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(filler); + if (message_arena != submessage_arena) { + filler = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, filler, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + filler_ = filler; + // @@protoc_insertion_point(field_set_allocated:caffe.PReLUParameter.filler) +} + +// optional bool channel_shared = 2 [default = false]; +inline bool PReLUParameter::_internal_has_channel_shared() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool PReLUParameter::has_channel_shared() const { + return _internal_has_channel_shared(); +} +inline void PReLUParameter::clear_channel_shared() { + channel_shared_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool PReLUParameter::_internal_channel_shared() const { + return channel_shared_; +} +inline bool PReLUParameter::channel_shared() const { + // @@protoc_insertion_point(field_get:caffe.PReLUParameter.channel_shared) + return _internal_channel_shared(); +} +inline void PReLUParameter::_internal_set_channel_shared(bool value) { + _has_bits_[0] |= 0x00000002u; + channel_shared_ = value; +} +inline void PReLUParameter::set_channel_shared(bool value) { + _internal_set_channel_shared(value); + // @@protoc_insertion_point(field_set:caffe.PReLUParameter.channel_shared) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace caffe + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::caffe::FillerParameter_VarianceNorm> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::FillerParameter_VarianceNorm>() { + return ::caffe::FillerParameter_VarianceNorm_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SolverParameter_SnapshotFormat> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SolverParameter_SnapshotFormat>() { + return ::caffe::SolverParameter_SnapshotFormat_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SolverParameter_SolverMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SolverParameter_SolverMode>() { + return ::caffe::SolverParameter_SolverMode_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SolverParameter_SolverType> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SolverParameter_SolverType>() { + return ::caffe::SolverParameter_SolverType_descriptor(); +} +template <> struct is_proto_enum< ::caffe::ParamSpec_DimCheckMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::ParamSpec_DimCheckMode>() { + return ::caffe::ParamSpec_DimCheckMode_descriptor(); +} +template <> struct is_proto_enum< ::caffe::LossParameter_NormalizationMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::LossParameter_NormalizationMode>() { + return ::caffe::LossParameter_NormalizationMode_descriptor(); +} +template <> struct is_proto_enum< ::caffe::ConvolutionParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::ConvolutionParameter_Engine>() { + return ::caffe::ConvolutionParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::DataParameter_DB> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::DataParameter_DB>() { + return ::caffe::DataParameter_DB_descriptor(); +} +template <> struct is_proto_enum< ::caffe::EltwiseParameter_EltwiseOp> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::EltwiseParameter_EltwiseOp>() { + return ::caffe::EltwiseParameter_EltwiseOp_descriptor(); +} +template <> struct is_proto_enum< ::caffe::HingeLossParameter_Norm> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::HingeLossParameter_Norm>() { + return ::caffe::HingeLossParameter_Norm_descriptor(); +} +template <> struct is_proto_enum< ::caffe::LRNParameter_NormRegion> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::LRNParameter_NormRegion>() { + return ::caffe::LRNParameter_NormRegion_descriptor(); +} +template <> struct is_proto_enum< ::caffe::LRNParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::LRNParameter_Engine>() { + return ::caffe::LRNParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::PoolingParameter_PoolMethod> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::PoolingParameter_PoolMethod>() { + return ::caffe::PoolingParameter_PoolMethod_descriptor(); +} +template <> struct is_proto_enum< ::caffe::PoolingParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::PoolingParameter_Engine>() { + return ::caffe::PoolingParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::PoolingParameter_RoundMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::PoolingParameter_RoundMode>() { + return ::caffe::PoolingParameter_RoundMode_descriptor(); +} +template <> struct is_proto_enum< ::caffe::ReductionParameter_ReductionOp> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::ReductionParameter_ReductionOp>() { + return ::caffe::ReductionParameter_ReductionOp_descriptor(); +} +template <> struct is_proto_enum< ::caffe::ReLUParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::ReLUParameter_Engine>() { + return ::caffe::ReLUParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SigmoidParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SigmoidParameter_Engine>() { + return ::caffe::SigmoidParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SoftmaxParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SoftmaxParameter_Engine>() { + return ::caffe::SoftmaxParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::TanHParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::TanHParameter_Engine>() { + return ::caffe::TanHParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SPPParameter_PoolMethod> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SPPParameter_PoolMethod>() { + return ::caffe::SPPParameter_PoolMethod_descriptor(); +} +template <> struct is_proto_enum< ::caffe::SPPParameter_Engine> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::SPPParameter_Engine>() { + return ::caffe::SPPParameter_Engine_descriptor(); +} +template <> struct is_proto_enum< ::caffe::V1LayerParameter_LayerType> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::V1LayerParameter_LayerType>() { + return ::caffe::V1LayerParameter_LayerType_descriptor(); +} +template <> struct is_proto_enum< ::caffe::V1LayerParameter_DimCheckMode> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::V1LayerParameter_DimCheckMode>() { + return ::caffe::V1LayerParameter_DimCheckMode_descriptor(); +} +template <> struct is_proto_enum< ::caffe::V0LayerParameter_PoolMethod> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::V0LayerParameter_PoolMethod>() { + return ::caffe::V0LayerParameter_PoolMethod_descriptor(); +} +template <> struct is_proto_enum< ::caffe::Phase> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::caffe::Phase>() { + return ::caffe::Phase_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_caffe_2eproto diff --git a/usr/local/include/caffe/sgd_solvers.hpp b/usr/local/include/caffe/sgd_solvers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..925ff78331ebce8b1ef3ce2d7c00b571bb2dd769 --- /dev/null +++ b/usr/local/include/caffe/sgd_solvers.hpp @@ -0,0 +1,149 @@ +#ifndef CAFFE_SGD_SOLVERS_HPP_ +#define CAFFE_SGD_SOLVERS_HPP_ + +#include +#include + +#include "caffe/solver.hpp" + +namespace caffe { + +/** + * @brief Optimizes the parameters of a Net using + * stochastic gradient descent (SGD) with momentum. + */ +template +class SGDSolver : public Solver { + public: + explicit SGDSolver(const SolverParameter& param) + : Solver(param) { PreSolve(); } + explicit SGDSolver(const string& param_file) + : Solver(param_file) { PreSolve(); } + virtual inline const char* type() const { return "SGD"; } + + const vector > >& history() { return history_; } + + virtual void ApplyUpdate(); + Dtype GetLearningRate(); + + protected: + void PreSolve(); + virtual void Normalize(int param_id); + virtual void Regularize(int param_id); + virtual void ComputeUpdateValue(int param_id, Dtype rate); + virtual void ClipGradients(); + virtual void SnapshotSolverState(const string& model_filename); + virtual void SnapshotSolverStateToBinaryProto(const string& model_filename); + virtual void SnapshotSolverStateToHDF5(const string& model_filename); + virtual void RestoreSolverStateFromHDF5(const string& state_file); + virtual void RestoreSolverStateFromBinaryProto(const string& state_file); + // history maintains the historical momentum data. + // update maintains update related data and is not needed in snapshots. + // temp maintains other information that might be needed in computation + // of gradients/updates and is not needed in snapshots + vector > > history_, update_, temp_; + + DISABLE_COPY_AND_ASSIGN(SGDSolver); +}; + +template +class NesterovSolver : public SGDSolver { + public: + explicit NesterovSolver(const SolverParameter& param) + : SGDSolver(param) {} + explicit NesterovSolver(const string& param_file) + : SGDSolver(param_file) {} + virtual inline const char* type() const { return "Nesterov"; } + + protected: + virtual void ComputeUpdateValue(int param_id, Dtype rate); + + DISABLE_COPY_AND_ASSIGN(NesterovSolver); +}; + +template +class AdaGradSolver : public SGDSolver { + public: + explicit AdaGradSolver(const SolverParameter& param) + : SGDSolver(param) { constructor_sanity_check(); } + explicit AdaGradSolver(const string& param_file) + : SGDSolver(param_file) { constructor_sanity_check(); } + virtual inline const char* type() const { return "AdaGrad"; } + + protected: + virtual void ComputeUpdateValue(int param_id, Dtype rate); + void constructor_sanity_check() { + CHECK_EQ(0, this->param_.momentum()) + << "Momentum cannot be used with AdaGrad."; + } + + DISABLE_COPY_AND_ASSIGN(AdaGradSolver); +}; + + +template +class RMSPropSolver : public SGDSolver { + public: + explicit RMSPropSolver(const SolverParameter& param) + : SGDSolver(param) { constructor_sanity_check(); } + explicit RMSPropSolver(const string& param_file) + : SGDSolver(param_file) { constructor_sanity_check(); } + virtual inline const char* type() const { return "RMSProp"; } + + protected: + virtual void ComputeUpdateValue(int param_id, Dtype rate); + void constructor_sanity_check() { + CHECK_EQ(0, this->param_.momentum()) + << "Momentum cannot be used with RMSProp."; + CHECK_GE(this->param_.rms_decay(), 0) + << "rms_decay should lie between 0 and 1."; + CHECK_LT(this->param_.rms_decay(), 1) + << "rms_decay should lie between 0 and 1."; + } + + DISABLE_COPY_AND_ASSIGN(RMSPropSolver); +}; + +template +class AdaDeltaSolver : public SGDSolver { + public: + explicit AdaDeltaSolver(const SolverParameter& param) + : SGDSolver(param) { AdaDeltaPreSolve(); } + explicit AdaDeltaSolver(const string& param_file) + : SGDSolver(param_file) { AdaDeltaPreSolve(); } + virtual inline const char* type() const { return "AdaDelta"; } + + protected: + void AdaDeltaPreSolve(); + virtual void ComputeUpdateValue(int param_id, Dtype rate); + + DISABLE_COPY_AND_ASSIGN(AdaDeltaSolver); +}; + +/** + * @brief AdamSolver, an algorithm for first-order gradient-based optimization + * of stochastic objective functions, based on adaptive estimates of + * lower-order moments. Described in [1]. + * + * [1] D. P. Kingma and J. L. Ba, "ADAM: A Method for Stochastic Optimization." + * arXiv preprint arXiv:1412.6980v8 (2014). + */ +template +class AdamSolver : public SGDSolver { + public: + explicit AdamSolver(const SolverParameter& param) + : SGDSolver(param) { AdamPreSolve();} + explicit AdamSolver(const string& param_file) + : SGDSolver(param_file) { AdamPreSolve(); } + virtual inline const char* type() const { return "Adam"; } + + protected: + void AdamPreSolve(); + virtual void ComputeUpdateValue(int param_id, Dtype rate); + + DISABLE_COPY_AND_ASSIGN(AdamSolver); +}; + +} // namespace caffe + +#endif // CAFFE_SGD_SOLVERS_HPP_ diff --git a/usr/local/include/caffe/solver.hpp b/usr/local/include/caffe/solver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7a0d7777f2d66dca6affbbef9ba1c22a00cde2ec --- /dev/null +++ b/usr/local/include/caffe/solver.hpp @@ -0,0 +1,138 @@ +#ifndef CAFFE_SOLVER_HPP_ +#define CAFFE_SOLVER_HPP_ +#include +#include +#include + +#include "caffe/net.hpp" +#include "caffe/solver_factory.hpp" +#include "caffe/util/benchmark.hpp" + +namespace caffe { + +/** + * @brief Enumeration of actions that a client of the Solver may request by + * implementing the Solver's action request function, which a + * client may optionally provide in order to request early termination + * or saving a snapshot without exiting. In the executable caffe, this + * mechanism is used to allow the snapshot to be saved when stopping + * execution with a SIGINT (Ctrl-C). + */ + namespace SolverAction { + enum Enum { + NONE = 0, // Take no special action. + STOP = 1, // Stop training. snapshot_after_train controls whether a + // snapshot is created. + SNAPSHOT = 2 // Take a snapshot, and keep training. + }; + } + +/** + * @brief Type of a function that returns a Solver Action enumeration. + */ +typedef boost::function ActionCallback; + +/** + * @brief An interface for classes that perform optimization on Net%s. + * + * Requires implementation of ApplyUpdate to compute a parameter update + * given the current state of the Net parameters. + */ +template +class Solver { + public: + explicit Solver(const SolverParameter& param); + explicit Solver(const string& param_file); + void Init(const SolverParameter& param); + void InitTrainNet(); + void InitTestNets(); + + // Client of the Solver optionally may call this in order to set the function + // that the solver uses to see what action it should take (e.g. snapshot or + // exit training early). + void SetActionFunction(ActionCallback func); + SolverAction::Enum GetRequestedAction(); + // The main entry of the solver function. In default, iter will be zero. Pass + // in a non-zero iter number to resume training for a pre-trained net. + virtual void Solve(const char* resume_file = NULL); + inline void Solve(const string& resume_file) { Solve(resume_file.c_str()); } + void Step(int iters); + // The Restore method simply dispatches to one of the + // RestoreSolverStateFrom___ protected methods. You should implement these + // methods to restore the state from the appropriate snapshot type. + void Restore(const char* resume_file); + // The Solver::Snapshot function implements the basic snapshotting utility + // that stores the learned net. You should implement the SnapshotSolverState() + // function that produces a SolverState protocol buffer that needs to be + // written to disk together with the learned net. + void Snapshot(); + virtual ~Solver() {} + inline const SolverParameter& param() const { return param_; } + inline shared_ptr > net() { return net_; } + inline const vector > >& test_nets() { + return test_nets_; + } + int iter() const { return iter_; } + + // Invoked at specific points during an iteration + class Callback { + protected: + virtual void on_start() = 0; + virtual void on_gradients_ready() = 0; + + template + friend class Solver; + }; + const vector& callbacks() const { return callbacks_; } + void add_callback(Callback* value) { + callbacks_.push_back(value); + } + + void CheckSnapshotWritePermissions(); + /** + * @brief Returns the solver type. + */ + virtual inline const char* type() const { return ""; } + + // Make and apply the update value for the current iteration. + virtual void ApplyUpdate() = 0; + + protected: + string SnapshotFilename(const string& extension); + string SnapshotToBinaryProto(); + string SnapshotToHDF5(); + // The test routine + void TestAll(); + void Test(const int test_net_id = 0); + virtual void SnapshotSolverState(const string& model_filename) = 0; + virtual void RestoreSolverStateFromHDF5(const string& state_file) = 0; + virtual void RestoreSolverStateFromBinaryProto(const string& state_file) = 0; + void DisplayOutputBlobs(const int net_id); + void UpdateSmoothedLoss(Dtype loss, int start_iter, int average_loss); + + SolverParameter param_; + int iter_; + int current_step_; + shared_ptr > net_; + vector > > test_nets_; + vector callbacks_; + vector losses_; + Dtype smoothed_loss_; + + // A function that can be set by a client of the Solver to provide indication + // that it wants a snapshot saved and/or to exit early. + ActionCallback action_request_function_; + + // True iff a request to stop early was received. + bool requested_early_exit_; + + // Timing information, handy to tune e.g. nbr of GPUs + Timer iteration_timer_; + float iterations_last_; + + DISABLE_COPY_AND_ASSIGN(Solver); +}; + +} // namespace caffe + +#endif // CAFFE_SOLVER_HPP_ diff --git a/usr/local/include/caffe/solver_factory.hpp b/usr/local/include/caffe/solver_factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a5b160739b27689ca4ffaab65f1f58ddc5c9bc25 --- /dev/null +++ b/usr/local/include/caffe/solver_factory.hpp @@ -0,0 +1,137 @@ +/** + * @brief A solver factory that allows one to register solvers, similar to + * layer factory. During runtime, registered solvers could be called by passing + * a SolverParameter protobuffer to the CreateSolver function: + * + * SolverRegistry::CreateSolver(param); + * + * There are two ways to register a solver. Assuming that we have a solver like: + * + * template + * class MyAwesomeSolver : public Solver { + * // your implementations + * }; + * + * and its type is its C++ class name, but without the "Solver" at the end + * ("MyAwesomeSolver" -> "MyAwesome"). + * + * If the solver is going to be created simply by its constructor, in your C++ + * file, add the following line: + * + * REGISTER_SOLVER_CLASS(MyAwesome); + * + * Or, if the solver is going to be created by another creator function, in the + * format of: + * + * template + * Solver GetMyAwesomeSolver(const SolverParameter& param) { + * // your implementation + * } + * + * then you can register the creator function instead, like + * + * REGISTER_SOLVER_CREATOR(MyAwesome, GetMyAwesomeSolver) + * + * Note that each solver type should only be registered once. + */ + +#ifndef CAFFE_SOLVER_FACTORY_H_ +#define CAFFE_SOLVER_FACTORY_H_ + +#include +#include +#include + +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +template +class Solver; + +template +class SolverRegistry { + public: + typedef Solver* (*Creator)(const SolverParameter&); + typedef std::map CreatorRegistry; + + static CreatorRegistry& Registry() { + static CreatorRegistry* g_registry_ = new CreatorRegistry(); + return *g_registry_; + } + + // Adds a creator. + static void AddCreator(const string& type, Creator creator) { + CreatorRegistry& registry = Registry(); + CHECK_EQ(registry.count(type), 0) + << "Solver type " << type << " already registered."; + registry[type] = creator; + } + + // Get a solver using a SolverParameter. + static Solver* CreateSolver(const SolverParameter& param) { + const string& type = param.type(); + CreatorRegistry& registry = Registry(); + CHECK_EQ(registry.count(type), 1) << "Unknown solver type: " << type + << " (known types: " << SolverTypeListString() << ")"; + return registry[type](param); + } + + static vector SolverTypeList() { + CreatorRegistry& registry = Registry(); + vector solver_types; + for (typename CreatorRegistry::iterator iter = registry.begin(); + iter != registry.end(); ++iter) { + solver_types.push_back(iter->first); + } + return solver_types; + } + + private: + // Solver registry should never be instantiated - everything is done with its + // static variables. + SolverRegistry() {} + + static string SolverTypeListString() { + vector solver_types = SolverTypeList(); + string solver_types_str; + for (vector::iterator iter = solver_types.begin(); + iter != solver_types.end(); ++iter) { + if (iter != solver_types.begin()) { + solver_types_str += ", "; + } + solver_types_str += *iter; + } + return solver_types_str; + } +}; + + +template +class SolverRegisterer { + public: + SolverRegisterer(const string& type, + Solver* (*creator)(const SolverParameter&)) { + // LOG(INFO) << "Registering solver type: " << type; + SolverRegistry::AddCreator(type, creator); + } +}; + + +#define REGISTER_SOLVER_CREATOR(type, creator) \ + static SolverRegisterer g_creator_f_##type(#type, creator); \ + static SolverRegisterer g_creator_d_##type(#type, creator) \ + +#define REGISTER_SOLVER_CLASS(type) \ + template \ + Solver* Creator_##type##Solver( \ + const SolverParameter& param) \ + { \ + return new type##Solver(param); \ + } \ + REGISTER_SOLVER_CREATOR(type, Creator_##type##Solver) + +} // namespace caffe + +#endif // CAFFE_SOLVER_FACTORY_H_ diff --git a/usr/local/include/caffe/syncedmem.hpp b/usr/local/include/caffe/syncedmem.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d650a34a8e767bdaf7cd4e308fe8b9cc47e8804 --- /dev/null +++ b/usr/local/include/caffe/syncedmem.hpp @@ -0,0 +1,95 @@ +#ifndef CAFFE_SYNCEDMEM_HPP_ +#define CAFFE_SYNCEDMEM_HPP_ + +#include + +#ifdef USE_MKL + #include "mkl.h" +#endif + +#include "caffe/common.hpp" + +namespace caffe { + +// If CUDA is available and in GPU mode, host memory will be allocated pinned, +// using cudaMallocHost. It avoids dynamic pinning for transfers (DMA). +// The improvement in performance seems negligible in the single GPU case, +// but might be more significant for parallel training. Most importantly, +// it improved stability for large models on many GPUs. +inline void CaffeMallocHost(void** ptr, size_t size, bool* use_cuda) { +#ifndef CPU_ONLY + if (Caffe::mode() == Caffe::GPU) { + CUDA_CHECK(cudaMallocHost(ptr, size)); + *use_cuda = true; + return; + } +#endif +#ifdef USE_MKL + *ptr = mkl_malloc(size ? size:1, 64); +#else + *ptr = malloc(size); +#endif + *use_cuda = false; + CHECK(*ptr) << "host allocation of size " << size << " failed"; +} + +inline void CaffeFreeHost(void* ptr, bool use_cuda) { +#ifndef CPU_ONLY + if (use_cuda) { + CUDA_CHECK(cudaFreeHost(ptr)); + return; + } +#endif +#ifdef USE_MKL + mkl_free(ptr); +#else + free(ptr); +#endif +} + + +/** + * @brief Manages memory allocation and synchronization between the host (CPU) + * and device (GPU). + * + * TODO(dox): more thorough description. + */ +class SyncedMemory { + public: + SyncedMemory(); + explicit SyncedMemory(size_t size); + ~SyncedMemory(); + const void* cpu_data(); + void set_cpu_data(void* data); + const void* gpu_data(); + void set_gpu_data(void* data); + void* mutable_cpu_data(); + void* mutable_gpu_data(); + enum SyncedHead { UNINITIALIZED, HEAD_AT_CPU, HEAD_AT_GPU, SYNCED }; + SyncedHead head() const { return head_; } + size_t size() const { return size_; } + +#ifndef CPU_ONLY + void async_gpu_push(const cudaStream_t& stream); +#endif + + private: + void check_device(); + + void to_cpu(); + void to_gpu(); + void* cpu_ptr_; + void* gpu_ptr_; + size_t size_; + SyncedHead head_; + bool own_cpu_data_; + bool cpu_malloc_use_cuda_; + bool own_gpu_data_; + int device_; + + DISABLE_COPY_AND_ASSIGN(SyncedMemory); +}; // class SyncedMemory + +} // namespace caffe + +#endif // CAFFE_SYNCEDMEM_HPP_ diff --git a/usr/local/include/caffe/test/test_caffe_main.hpp b/usr/local/include/caffe/test/test_caffe_main.hpp new file mode 100644 index 0000000000000000000000000000000000000000..294f7e5011a593b49a89215f35ff88904c1b9a85 --- /dev/null +++ b/usr/local/include/caffe/test/test_caffe_main.hpp @@ -0,0 +1,77 @@ +// The main caffe test code. Your test cpp code should include this hpp +// to allow a main function to be compiled into the binary. +#ifndef CAFFE_TEST_TEST_CAFFE_MAIN_HPP_ +#define CAFFE_TEST_TEST_CAFFE_MAIN_HPP_ + +#include +#include + +#include +#include + +#include "caffe/common.hpp" + +using std::cout; +using std::endl; + +#ifdef CMAKE_BUILD + #include "caffe_config.h" +#else + #define CUDA_TEST_DEVICE -1 + #define EXAMPLES_SOURCE_DIR "examples/" + #define ABS_TEST_DATA_DIR "src/caffe/test/test_data" +#endif + +int main(int argc, char** argv); + +namespace caffe { + +template +class MultiDeviceTest : public ::testing::Test { + public: + typedef typename TypeParam::Dtype Dtype; + protected: + MultiDeviceTest() { + Caffe::set_mode(TypeParam::device); + } + virtual ~MultiDeviceTest() {} +}; + +typedef ::testing::Types TestDtypes; + +template +struct CPUDevice { + typedef TypeParam Dtype; + static const Caffe::Brew device = Caffe::CPU; +}; + +template +class CPUDeviceTest : public MultiDeviceTest > { +}; + +#ifdef CPU_ONLY + +typedef ::testing::Types, + CPUDevice > TestDtypesAndDevices; + +#else + +template +struct GPUDevice { + typedef TypeParam Dtype; + static const Caffe::Brew device = Caffe::GPU; +}; + +template +class GPUDeviceTest : public MultiDeviceTest > { +}; + +typedef ::testing::Types, CPUDevice, + GPUDevice, GPUDevice > + TestDtypesAndDevices; + +#endif + +} // namespace caffe + +#endif // CAFFE_TEST_TEST_CAFFE_MAIN_HPP_ diff --git a/usr/local/include/caffe/test/test_gradient_check_util.hpp b/usr/local/include/caffe/test/test_gradient_check_util.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b25a84875eff0205a65f13b23938bd99d8c13dbf --- /dev/null +++ b/usr/local/include/caffe/test/test_gradient_check_util.hpp @@ -0,0 +1,266 @@ +#ifndef CAFFE_TEST_GRADIENT_CHECK_UTIL_H_ +#define CAFFE_TEST_GRADIENT_CHECK_UTIL_H_ + +#include +#include + +#include +#include +#include + +#include "caffe/layer.hpp" +#include "caffe/net.hpp" + +namespace caffe { + +// The gradient checker adds a L2 normalization loss function on top of the +// top blobs, and checks the gradient. +template +class GradientChecker { + public: + // kink and kink_range specify an ignored nonsmooth region of the form + // kink - kink_range <= |feature value| <= kink + kink_range, + // which accounts for all nonsmoothness in use by caffe + GradientChecker(const Dtype stepsize, const Dtype threshold, + const unsigned int seed = 1701, const Dtype kink = 0., + const Dtype kink_range = -1) + : stepsize_(stepsize), threshold_(threshold), seed_(seed), + kink_(kink), kink_range_(kink_range) {} + // Checks the gradient of a layer, with provided bottom layers and top + // layers. + // Note that after the gradient check, we do not guarantee that the data + // stored in the layer parameters and the blobs are unchanged. + void CheckGradient(Layer* layer, const vector*>& bottom, + const vector*>& top, int check_bottom = -1) { + layer->SetUp(bottom, top); + CheckGradientSingle(layer, bottom, top, check_bottom, -1, -1); + } + void CheckGradientExhaustive(Layer* layer, + const vector*>& bottom, const vector*>& top, + int check_bottom = -1); + + // CheckGradientEltwise can be used to test layers that perform element-wise + // computation only (e.g., neuron layers) -- where (d y_i) / (d x_j) = 0 when + // i != j. + void CheckGradientEltwise(Layer* layer, + const vector*>& bottom, const vector*>& top); + + // Checks the gradient of a single output with respect to particular input + // blob(s). If check_bottom = i >= 0, check only the ith bottom Blob. + // If check_bottom == -1, check everything -- all bottom Blobs and all + // param Blobs. Otherwise (if check_bottom < -1), check only param Blobs. + void CheckGradientSingle(Layer* layer, + const vector*>& bottom, const vector*>& top, + int check_bottom, int top_id, int top_data_id, bool element_wise = false); + + // Checks the gradient of a network. This network should not have any data + // layers or loss layers, since the function does not explicitly deal with + // such cases yet. All input blobs and parameter blobs are going to be + // checked, layer-by-layer to avoid numerical problems to accumulate. + void CheckGradientNet(const Net& net, + const vector*>& input); + + protected: + Dtype GetObjAndGradient(const Layer& layer, + const vector*>& top, int top_id = -1, int top_data_id = -1); + Dtype stepsize_; + Dtype threshold_; + unsigned int seed_; + Dtype kink_; + Dtype kink_range_; +}; + + +template +void GradientChecker::CheckGradientSingle(Layer* layer, + const vector*>& bottom, const vector*>& top, + int check_bottom, int top_id, int top_data_id, bool element_wise) { + if (element_wise) { + CHECK_EQ(0, layer->blobs().size()); + CHECK_LE(0, top_id); + CHECK_LE(0, top_data_id); + const int top_count = top[top_id]->count(); + for (int blob_id = 0; blob_id < bottom.size(); ++blob_id) { + CHECK_EQ(top_count, bottom[blob_id]->count()); + } + } + // First, figure out what blobs we need to check against, and zero init + // parameter blobs. + vector*> blobs_to_check; + vector propagate_down(bottom.size(), check_bottom == -1); + for (int i = 0; i < layer->blobs().size(); ++i) { + Blob* blob = layer->blobs()[i].get(); + caffe_set(blob->count(), static_cast(0), blob->mutable_cpu_diff()); + blobs_to_check.push_back(blob); + } + if (check_bottom == -1) { + for (int i = 0; i < bottom.size(); ++i) { + blobs_to_check.push_back(bottom[i]); + } + } else if (check_bottom >= 0) { + CHECK_LT(check_bottom, bottom.size()); + blobs_to_check.push_back(bottom[check_bottom]); + propagate_down[check_bottom] = true; + } + CHECK_GT(blobs_to_check.size(), 0) << "No blobs to check."; + // Compute the gradient analytically using Backward + Caffe::set_random_seed(seed_); + // Ignore the loss from the layer (it's just the weighted sum of the losses + // from the top blobs, whose gradients we may want to test individually). + layer->Forward(bottom, top); + // Get additional loss from the objective + GetObjAndGradient(*layer, top, top_id, top_data_id); + layer->Backward(top, propagate_down, bottom); + // Store computed gradients for all checked blobs + vector > > + computed_gradient_blobs(blobs_to_check.size()); + for (int blob_id = 0; blob_id < blobs_to_check.size(); ++blob_id) { + Blob* current_blob = blobs_to_check[blob_id]; + computed_gradient_blobs[blob_id].reset(new Blob()); + computed_gradient_blobs[blob_id]->ReshapeLike(*current_blob); + const int count = blobs_to_check[blob_id]->count(); + const Dtype* diff = blobs_to_check[blob_id]->cpu_diff(); + Dtype* computed_gradients = + computed_gradient_blobs[blob_id]->mutable_cpu_data(); + caffe_copy(count, diff, computed_gradients); + } + // Compute derivative of top w.r.t. each bottom and parameter input using + // finite differencing. + // LOG(ERROR) << "Checking " << blobs_to_check.size() << " blobs."; + for (int blob_id = 0; blob_id < blobs_to_check.size(); ++blob_id) { + Blob* current_blob = blobs_to_check[blob_id]; + const Dtype* computed_gradients = + computed_gradient_blobs[blob_id]->cpu_data(); + // LOG(ERROR) << "Blob " << blob_id << ": checking " + // << current_blob->count() << " parameters."; + for (int feat_id = 0; feat_id < current_blob->count(); ++feat_id) { + // For an element-wise layer, we only need to do finite differencing to + // compute the derivative of top[top_id][top_data_id] w.r.t. + // bottom[blob_id][i] only for i == top_data_id. For any other + // i != top_data_id, we know the derivative is 0 by definition, and simply + // check that that's true. + Dtype estimated_gradient = 0; + Dtype positive_objective = 0; + Dtype negative_objective = 0; + if (!element_wise || (feat_id == top_data_id)) { + // Do finite differencing. + // Compute loss with stepsize_ added to input. + current_blob->mutable_cpu_data()[feat_id] += stepsize_; + Caffe::set_random_seed(seed_); + layer->Forward(bottom, top); + positive_objective = + GetObjAndGradient(*layer, top, top_id, top_data_id); + // Compute loss with stepsize_ subtracted from input. + current_blob->mutable_cpu_data()[feat_id] -= stepsize_ * 2; + Caffe::set_random_seed(seed_); + layer->Forward(bottom, top); + negative_objective = + GetObjAndGradient(*layer, top, top_id, top_data_id); + // Recover original input value. + current_blob->mutable_cpu_data()[feat_id] += stepsize_; + estimated_gradient = (positive_objective - negative_objective) / + stepsize_ / 2.; + } + Dtype computed_gradient = computed_gradients[feat_id]; + Dtype feature = current_blob->cpu_data()[feat_id]; + // LOG(ERROR) << "debug: " << current_blob->cpu_data()[feat_id] << " " + // << current_blob->cpu_diff()[feat_id]; + if (kink_ - kink_range_ > fabs(feature) + || fabs(feature) > kink_ + kink_range_) { + // We check relative accuracy, but for too small values, we threshold + // the scale factor by 1. + Dtype scale = std::max( + std::max(fabs(computed_gradient), fabs(estimated_gradient)), + Dtype(1.)); + EXPECT_NEAR(computed_gradient, estimated_gradient, threshold_ * scale) + << "debug: (top_id, top_data_id, blob_id, feat_id)=" + << top_id << "," << top_data_id << "," << blob_id << "," << feat_id + << "; feat = " << feature + << "; objective+ = " << positive_objective + << "; objective- = " << negative_objective; + } + // LOG(ERROR) << "Feature: " << current_blob->cpu_data()[feat_id]; + // LOG(ERROR) << "computed gradient: " << computed_gradient + // << " estimated_gradient: " << estimated_gradient; + } + } +} + +template +void GradientChecker::CheckGradientExhaustive(Layer* layer, + const vector*>& bottom, const vector*>& top, + int check_bottom) { + layer->SetUp(bottom, top); + CHECK_GT(top.size(), 0) << "Exhaustive mode requires at least one top blob."; + // LOG(ERROR) << "Exhaustive Mode."; + for (int i = 0; i < top.size(); ++i) { + // LOG(ERROR) << "Exhaustive: blob " << i << " size " << top[i]->count(); + for (int j = 0; j < top[i]->count(); ++j) { + // LOG(ERROR) << "Exhaustive: blob " << i << " data " << j; + CheckGradientSingle(layer, bottom, top, check_bottom, i, j); + } + } +} + +template +void GradientChecker::CheckGradientEltwise(Layer* layer, + const vector*>& bottom, const vector*>& top) { + layer->SetUp(bottom, top); + CHECK_GT(top.size(), 0) << "Eltwise mode requires at least one top blob."; + const int check_bottom = -1; + const bool element_wise = true; + for (int i = 0; i < top.size(); ++i) { + for (int j = 0; j < top[i]->count(); ++j) { + CheckGradientSingle(layer, bottom, top, check_bottom, i, j, element_wise); + } + } +} + +template +void GradientChecker::CheckGradientNet( + const Net& net, const vector*>& input) { + const vector > >& layers = net.layers(); + vector*> >& bottom_vecs = net.bottom_vecs(); + vector*> >& top_vecs = net.top_vecs(); + for (int i = 0; i < layers.size(); ++i) { + net.Forward(input); + LOG(ERROR) << "Checking gradient for " << layers[i]->layer_param().name(); + CheckGradientExhaustive(*(layers[i].get()), bottom_vecs[i], top_vecs[i]); + } +} + +template +Dtype GradientChecker::GetObjAndGradient(const Layer& layer, + const vector*>& top, int top_id, int top_data_id) { + Dtype loss = 0; + if (top_id < 0) { + // the loss will be half of the sum of squares of all outputs + for (int i = 0; i < top.size(); ++i) { + Blob* top_blob = top[i]; + const Dtype* top_blob_data = top_blob->cpu_data(); + Dtype* top_blob_diff = top_blob->mutable_cpu_diff(); + int count = top_blob->count(); + for (int j = 0; j < count; ++j) { + loss += top_blob_data[j] * top_blob_data[j]; + } + // set the diff: simply the data. + caffe_copy(top_blob->count(), top_blob_data, top_blob_diff); + } + loss /= 2.; + } else { + // the loss will be the top_data_id-th element in the top_id-th blob. + for (int i = 0; i < top.size(); ++i) { + Blob* top_blob = top[i]; + Dtype* top_blob_diff = top_blob->mutable_cpu_diff(); + caffe_set(top_blob->count(), Dtype(0), top_blob_diff); + } + const Dtype loss_weight = 2; + loss = top[top_id]->cpu_data()[top_data_id] * loss_weight; + top[top_id]->mutable_cpu_diff()[top_data_id] = loss_weight; + } + return loss; +} + +} // namespace caffe + +#endif // CAFFE_TEST_GRADIENT_CHECK_UTIL_H_ diff --git a/usr/local/include/caffe/util/benchmark.hpp b/usr/local/include/caffe/util/benchmark.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d63582776eedc8279be469710e35d658f46727e5 --- /dev/null +++ b/usr/local/include/caffe/util/benchmark.hpp @@ -0,0 +1,52 @@ +#ifndef CAFFE_UTIL_BENCHMARK_H_ +#define CAFFE_UTIL_BENCHMARK_H_ + +#include + +#include "caffe/util/device_alternate.hpp" + +namespace caffe { + +class Timer { + public: + Timer(); + virtual ~Timer(); + virtual void Start(); + virtual void Stop(); + virtual float MilliSeconds(); + virtual float MicroSeconds(); + virtual float Seconds(); + + inline bool initted() { return initted_; } + inline bool running() { return running_; } + inline bool has_run_at_least_once() { return has_run_at_least_once_; } + + protected: + void Init(); + + bool initted_; + bool running_; + bool has_run_at_least_once_; +#ifndef CPU_ONLY + cudaEvent_t start_gpu_; + cudaEvent_t stop_gpu_; +#endif + boost::posix_time::ptime start_cpu_; + boost::posix_time::ptime stop_cpu_; + float elapsed_milliseconds_; + float elapsed_microseconds_; +}; + +class CPUTimer : public Timer { + public: + explicit CPUTimer(); + virtual ~CPUTimer() {} + virtual void Start(); + virtual void Stop(); + virtual float MilliSeconds(); + virtual float MicroSeconds(); +}; + +} // namespace caffe + +#endif // CAFFE_UTIL_BENCHMARK_H_ diff --git a/usr/local/include/caffe/util/blocking_queue.hpp b/usr/local/include/caffe/util/blocking_queue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d3de2e59b80baf282b194aa03e21aff07eb3a8a7 --- /dev/null +++ b/usr/local/include/caffe/util/blocking_queue.hpp @@ -0,0 +1,45 @@ +#ifndef CAFFE_UTIL_BLOCKING_QUEUE_HPP_ +#define CAFFE_UTIL_BLOCKING_QUEUE_HPP_ + +#include +#include + +namespace caffe { + +template +class BlockingQueue { + public: + explicit BlockingQueue(); + + void push(const T& t); + + bool try_pop(T* t); + + // This logs a message if the threads needs to be blocked + // useful for detecting e.g. when data feeding is too slow + T pop(const string& log_on_wait = ""); + + bool try_peek(T* t); + + // Return element without removing it + T peek(); + + size_t size() const; + + protected: + /** + Move synchronization fields out instead of including boost/thread.hpp + to avoid a boost/NVCC issues (#1009, #1010) on OSX. Also fails on + Linux CUDA 7.0.18. + */ + class sync; + + std::queue queue_; + shared_ptr sync_; + +DISABLE_COPY_AND_ASSIGN(BlockingQueue); +}; + +} // namespace caffe + +#endif diff --git a/usr/local/include/caffe/util/cudnn.hpp b/usr/local/include/caffe/util/cudnn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cd3f93f6e2865943d86728eb6c29a22cf769db1c --- /dev/null +++ b/usr/local/include/caffe/util/cudnn.hpp @@ -0,0 +1,169 @@ +#ifndef CAFFE_UTIL_CUDNN_H_ +#define CAFFE_UTIL_CUDNN_H_ +#ifdef USE_CUDNN + +#include + +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" + +#define CUDNN_VERSION_MIN(major, minor, patch) \ + (CUDNN_VERSION >= (major * 1000 + minor * 100 + patch)) + +#define CUDNN_CHECK(condition) \ + do { \ + cudnnStatus_t status = condition; \ + CHECK_EQ(status, CUDNN_STATUS_SUCCESS) << " "\ + << cudnnGetErrorString(status); \ + } while (0) + +inline const char* cudnnGetErrorString(cudnnStatus_t status) { + switch (status) { + case CUDNN_STATUS_SUCCESS: + return "CUDNN_STATUS_SUCCESS"; + case CUDNN_STATUS_NOT_INITIALIZED: + return "CUDNN_STATUS_NOT_INITIALIZED"; + case CUDNN_STATUS_ALLOC_FAILED: + return "CUDNN_STATUS_ALLOC_FAILED"; + case CUDNN_STATUS_BAD_PARAM: + return "CUDNN_STATUS_BAD_PARAM"; + case CUDNN_STATUS_INTERNAL_ERROR: + return "CUDNN_STATUS_INTERNAL_ERROR"; + case CUDNN_STATUS_INVALID_VALUE: + return "CUDNN_STATUS_INVALID_VALUE"; + case CUDNN_STATUS_ARCH_MISMATCH: + return "CUDNN_STATUS_ARCH_MISMATCH"; + case CUDNN_STATUS_MAPPING_ERROR: + return "CUDNN_STATUS_MAPPING_ERROR"; + case CUDNN_STATUS_EXECUTION_FAILED: + return "CUDNN_STATUS_EXECUTION_FAILED"; + case CUDNN_STATUS_NOT_SUPPORTED: + return "CUDNN_STATUS_NOT_SUPPORTED"; + case CUDNN_STATUS_LICENSE_ERROR: + return "CUDNN_STATUS_LICENSE_ERROR"; +#if CUDNN_VERSION_MIN(6, 0, 0) + case CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING: + return "CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING"; +#endif +#if CUDNN_VERSION_MIN(7, 0, 0) + case CUDNN_STATUS_RUNTIME_IN_PROGRESS: + return "CUDNN_STATUS_RUNTIME_IN_PROGRESS"; + case CUDNN_STATUS_RUNTIME_FP_OVERFLOW: + return "CUDNN_STATUS_RUNTIME_FP_OVERFLOW"; +#endif + } + return "Unknown cudnn status"; +} + +namespace caffe { + +namespace cudnn { + +template class dataType; +template<> class dataType { + public: + static const cudnnDataType_t type = CUDNN_DATA_FLOAT; + static float oneval, zeroval; + static const void *one, *zero; +}; +template<> class dataType { + public: + static const cudnnDataType_t type = CUDNN_DATA_DOUBLE; + static double oneval, zeroval; + static const void *one, *zero; +}; + +template +inline void createTensor4dDesc(cudnnTensorDescriptor_t* desc) { + CUDNN_CHECK(cudnnCreateTensorDescriptor(desc)); +} + +template +inline void setTensor4dDesc(cudnnTensorDescriptor_t* desc, + int n, int c, int h, int w, + int stride_n, int stride_c, int stride_h, int stride_w) { + CUDNN_CHECK(cudnnSetTensor4dDescriptorEx(*desc, dataType::type, + n, c, h, w, stride_n, stride_c, stride_h, stride_w)); +} + +template +inline void setTensor4dDesc(cudnnTensorDescriptor_t* desc, + int n, int c, int h, int w) { + const int stride_w = 1; + const int stride_h = w * stride_w; + const int stride_c = h * stride_h; + const int stride_n = c * stride_c; + setTensor4dDesc(desc, n, c, h, w, + stride_n, stride_c, stride_h, stride_w); +} + +template +inline void createFilterDesc(cudnnFilterDescriptor_t* desc, + int n, int c, int h, int w) { + CUDNN_CHECK(cudnnCreateFilterDescriptor(desc)); +#if CUDNN_VERSION_MIN(5, 0, 0) + CUDNN_CHECK(cudnnSetFilter4dDescriptor(*desc, dataType::type, + CUDNN_TENSOR_NCHW, n, c, h, w)); +#else + CUDNN_CHECK(cudnnSetFilter4dDescriptor_v4(*desc, dataType::type, + CUDNN_TENSOR_NCHW, n, c, h, w)); +#endif +} + +template +inline void createConvolutionDesc(cudnnConvolutionDescriptor_t* conv) { + CUDNN_CHECK(cudnnCreateConvolutionDescriptor(conv)); +} + +template +inline void setConvolutionDesc(cudnnConvolutionDescriptor_t* conv, + cudnnTensorDescriptor_t bottom, cudnnFilterDescriptor_t filter, + int pad_h, int pad_w, int stride_h, int stride_w) { +#if CUDNN_VERSION_MIN(6, 0, 0) + CUDNN_CHECK(cudnnSetConvolution2dDescriptor(*conv, + pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION, + dataType::type)); +#else + CUDNN_CHECK(cudnnSetConvolution2dDescriptor(*conv, + pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION)); +#endif +} + +template +inline void createPoolingDesc(cudnnPoolingDescriptor_t* pool_desc, + PoolingParameter_PoolMethod poolmethod, cudnnPoolingMode_t* mode, + int h, int w, int pad_h, int pad_w, int stride_h, int stride_w) { + switch (poolmethod) { + case PoolingParameter_PoolMethod_MAX: + *mode = CUDNN_POOLING_MAX; + break; + case PoolingParameter_PoolMethod_AVE: + *mode = CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING; + break; + default: + LOG(FATAL) << "Unknown pooling method."; + } + CUDNN_CHECK(cudnnCreatePoolingDescriptor(pool_desc)); +#if CUDNN_VERSION_MIN(5, 0, 0) + CUDNN_CHECK(cudnnSetPooling2dDescriptor(*pool_desc, *mode, + CUDNN_PROPAGATE_NAN, h, w, pad_h, pad_w, stride_h, stride_w)); +#else + CUDNN_CHECK(cudnnSetPooling2dDescriptor_v4(*pool_desc, *mode, + CUDNN_PROPAGATE_NAN, h, w, pad_h, pad_w, stride_h, stride_w)); +#endif +} + +template +inline void createActivationDescriptor(cudnnActivationDescriptor_t* activ_desc, + cudnnActivationMode_t mode) { + CUDNN_CHECK(cudnnCreateActivationDescriptor(activ_desc)); + CUDNN_CHECK(cudnnSetActivationDescriptor(*activ_desc, mode, + CUDNN_PROPAGATE_NAN, Dtype(0))); +} + +} // namespace cudnn + +} // namespace caffe + +#endif // USE_CUDNN +#endif // CAFFE_UTIL_CUDNN_H_ diff --git a/usr/local/include/caffe/util/db.hpp b/usr/local/include/caffe/util/db.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59ec3d390baa8936066ad8adc3442d1d3938a27f --- /dev/null +++ b/usr/local/include/caffe/util/db.hpp @@ -0,0 +1,54 @@ +#ifndef CAFFE_UTIL_DB_HPP +#define CAFFE_UTIL_DB_HPP + +#include + +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" + +namespace caffe { namespace db { + +enum Mode { READ, WRITE, NEW }; + +class Cursor { + public: + Cursor() { } + virtual ~Cursor() { } + virtual void SeekToFirst() = 0; + virtual void Next() = 0; + virtual string key() = 0; + virtual string value() = 0; + virtual bool valid() = 0; + + DISABLE_COPY_AND_ASSIGN(Cursor); +}; + +class Transaction { + public: + Transaction() { } + virtual ~Transaction() { } + virtual void Put(const string& key, const string& value) = 0; + virtual void Commit() = 0; + + DISABLE_COPY_AND_ASSIGN(Transaction); +}; + +class DB { + public: + DB() { } + virtual ~DB() { } + virtual void Open(const string& source, Mode mode) = 0; + virtual void Close() = 0; + virtual Cursor* NewCursor() = 0; + virtual Transaction* NewTransaction() = 0; + + DISABLE_COPY_AND_ASSIGN(DB); +}; + +DB* GetDB(DataParameter::DB backend); +DB* GetDB(const string& backend); + +} // namespace db +} // namespace caffe + +#endif // CAFFE_UTIL_DB_HPP diff --git a/usr/local/include/caffe/util/db_leveldb.hpp b/usr/local/include/caffe/util/db_leveldb.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4cdb6db95580d276b112ca48048b3b8ced596715 --- /dev/null +++ b/usr/local/include/caffe/util/db_leveldb.hpp @@ -0,0 +1,78 @@ +#ifdef USE_LEVELDB +#ifndef CAFFE_UTIL_DB_LEVELDB_HPP +#define CAFFE_UTIL_DB_LEVELDB_HPP + +#include + +#include "leveldb/db.h" +#include "leveldb/write_batch.h" + +#include "caffe/util/db.hpp" + +namespace caffe { namespace db { + +class LevelDBCursor : public Cursor { + public: + explicit LevelDBCursor(leveldb::Iterator* iter) + : iter_(iter) { + SeekToFirst(); + CHECK(iter_->status().ok()) << iter_->status().ToString(); + } + ~LevelDBCursor() { delete iter_; } + virtual void SeekToFirst() { iter_->SeekToFirst(); } + virtual void Next() { iter_->Next(); } + virtual string key() { return iter_->key().ToString(); } + virtual string value() { return iter_->value().ToString(); } + virtual bool valid() { return iter_->Valid(); } + + private: + leveldb::Iterator* iter_; +}; + +class LevelDBTransaction : public Transaction { + public: + explicit LevelDBTransaction(leveldb::DB* db) : db_(db) { CHECK_NOTNULL(db_); } + virtual void Put(const string& key, const string& value) { + batch_.Put(key, value); + } + virtual void Commit() { + leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch_); + CHECK(status.ok()) << "Failed to write batch to leveldb " + << std::endl << status.ToString(); + } + + private: + leveldb::DB* db_; + leveldb::WriteBatch batch_; + + DISABLE_COPY_AND_ASSIGN(LevelDBTransaction); +}; + +class LevelDB : public DB { + public: + LevelDB() : db_(NULL) { } + virtual ~LevelDB() { Close(); } + virtual void Open(const string& source, Mode mode); + virtual void Close() { + if (db_ != NULL) { + delete db_; + db_ = NULL; + } + } + virtual LevelDBCursor* NewCursor() { + return new LevelDBCursor(db_->NewIterator(leveldb::ReadOptions())); + } + virtual LevelDBTransaction* NewTransaction() { + return new LevelDBTransaction(db_); + } + + private: + leveldb::DB* db_; +}; + + +} // namespace db +} // namespace caffe + +#endif // CAFFE_UTIL_DB_LEVELDB_HPP +#endif // USE_LEVELDB diff --git a/usr/local/include/caffe/util/db_lmdb.hpp b/usr/local/include/caffe/util/db_lmdb.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee3703223830f55830b758aeb6fd6b1f1d66c7f8 --- /dev/null +++ b/usr/local/include/caffe/util/db_lmdb.hpp @@ -0,0 +1,96 @@ +#ifdef USE_LMDB +#ifndef CAFFE_UTIL_DB_LMDB_HPP +#define CAFFE_UTIL_DB_LMDB_HPP + +#include +#include + +#include "lmdb.h" + +#include "caffe/util/db.hpp" + +namespace caffe { namespace db { + +inline void MDB_CHECK(int mdb_status) { + CHECK_EQ(mdb_status, MDB_SUCCESS) << mdb_strerror(mdb_status); +} + +class LMDBCursor : public Cursor { + public: + explicit LMDBCursor(MDB_txn* mdb_txn, MDB_cursor* mdb_cursor) + : mdb_txn_(mdb_txn), mdb_cursor_(mdb_cursor), valid_(false) { + SeekToFirst(); + } + virtual ~LMDBCursor() { + mdb_cursor_close(mdb_cursor_); + mdb_txn_abort(mdb_txn_); + } + virtual void SeekToFirst() { Seek(MDB_FIRST); } + virtual void Next() { Seek(MDB_NEXT); } + virtual string key() { + return string(static_cast(mdb_key_.mv_data), mdb_key_.mv_size); + } + virtual string value() { + return string(static_cast(mdb_value_.mv_data), + mdb_value_.mv_size); + } + virtual bool valid() { return valid_; } + + private: + void Seek(MDB_cursor_op op) { + int mdb_status = mdb_cursor_get(mdb_cursor_, &mdb_key_, &mdb_value_, op); + if (mdb_status == MDB_NOTFOUND) { + valid_ = false; + } else { + MDB_CHECK(mdb_status); + valid_ = true; + } + } + + MDB_txn* mdb_txn_; + MDB_cursor* mdb_cursor_; + MDB_val mdb_key_, mdb_value_; + bool valid_; +}; + +class LMDBTransaction : public Transaction { + public: + explicit LMDBTransaction(MDB_env* mdb_env) + : mdb_env_(mdb_env) { } + virtual void Put(const string& key, const string& value); + virtual void Commit(); + + private: + MDB_env* mdb_env_; + vector keys, values; + + void DoubleMapSize(); + + DISABLE_COPY_AND_ASSIGN(LMDBTransaction); +}; + +class LMDB : public DB { + public: + LMDB() : mdb_env_(NULL) { } + virtual ~LMDB() { Close(); } + virtual void Open(const string& source, Mode mode); + virtual void Close() { + if (mdb_env_ != NULL) { + mdb_dbi_close(mdb_env_, mdb_dbi_); + mdb_env_close(mdb_env_); + mdb_env_ = NULL; + } + } + virtual LMDBCursor* NewCursor(); + virtual LMDBTransaction* NewTransaction(); + + private: + MDB_env* mdb_env_; + MDB_dbi mdb_dbi_; +}; + +} // namespace db +} // namespace caffe + +#endif // CAFFE_UTIL_DB_LMDB_HPP +#endif // USE_LMDB diff --git a/usr/local/include/caffe/util/device_alternate.hpp b/usr/local/include/caffe/util/device_alternate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e3fe4fe29fd27dd6d7393eb1ff40ab4c52020959 --- /dev/null +++ b/usr/local/include/caffe/util/device_alternate.hpp @@ -0,0 +1,96 @@ +#ifndef CAFFE_UTIL_DEVICE_ALTERNATE_H_ +#define CAFFE_UTIL_DEVICE_ALTERNATE_H_ + +#ifdef CPU_ONLY // CPU-only Caffe. + +#include + +// Stub out GPU calls as unavailable. + +#define NO_GPU LOG(FATAL) << "Cannot use GPU in CPU-only Caffe: check mode." + +#define STUB_GPU(classname) \ +template \ +void classname::Forward_gpu(const vector*>& bottom, \ + const vector*>& top) { NO_GPU; } \ +template \ +void classname::Backward_gpu(const vector*>& top, \ + const vector& propagate_down, \ + const vector*>& bottom) { NO_GPU; } \ + +#define STUB_GPU_FORWARD(classname, funcname) \ +template \ +void classname::funcname##_##gpu(const vector*>& bottom, \ + const vector*>& top) { NO_GPU; } \ + +#define STUB_GPU_BACKWARD(classname, funcname) \ +template \ +void classname::funcname##_##gpu(const vector*>& top, \ + const vector& propagate_down, \ + const vector*>& bottom) { NO_GPU; } \ + +#else // Normal GPU + CPU Caffe. + +#include +#include +#include +#include +#include // cuda driver types +#ifdef USE_CUDNN // cuDNN acceleration library. +#include "caffe/util/cudnn.hpp" +#endif + +// +// CUDA macros +// + +// CUDA: various checks for different function calls. +#define CUDA_CHECK(condition) \ + /* Code block avoids redefinition of cudaError_t error */ \ + do { \ + cudaError_t error = condition; \ + CHECK_EQ(error, cudaSuccess) << " " << cudaGetErrorString(error); \ + } while (0) + +#define CUBLAS_CHECK(condition) \ + do { \ + cublasStatus_t status = condition; \ + CHECK_EQ(status, CUBLAS_STATUS_SUCCESS) << " " \ + << caffe::cublasGetErrorString(status); \ + } while (0) + +#define CURAND_CHECK(condition) \ + do { \ + curandStatus_t status = condition; \ + CHECK_EQ(status, CURAND_STATUS_SUCCESS) << " " \ + << caffe::curandGetErrorString(status); \ + } while (0) + +// CUDA: grid stride looping +#define CUDA_KERNEL_LOOP(i, n) \ + for (int i = blockIdx.x * blockDim.x + threadIdx.x; \ + i < (n); \ + i += blockDim.x * gridDim.x) + +// CUDA: check for error after kernel execution and exit loudly if there is one. +#define CUDA_POST_KERNEL_CHECK CUDA_CHECK(cudaPeekAtLastError()) + +namespace caffe { + +// CUDA: library error reporting. +const char* cublasGetErrorString(cublasStatus_t error); +const char* curandGetErrorString(curandStatus_t error); + +// CUDA: use 512 threads per block +const int CAFFE_CUDA_NUM_THREADS = 512; + +// CUDA: number of blocks for threads. +inline int CAFFE_GET_BLOCKS(const int N) { + return (N + CAFFE_CUDA_NUM_THREADS - 1) / CAFFE_CUDA_NUM_THREADS; +} + +} // namespace caffe + +#endif // CPU_ONLY + +#endif // CAFFE_UTIL_DEVICE_ALTERNATE_H_ diff --git a/usr/local/include/caffe/util/format.hpp b/usr/local/include/caffe/util/format.hpp new file mode 100644 index 0000000000000000000000000000000000000000..925ad2e0479918267b2735e070e8d2963a7ac29a --- /dev/null +++ b/usr/local/include/caffe/util/format.hpp @@ -0,0 +1,18 @@ +#ifndef CAFFE_UTIL_FORMAT_H_ +#define CAFFE_UTIL_FORMAT_H_ + +#include // NOLINT(readability/streams) +#include // NOLINT(readability/streams) +#include + +namespace caffe { + +inline std::string format_int(int n, int numberOfLeadingZeros = 0 ) { + std::ostringstream s; + s << std::setw(numberOfLeadingZeros) << std::setfill('0') << n; + return s.str(); +} + +} + +#endif // CAFFE_UTIL_FORMAT_H_ diff --git a/usr/local/include/caffe/util/gpu_util.cuh b/usr/local/include/caffe/util/gpu_util.cuh new file mode 100644 index 0000000000000000000000000000000000000000..994202f2a1aeb645f846d291f681531267119425 --- /dev/null +++ b/usr/local/include/caffe/util/gpu_util.cuh @@ -0,0 +1,35 @@ +#ifndef CAFFE_UTIL_GPU_UTIL_H_ +#define CAFFE_UTIL_GPU_UTIL_H_ + +namespace caffe { + +template +inline __device__ Dtype caffe_gpu_atomic_add(const Dtype val, Dtype* address); + +template <> +inline __device__ +float caffe_gpu_atomic_add(const float val, float* address) { + return atomicAdd(address, val); +} + +// double atomicAdd implementation taken from: +// http://docs.nvidia.com/cuda/cuda-c-programming-guide/#axzz3PVCpVsEG +template <> +inline __device__ +double caffe_gpu_atomic_add(const double val, double* address) { + unsigned long long int* address_as_ull = // NOLINT(runtime/int) + // NOLINT_NEXT_LINE(runtime/int) + reinterpret_cast(address); + unsigned long long int old = *address_as_ull; // NOLINT(runtime/int) + unsigned long long int assumed; // NOLINT(runtime/int) + do { + assumed = old; + old = atomicCAS(address_as_ull, assumed, + __double_as_longlong(val + __longlong_as_double(assumed))); + } while (assumed != old); + return __longlong_as_double(old); +} + +} // namespace caffe + +#endif // CAFFE_UTIL_GPU_UTIL_H_ diff --git a/usr/local/include/caffe/util/hdf5.hpp b/usr/local/include/caffe/util/hdf5.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dbd8bb6c5e4099555a746a279c679ae59509fb4b --- /dev/null +++ b/usr/local/include/caffe/util/hdf5.hpp @@ -0,0 +1,41 @@ +#ifdef USE_HDF5 +#ifndef CAFFE_UTIL_HDF5_H_ +#define CAFFE_UTIL_HDF5_H_ + +#include + +#include "hdf5.h" +#include "hdf5_hl.h" + +#include "caffe/blob.hpp" + +namespace caffe { + +template +void hdf5_load_nd_dataset_helper( + hid_t file_id, const char* dataset_name_, int min_dim, int max_dim, + Blob* blob, bool reshape); + +template +void hdf5_load_nd_dataset( + hid_t file_id, const char* dataset_name_, int min_dim, int max_dim, + Blob* blob, bool reshape = false); + +template +void hdf5_save_nd_dataset( + const hid_t file_id, const string& dataset_name, const Blob& blob, + bool write_diff = false); + +int hdf5_load_int(hid_t loc_id, const string& dataset_name); +void hdf5_save_int(hid_t loc_id, const string& dataset_name, int i); +string hdf5_load_string(hid_t loc_id, const string& dataset_name); +void hdf5_save_string(hid_t loc_id, const string& dataset_name, + const string& s); + +int hdf5_get_num_links(hid_t loc_id); +string hdf5_get_name_by_idx(hid_t loc_id, int idx); + +} // namespace caffe + +#endif // CAFFE_UTIL_HDF5_H_ +#endif // USE_HDF5 diff --git a/usr/local/include/caffe/util/im2col.hpp b/usr/local/include/caffe/util/im2col.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a35bc6e0b1c5b88c930d24f63af2da045adb762a --- /dev/null +++ b/usr/local/include/caffe/util/im2col.hpp @@ -0,0 +1,60 @@ +#ifndef _CAFFE_UTIL_IM2COL_HPP_ +#define _CAFFE_UTIL_IM2COL_HPP_ + +namespace caffe { + +template +void im2col_nd_cpu(const Dtype* data_im, const int num_spatial_axes, + const int* im_shape, const int* col_shape, + const int* kernel_shape, const int* pad, const int* stride, + const int* dilation, Dtype* data_col); + +template +void im2col_cpu(const Dtype* data_im, const int channels, + const int height, const int width, const int kernel_h, const int kernel_w, + const int pad_h, const int pad_w, const int stride_h, + const int stride_w, const int dilation_h, const int dilation_w, + Dtype* data_col); + +template +void col2im_nd_cpu(const Dtype* data_col, const int num_spatial_axes, + const int* im_shape, const int* col_shape, + const int* kernel_shape, const int* pad, const int* stride, + const int* dilation, Dtype* data_im); + +template +void col2im_cpu(const Dtype* data_col, const int channels, + const int height, const int width, const int kernel_h, const int kernel_w, + const int pad_h, const int pad_w, const int stride_h, + const int stride_w, const int dilation_h, const int dilation_w, + Dtype* data_im); + +template +void im2col_nd_gpu(const Dtype* data_im, const int num_spatial_axes, + const int col_size, const int* im_shape, const int* col_shape, + const int* kernel_shape, const int* pad, const int* stride, + const int* dilation, Dtype* data_col); + +template +void im2col_gpu(const Dtype* data_im, const int channels, + const int height, const int width, const int kernel_h, const int kernel_w, + const int pad_h, const int pad_w, const int stride_h, + const int stride_w, const int dilation_h, const int dilation_w, + Dtype* data_col); + +template +void col2im_nd_gpu(const Dtype* data_col, const int num_spatial_axes, + const int im_size, const int* im_shape, const int* col_shape, + const int* kernel_shape, const int* pad, const int* stride, + const int* dilation, Dtype* data_im); + +template +void col2im_gpu(const Dtype* data_col, const int channels, + const int height, const int width, const int kernel_h, const int kernel_w, + const int pad_h, const int pad_w, const int stride_h, + const int stride_w, const int dilation_h, const int dilation_w, + Dtype* data_im); + +} // namespace caffe + +#endif // CAFFE_UTIL_IM2COL_HPP_ diff --git a/usr/local/include/caffe/util/insert_splits.hpp b/usr/local/include/caffe/util/insert_splits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..446abb817be5ba2ec462b23879de628e279f68d6 --- /dev/null +++ b/usr/local/include/caffe/util/insert_splits.hpp @@ -0,0 +1,26 @@ +#ifndef _CAFFE_UTIL_INSERT_SPLITS_HPP_ +#define _CAFFE_UTIL_INSERT_SPLITS_HPP_ + +#include + +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +// Copy NetParameters with SplitLayers added to replace any shared bottom +// blobs with unique bottom blobs provided by the SplitLayer. +void InsertSplits(const NetParameter& param, NetParameter* param_split); + +void ConfigureSplitLayer(const string& layer_name, const string& blob_name, + const int blob_idx, const int split_count, const float loss_weight, + LayerParameter* split_layer_param); + +string SplitLayerName(const string& layer_name, const string& blob_name, + const int blob_idx); + +string SplitBlobName(const string& layer_name, const string& blob_name, + const int blob_idx, const int split_idx); + +} // namespace caffe + +#endif // CAFFE_UTIL_INSERT_SPLITS_HPP_ diff --git a/usr/local/include/caffe/util/io.hpp b/usr/local/include/caffe/util/io.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a599883ca339b2e5a10c79179e45ea231abfcb3 --- /dev/null +++ b/usr/local/include/caffe/util/io.hpp @@ -0,0 +1,152 @@ +#ifndef CAFFE_UTIL_IO_H_ +#define CAFFE_UTIL_IO_H_ + +#include +#include +#include // NOLINT(readability/streams) +#include + +#include "google/protobuf/message.h" + +#include "caffe/common.hpp" +#include "caffe/proto/caffe.pb.h" +#include "caffe/util/format.hpp" + +#ifndef CAFFE_TMP_DIR_RETRIES +#define CAFFE_TMP_DIR_RETRIES 100 +#endif + +namespace caffe { + +using ::google::protobuf::Message; +using ::boost::filesystem::path; + +inline void MakeTempDir(string* temp_dirname) { + temp_dirname->clear(); + const path& model = + boost::filesystem::temp_directory_path()/"caffe_test.%%%%-%%%%"; + for ( int i = 0; i < CAFFE_TMP_DIR_RETRIES; i++ ) { + const path& dir = boost::filesystem::unique_path(model).string(); + bool done = boost::filesystem::create_directory(dir); + if ( done ) { + *temp_dirname = dir.string(); + return; + } + } + LOG(FATAL) << "Failed to create a temporary directory."; +} + +inline void MakeTempFilename(string* temp_filename) { + static path temp_files_subpath; + static uint64_t next_temp_file = 0; + temp_filename->clear(); + if ( temp_files_subpath.empty() ) { + string path_string=""; + MakeTempDir(&path_string); + temp_files_subpath = path_string; + } + *temp_filename = + (temp_files_subpath/caffe::format_int(next_temp_file++, 9)).string(); +} + +bool ReadProtoFromTextFile(const char* filename, Message* proto); + +inline bool ReadProtoFromTextFile(const string& filename, Message* proto) { + return ReadProtoFromTextFile(filename.c_str(), proto); +} + +inline void ReadProtoFromTextFileOrDie(const char* filename, Message* proto) { + CHECK(ReadProtoFromTextFile(filename, proto)); +} + +inline void ReadProtoFromTextFileOrDie(const string& filename, Message* proto) { + ReadProtoFromTextFileOrDie(filename.c_str(), proto); +} + +void WriteProtoToTextFile(const Message& proto, const char* filename); +inline void WriteProtoToTextFile(const Message& proto, const string& filename) { + WriteProtoToTextFile(proto, filename.c_str()); +} + +bool ReadProtoFromBinaryFile(const char* filename, Message* proto); + +inline bool ReadProtoFromBinaryFile(const string& filename, Message* proto) { + return ReadProtoFromBinaryFile(filename.c_str(), proto); +} + +inline void ReadProtoFromBinaryFileOrDie(const char* filename, Message* proto) { + CHECK(ReadProtoFromBinaryFile(filename, proto)); +} + +inline void ReadProtoFromBinaryFileOrDie(const string& filename, + Message* proto) { + ReadProtoFromBinaryFileOrDie(filename.c_str(), proto); +} + + +void WriteProtoToBinaryFile(const Message& proto, const char* filename); +inline void WriteProtoToBinaryFile( + const Message& proto, const string& filename) { + WriteProtoToBinaryFile(proto, filename.c_str()); +} + +bool ReadFileToDatum(const string& filename, const int label, Datum* datum); + +inline bool ReadFileToDatum(const string& filename, Datum* datum) { + return ReadFileToDatum(filename, -1, datum); +} + +bool ReadImageToDatum(const string& filename, const int label, + const int height, const int width, const bool is_color, + const std::string & encoding, Datum* datum); + +inline bool ReadImageToDatum(const string& filename, const int label, + const int height, const int width, const bool is_color, Datum* datum) { + return ReadImageToDatum(filename, label, height, width, is_color, + "", datum); +} + +inline bool ReadImageToDatum(const string& filename, const int label, + const int height, const int width, Datum* datum) { + return ReadImageToDatum(filename, label, height, width, true, datum); +} + +inline bool ReadImageToDatum(const string& filename, const int label, + const bool is_color, Datum* datum) { + return ReadImageToDatum(filename, label, 0, 0, is_color, datum); +} + +inline bool ReadImageToDatum(const string& filename, const int label, + Datum* datum) { + return ReadImageToDatum(filename, label, 0, 0, true, datum); +} + +inline bool ReadImageToDatum(const string& filename, const int label, + const std::string & encoding, Datum* datum) { + return ReadImageToDatum(filename, label, 0, 0, true, encoding, datum); +} + +bool DecodeDatumNative(Datum* datum); +bool DecodeDatum(Datum* datum, bool is_color); + +#ifdef USE_OPENCV +cv::Mat ReadImageToCVMat(const string& filename, + const int height, const int width, const bool is_color); + +cv::Mat ReadImageToCVMat(const string& filename, + const int height, const int width); + +cv::Mat ReadImageToCVMat(const string& filename, + const bool is_color); + +cv::Mat ReadImageToCVMat(const string& filename); + +cv::Mat DecodeDatumToCVMatNative(const Datum& datum); +cv::Mat DecodeDatumToCVMat(const Datum& datum, bool is_color); + +void CVMatToDatum(const cv::Mat& cv_img, Datum* datum); +#endif // USE_OPENCV + +} // namespace caffe + +#endif // CAFFE_UTIL_IO_H_ diff --git a/usr/local/include/caffe/util/math_functions.hpp b/usr/local/include/caffe/util/math_functions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e549120a933c98dc860d2a48642860adb8d8cabc --- /dev/null +++ b/usr/local/include/caffe/util/math_functions.hpp @@ -0,0 +1,284 @@ +#ifndef CAFFE_UTIL_MATH_FUNCTIONS_H_ +#define CAFFE_UTIL_MATH_FUNCTIONS_H_ + +#include +#include // for std::fabs and std::signbit + +#include "glog/logging.h" + +#include "caffe/common.hpp" +#include "caffe/util/device_alternate.hpp" +#include "caffe/util/mkl_alternate.hpp" + +namespace caffe { + +// Caffe gemm provides a simpler interface to the gemm functions, with the +// limitation that the data has to be contiguous in memory. +template +void caffe_cpu_gemm(const CBLAS_TRANSPOSE TransA, + const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, + const Dtype alpha, const Dtype* A, const Dtype* B, const Dtype beta, + Dtype* C); + +template +void caffe_cpu_gemv(const CBLAS_TRANSPOSE TransA, const int M, const int N, + const Dtype alpha, const Dtype* A, const Dtype* x, const Dtype beta, + Dtype* y); + +template +void caffe_axpy(const int N, const Dtype alpha, const Dtype* X, + Dtype* Y); + +template +void caffe_cpu_axpby(const int N, const Dtype alpha, const Dtype* X, + const Dtype beta, Dtype* Y); + +template +void caffe_copy(const int N, const Dtype *X, Dtype *Y); + +template +void caffe_set(const int N, const Dtype alpha, Dtype *X); + +inline void caffe_memset(const size_t N, const int alpha, void* X) { + memset(X, alpha, N); // NOLINT(caffe/alt_fn) +} + +template +void caffe_add_scalar(const int N, const Dtype alpha, Dtype *X); + +template +void caffe_scal(const int N, const Dtype alpha, Dtype *X); + +template +void caffe_sqr(const int N, const Dtype* a, Dtype* y); + +template +void caffe_sqrt(const int N, const Dtype* a, Dtype* y); + +template +void caffe_add(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_sub(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_mul(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_div(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_powx(const int n, const Dtype* a, const Dtype b, Dtype* y); + +unsigned int caffe_rng_rand(); + +template +Dtype caffe_nextafter(const Dtype b); + +template +void caffe_rng_uniform(const int n, const Dtype a, const Dtype b, Dtype* r); + +template +void caffe_rng_gaussian(const int n, const Dtype mu, const Dtype sigma, + Dtype* r); + +template +void caffe_rng_bernoulli(const int n, const Dtype p, int* r); + +template +void caffe_rng_bernoulli(const int n, const Dtype p, unsigned int* r); + +template +void caffe_exp(const int n, const Dtype* a, Dtype* y); + +template +void caffe_log(const int n, const Dtype* a, Dtype* y); + +template +void caffe_abs(const int n, const Dtype* a, Dtype* y); + +template +Dtype caffe_cpu_dot(const int n, const Dtype* x, const Dtype* y); + +template +Dtype caffe_cpu_strided_dot(const int n, const Dtype* x, const int incx, + const Dtype* y, const int incy); + +// Returns the sum of the absolute values of the elements of vector x +template +Dtype caffe_cpu_asum(const int n, const Dtype* x); + +// the branchless, type-safe version from +// http://stackoverflow.com/questions/1903954/is-there-a-standard-sign-function-signum-sgn-in-c-c +template +inline int8_t caffe_sign(Dtype val) { + return (Dtype(0) < val) - (val < Dtype(0)); +} + +// The following two macros are modifications of DEFINE_VSL_UNARY_FUNC +// in include/caffe/util/mkl_alternate.hpp authored by @Rowland Depp. +// Please refer to commit 7e8ef25c7 of the boost-eigen branch. +// Git cherry picking that commit caused a conflict hard to resolve and +// copying that file in convenient for code reviewing. +// So they have to be pasted here temporarily. +#define DEFINE_CAFFE_CPU_UNARY_FUNC(name, operation) \ + template \ + void caffe_cpu_##name(const int n, const Dtype* x, Dtype* y) { \ + CHECK_GT(n, 0); CHECK(x); CHECK(y); \ + for (int i = 0; i < n; ++i) { \ + operation; \ + } \ + } + +// output is 1 for the positives, 0 for zero, and -1 for the negatives +DEFINE_CAFFE_CPU_UNARY_FUNC(sign, y[i] = caffe_sign(x[i])) + +// This returns a nonzero value if the input has its sign bit set. +// The name sngbit is meant to avoid conflicts with std::signbit in the macro. +// The extra parens are needed because CUDA < 6.5 defines signbit as a macro, +// and we don't want that to expand here when CUDA headers are also included. +DEFINE_CAFFE_CPU_UNARY_FUNC(sgnbit, \ + y[i] = static_cast((std::signbit)(x[i]))) + +DEFINE_CAFFE_CPU_UNARY_FUNC(fabs, y[i] = std::fabs(x[i])) + +template +void caffe_cpu_scale(const int n, const Dtype alpha, const Dtype *x, Dtype* y); + +#ifndef CPU_ONLY // GPU + +// Decaf gpu gemm provides an interface that is almost the same as the cpu +// gemm function - following the c convention and calling the fortran-order +// gpu code under the hood. +template +void caffe_gpu_gemm(const CBLAS_TRANSPOSE TransA, + const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, + const Dtype alpha, const Dtype* A, const Dtype* B, const Dtype beta, + Dtype* C); + +template +void caffe_gpu_gemv(const CBLAS_TRANSPOSE TransA, const int M, const int N, + const Dtype alpha, const Dtype* A, const Dtype* x, const Dtype beta, + Dtype* y); + +template +void caffe_gpu_axpy(const int N, const Dtype alpha, const Dtype* X, + Dtype* Y); + +template +void caffe_gpu_axpby(const int N, const Dtype alpha, const Dtype* X, + const Dtype beta, Dtype* Y); + +void caffe_gpu_memcpy(const size_t N, const void *X, void *Y); + +template +void caffe_gpu_set(const int N, const Dtype alpha, Dtype *X); + +inline void caffe_gpu_memset(const size_t N, const int alpha, void* X) { +#ifndef CPU_ONLY + CUDA_CHECK(cudaMemset(X, alpha, N)); // NOLINT(caffe/alt_fn) +#else + NO_GPU; +#endif +} + +template +void caffe_gpu_add_scalar(const int N, const Dtype alpha, Dtype *X); + +template +void caffe_gpu_scal(const int N, const Dtype alpha, Dtype *X); + +#ifndef CPU_ONLY +template +void caffe_gpu_scal(const int N, const Dtype alpha, Dtype* X, cudaStream_t str); +#endif + +template +void caffe_gpu_add(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_gpu_sub(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_gpu_mul(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_gpu_div(const int N, const Dtype* a, const Dtype* b, Dtype* y); + +template +void caffe_gpu_abs(const int n, const Dtype* a, Dtype* y); + +template +void caffe_gpu_exp(const int n, const Dtype* a, Dtype* y); + +template +void caffe_gpu_log(const int n, const Dtype* a, Dtype* y); + +template +void caffe_gpu_powx(const int n, const Dtype* a, const Dtype b, Dtype* y); + +template +void caffe_gpu_sqrt(const int n, const Dtype* a, Dtype* y); + +// caffe_gpu_rng_uniform with two arguments generates integers in the range +// [0, UINT_MAX]. +void caffe_gpu_rng_uniform(const int n, unsigned int* r); + +// caffe_gpu_rng_uniform with four arguments generates floats in the range +// (a, b] (strictly greater than a, less than or equal to b) due to the +// specification of curandGenerateUniform. With a = 0, b = 1, just calls +// curandGenerateUniform; with other limits will shift and scale the outputs +// appropriately after calling curandGenerateUniform. +template +void caffe_gpu_rng_uniform(const int n, const Dtype a, const Dtype b, Dtype* r); + +template +void caffe_gpu_rng_gaussian(const int n, const Dtype mu, const Dtype sigma, + Dtype* r); + +template +void caffe_gpu_rng_bernoulli(const int n, const Dtype p, int* r); + +template +void caffe_gpu_dot(const int n, const Dtype* x, const Dtype* y, Dtype* out); + +template +void caffe_gpu_asum(const int n, const Dtype* x, Dtype* y); + +template +void caffe_gpu_sign(const int n, const Dtype* x, Dtype* y); + +template +void caffe_gpu_sgnbit(const int n, const Dtype* x, Dtype* y); + +template +void caffe_gpu_fabs(const int n, const Dtype* x, Dtype* y); + +template +void caffe_gpu_scale(const int n, const Dtype alpha, const Dtype *x, Dtype* y); + +#define DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(name, operation) \ +template \ +__global__ void name##_kernel(const int n, const Dtype* x, Dtype* y) { \ + CUDA_KERNEL_LOOP(index, n) { \ + operation; \ + } \ +} \ +template <> \ +void caffe_gpu_##name(const int n, const float* x, float* y) { \ + /* NOLINT_NEXT_LINE(whitespace/operators) */ \ + name##_kernel<<>>( \ + n, x, y); \ +} \ +template <> \ +void caffe_gpu_##name(const int n, const double* x, double* y) { \ + /* NOLINT_NEXT_LINE(whitespace/operators) */ \ + name##_kernel<<>>( \ + n, x, y); \ +} + +#endif // !CPU_ONLY + +} // namespace caffe + +#endif // CAFFE_UTIL_MATH_FUNCTIONS_H_ diff --git a/usr/local/include/caffe/util/mkl_alternate.hpp b/usr/local/include/caffe/util/mkl_alternate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8c2294c7c86b7ade9f429ba09ed844ad587dfbbe --- /dev/null +++ b/usr/local/include/caffe/util/mkl_alternate.hpp @@ -0,0 +1,103 @@ +#ifndef CAFFE_UTIL_MKL_ALTERNATE_H_ +#define CAFFE_UTIL_MKL_ALTERNATE_H_ + +#ifdef USE_MKL + +#include + +#else // If use MKL, simply include the MKL header + +#ifdef USE_ACCELERATE +#include +#else +extern "C" { +#include +} +#endif // USE_ACCELERATE + +#include + +// Functions that caffe uses but are not present if MKL is not linked. + +// A simple way to define the vsl unary functions. The operation should +// be in the form e.g. y[i] = sqrt(a[i]) +#define DEFINE_VSL_UNARY_FUNC(name, operation) \ + template \ + void v##name(const int n, const Dtype* a, Dtype* y) { \ + CHECK_GT(n, 0); CHECK(a); CHECK(y); \ + for (int i = 0; i < n; ++i) { operation; } \ + } \ + inline void vs##name( \ + const int n, const float* a, float* y) { \ + v##name(n, a, y); \ + } \ + inline void vd##name( \ + const int n, const double* a, double* y) { \ + v##name(n, a, y); \ + } + +DEFINE_VSL_UNARY_FUNC(Sqr, y[i] = a[i] * a[i]) +DEFINE_VSL_UNARY_FUNC(Sqrt, y[i] = sqrt(a[i])) +DEFINE_VSL_UNARY_FUNC(Exp, y[i] = exp(a[i])) +DEFINE_VSL_UNARY_FUNC(Ln, y[i] = log(a[i])) +DEFINE_VSL_UNARY_FUNC(Abs, y[i] = fabs(a[i])) + +// A simple way to define the vsl unary functions with singular parameter b. +// The operation should be in the form e.g. y[i] = pow(a[i], b) +#define DEFINE_VSL_UNARY_FUNC_WITH_PARAM(name, operation) \ + template \ + void v##name(const int n, const Dtype* a, const Dtype b, Dtype* y) { \ + CHECK_GT(n, 0); CHECK(a); CHECK(y); \ + for (int i = 0; i < n; ++i) { operation; } \ + } \ + inline void vs##name( \ + const int n, const float* a, const float b, float* y) { \ + v##name(n, a, b, y); \ + } \ + inline void vd##name( \ + const int n, const double* a, const float b, double* y) { \ + v##name(n, a, b, y); \ + } + +DEFINE_VSL_UNARY_FUNC_WITH_PARAM(Powx, y[i] = pow(a[i], b)) + +// A simple way to define the vsl binary functions. The operation should +// be in the form e.g. y[i] = a[i] + b[i] +#define DEFINE_VSL_BINARY_FUNC(name, operation) \ + template \ + void v##name(const int n, const Dtype* a, const Dtype* b, Dtype* y) { \ + CHECK_GT(n, 0); CHECK(a); CHECK(b); CHECK(y); \ + for (int i = 0; i < n; ++i) { operation; } \ + } \ + inline void vs##name( \ + const int n, const float* a, const float* b, float* y) { \ + v##name(n, a, b, y); \ + } \ + inline void vd##name( \ + const int n, const double* a, const double* b, double* y) { \ + v##name(n, a, b, y); \ + } + +DEFINE_VSL_BINARY_FUNC(Add, y[i] = a[i] + b[i]) +DEFINE_VSL_BINARY_FUNC(Sub, y[i] = a[i] - b[i]) +DEFINE_VSL_BINARY_FUNC(Mul, y[i] = a[i] * b[i]) +DEFINE_VSL_BINARY_FUNC(Div, y[i] = a[i] / b[i]) + +// In addition, MKL comes with an additional function axpby that is not present +// in standard blas. We will simply use a two-step (inefficient, of course) way +// to mimic that. +inline void cblas_saxpby(const int N, const float alpha, const float* X, + const int incX, const float beta, float* Y, + const int incY) { + cblas_sscal(N, beta, Y, incY); + cblas_saxpy(N, alpha, X, incX, Y, incY); +} +inline void cblas_daxpby(const int N, const double alpha, const double* X, + const int incX, const double beta, double* Y, + const int incY) { + cblas_dscal(N, beta, Y, incY); + cblas_daxpy(N, alpha, X, incX, Y, incY); +} + +#endif // USE_MKL +#endif // CAFFE_UTIL_MKL_ALTERNATE_H_ diff --git a/usr/local/include/caffe/util/nccl.hpp b/usr/local/include/caffe/util/nccl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e01fb7451e807e432176770f216b011e00b0660d --- /dev/null +++ b/usr/local/include/caffe/util/nccl.hpp @@ -0,0 +1,37 @@ +#ifndef CAFFE_UTIL_NCCL_H_ +#define CAFFE_UTIL_NCCL_H_ +#ifdef USE_NCCL + +#include + +#include "caffe/common.hpp" + +#define NCCL_CHECK(condition) \ +{ \ + ncclResult_t result = condition; \ + CHECK_EQ(result, ncclSuccess) << " " \ + << ncclGetErrorString(result); \ +} + +namespace caffe { + +namespace nccl { + +template class dataType; + +template<> class dataType { + public: + static const ncclDataType_t type = ncclFloat; +}; +template<> class dataType { + public: + static const ncclDataType_t type = ncclDouble; +}; + +} // namespace nccl + +} // namespace caffe + +#endif // end USE_NCCL + +#endif // CAFFE_UTIL_NCCL_H_ diff --git a/usr/local/include/caffe/util/rng.hpp b/usr/local/include/caffe/util/rng.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8f1cf0d17c2993122f82fbebf5cf39ae9a7dfac1 --- /dev/null +++ b/usr/local/include/caffe/util/rng.hpp @@ -0,0 +1,43 @@ +#ifndef CAFFE_RNG_CPP_HPP_ +#define CAFFE_RNG_CPP_HPP_ + +#include +#include + +#include "boost/random/mersenne_twister.hpp" +#include "boost/random/uniform_int.hpp" + +#include "caffe/common.hpp" + +namespace caffe { + +typedef boost::mt19937 rng_t; + +inline rng_t* caffe_rng() { + return static_cast(Caffe::rng_stream().generator()); +} + +// Fisher–Yates algorithm +template +inline void shuffle(RandomAccessIterator begin, RandomAccessIterator end, + RandomGenerator* gen) { + typedef typename std::iterator_traits::difference_type + difference_type; + typedef typename boost::uniform_int dist_type; + + difference_type length = std::distance(begin, end); + if (length <= 0) return; + + for (difference_type i = length - 1; i > 0; --i) { + dist_type dist(0, i); + std::iter_swap(begin + i, begin + dist(*gen)); + } +} + +template +inline void shuffle(RandomAccessIterator begin, RandomAccessIterator end) { + shuffle(begin, end, caffe_rng()); +} +} // namespace caffe + +#endif // CAFFE_RNG_HPP_ diff --git a/usr/local/include/caffe/util/signal_handler.h b/usr/local/include/caffe/util/signal_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..5246332581e99858df7a0e743acb4768af39f1dc --- /dev/null +++ b/usr/local/include/caffe/util/signal_handler.h @@ -0,0 +1,24 @@ +#ifndef INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_ +#define INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_ + +#include "caffe/proto/caffe.pb.h" +#include "caffe/solver.hpp" + +namespace caffe { + +class SignalHandler { + public: + // Constructor. Specify what action to take when a signal is received. + SignalHandler(SolverAction::Enum SIGINT_action, + SolverAction::Enum SIGHUP_action); + ~SignalHandler(); + ActionCallback GetActionFunction(); + private: + SolverAction::Enum CheckForSignals() const; + SolverAction::Enum SIGINT_action_; + SolverAction::Enum SIGHUP_action_; +}; + +} // namespace caffe + +#endif // INCLUDE_CAFFE_UTIL_SIGNAL_HANDLER_H_ diff --git a/usr/local/include/caffe/util/upgrade_proto.hpp b/usr/local/include/caffe/util/upgrade_proto.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b145822af326f77ccd637d6562f211023b767c55 --- /dev/null +++ b/usr/local/include/caffe/util/upgrade_proto.hpp @@ -0,0 +1,88 @@ +#ifndef CAFFE_UTIL_UPGRADE_PROTO_H_ +#define CAFFE_UTIL_UPGRADE_PROTO_H_ + +#include + +#include "caffe/proto/caffe.pb.h" + +namespace caffe { + +// Return true iff the net is not the current version. +bool NetNeedsUpgrade(const NetParameter& net_param); + +// Check for deprecations and upgrade the NetParameter as needed. +bool UpgradeNetAsNeeded(const string& param_file, NetParameter* param); + +// Read parameters from a file into a NetParameter proto message. +void ReadNetParamsFromTextFileOrDie(const string& param_file, + NetParameter* param); +void ReadNetParamsFromBinaryFileOrDie(const string& param_file, + NetParameter* param); + +// Return true iff any layer contains parameters specified using +// deprecated V0LayerParameter. +bool NetNeedsV0ToV1Upgrade(const NetParameter& net_param); + +// Perform all necessary transformations to upgrade a V0NetParameter into a +// NetParameter (including upgrading padding layers and LayerParameters). +bool UpgradeV0Net(const NetParameter& v0_net_param, NetParameter* net_param); + +// Upgrade NetParameter with padding layers to pad-aware conv layers. +// For any padding layer, remove it and put its pad parameter in any layers +// taking its top blob as input. +// Error if any of these above layers are not-conv layers. +void UpgradeV0PaddingLayers(const NetParameter& param, + NetParameter* param_upgraded_pad); + +// Upgrade a single V0LayerConnection to the V1LayerParameter format. +bool UpgradeV0LayerParameter(const V1LayerParameter& v0_layer_connection, + V1LayerParameter* layer_param); + +V1LayerParameter_LayerType UpgradeV0LayerType(const string& type); + +// Return true iff any layer contains deprecated data transformation parameters. +bool NetNeedsDataUpgrade(const NetParameter& net_param); + +// Perform all necessary transformations to upgrade old transformation fields +// into a TransformationParameter. +void UpgradeNetDataTransformation(NetParameter* net_param); + +// Return true iff the Net contains any layers specified as V1LayerParameters. +bool NetNeedsV1ToV2Upgrade(const NetParameter& net_param); + +// Perform all necessary transformations to upgrade a NetParameter with +// deprecated V1LayerParameters. +bool UpgradeV1Net(const NetParameter& v1_net_param, NetParameter* net_param); + +bool UpgradeV1LayerParameter(const V1LayerParameter& v1_layer_param, + LayerParameter* layer_param); + +const char* UpgradeV1LayerType(const V1LayerParameter_LayerType type); + +// Return true iff the Net contains input fields. +bool NetNeedsInputUpgrade(const NetParameter& net_param); + +// Perform all necessary transformations to upgrade input fields into layers. +void UpgradeNetInput(NetParameter* net_param); + +// Return true iff the Net contains batch norm layers with manual local LRs. +bool NetNeedsBatchNormUpgrade(const NetParameter& net_param); + +// Perform all necessary transformations to upgrade batch norm layers. +void UpgradeNetBatchNorm(NetParameter* net_param); + +// Return true iff the solver contains any old solver_type specified as enums +bool SolverNeedsTypeUpgrade(const SolverParameter& solver_param); + +bool UpgradeSolverType(SolverParameter* solver_param); + +// Check for deprecations and upgrade the SolverParameter as needed. +bool UpgradeSolverAsNeeded(const string& param_file, SolverParameter* param); + +// Read parameters from a file into a SolverParameter proto message. +void ReadSolverParamsFromTextFileOrDie(const string& param_file, + SolverParameter* param); + +} // namespace caffe + +#endif // CAFFE_UTIL_UPGRADE_PROTO_H_ diff --git a/usr/local/include/openpose/3d/cameraParameterReader.hpp b/usr/local/include/openpose/3d/cameraParameterReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..32d51db862ee8f6ae74ff99dbe0cc41a66eb6f46 --- /dev/null +++ b/usr/local/include/openpose/3d/cameraParameterReader.hpp @@ -0,0 +1,63 @@ +#ifndef OPENPOSE_3D_CAMERA_PARAMETER_READER_HPP +#define OPENPOSE_3D_CAMERA_PARAMETER_READER_HPP + +#include + +namespace op +{ + class OP_API CameraParameterReader + { + public: + explicit CameraParameterReader(); + + virtual ~CameraParameterReader(); + + // cameraExtrinsics is optional + explicit CameraParameterReader(const std::string& serialNumber, + const Matrix& cameraIntrinsics, + const Matrix& cameraDistortion, + const Matrix& cameraExtrinsics = Matrix(), + const Matrix& cameraExtrinsicsInitial = Matrix()); + + // serialNumbers is optional. If empty, it will load all the XML files available in the + // cameraParameterPath folder + void readParameters(const std::string& cameraParameterPath, + const std::vector& serialNumbers = {}); + + // It simply calls the previous readParameters with a single element + void readParameters(const std::string& cameraParameterPath, + const std::string& serialNumber); + + void writeParameters(const std::string& cameraParameterPath) const; + + unsigned long long getNumberCameras() const; + + const std::vector& getCameraSerialNumbers() const; + + const std::vector& getCameraMatrices() const; + + const std::vector& getCameraDistortions() const; + + const std::vector& getCameraIntrinsics() const; + + const std::vector& getCameraExtrinsics() const; + + const std::vector& getCameraExtrinsicsInitial() const; + + bool getUndistortImage() const; + + void setUndistortImage(const bool undistortImage); + + void undistort(Matrix& frame, const unsigned int cameraIndex = 0u); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplCameraParameterReader; + std::shared_ptr spImpl; + + DELETE_COPY(CameraParameterReader); + }; +} + +#endif // OPENPOSE_3D_CAMERA_PARAMETER_READER_HPP diff --git a/usr/local/include/openpose/3d/headers.hpp b/usr/local/include/openpose/3d/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ed14f06ef004be4f04577c1f9d23e5c41ed0e6af --- /dev/null +++ b/usr/local/include/openpose/3d/headers.hpp @@ -0,0 +1,11 @@ +#ifndef OPENPOSE_3D_HEADERS_HPP +#define OPENPOSE_3D_HEADERS_HPP + +// 3d module +#include +#include +#include +#include +#include + +#endif // OPENPOSE_3D_HEADERS_HPP diff --git a/usr/local/include/openpose/3d/jointAngleEstimation.hpp b/usr/local/include/openpose/3d/jointAngleEstimation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f274e8a087884129f3c8210a9f51588e5c5fecd1 --- /dev/null +++ b/usr/local/include/openpose/3d/jointAngleEstimation.hpp @@ -0,0 +1,50 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_3D_JOINT_ANGLE_ESTIMATION_HPP +#define OPENPOSE_3D_JOINT_ANGLE_ESTIMATION_HPP + +#ifdef USE_EIGEN + #include +#endif +#ifdef USE_3D_ADAM_MODEL + #include +#endif +#include + +namespace op +{ + OP_API int mapOPToAdam(const int oPPart); + + class OP_API JointAngleEstimation + { + public: + static const std::shared_ptr getTotalModel(); + + JointAngleEstimation(const bool returnJacobian); + + virtual ~JointAngleEstimation(); + + void initializationOnThread(); + + void adamFastFit(Eigen::Matrix& adamPose, + Eigen::Vector3d& adamTranslation, + Eigen::Matrix& vtVec, + Eigen::Matrix& j0Vec, + Eigen::VectorXd& adamFacecoeffsExp, + const Array& poseKeypoints3D, + const Array& faceKeypoints3D, + const std::array, 2>& handKeypoints3D); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplJointAngleEstimation; + std::shared_ptr spImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(JointAngleEstimation); + }; +} + +#endif // OPENPOSE_3D_JOINT_ANGLE_ESTIMATION_HPP +#endif diff --git a/usr/local/include/openpose/3d/poseTriangulation.hpp b/usr/local/include/openpose/3d/poseTriangulation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aa50dce004fbc5c0737de68a60570c6fe6071ab5 --- /dev/null +++ b/usr/local/include/openpose/3d/poseTriangulation.hpp @@ -0,0 +1,30 @@ +#ifndef OPENPOSE_3D_POSE_TRIANGULATION_HPP +#define OPENPOSE_3D_POSE_TRIANGULATION_HPP + +#include + +namespace op +{ + class OP_API PoseTriangulation + { + public: + PoseTriangulation(const int minViews3d); + + virtual ~PoseTriangulation(); + + void initializationOnThread(); + + Array reconstructArray( + const std::vector>& keypointsVector, const std::vector& cameraMatrices, + const std::vector>& imageSizes) const; + + std::vector> reconstructArray( + const std::vector>>& keypointsVector, const std::vector& cameraMatrices, + const std::vector>& imageSizes) const; + + private: + const int mMinViews3d; + }; +} + +#endif // OPENPOSE_3D_POSE_TRIANGULATION_HPP diff --git a/usr/local/include/openpose/3d/wJointAngleEstimation.hpp b/usr/local/include/openpose/3d/wJointAngleEstimation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5c32a5add2e07bd40012ad555e2906ee54225a9f --- /dev/null +++ b/usr/local/include/openpose/3d/wJointAngleEstimation.hpp @@ -0,0 +1,101 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP +#define OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP + +#include +#include +#include + +namespace op +{ + template + class WJointAngleEstimation : public Worker + { + public: + explicit WJointAngleEstimation(const std::shared_ptr& jointAngleEstimation); + + virtual ~WJointAngleEstimation(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spJointAngleEstimation; + + DELETE_COPY(WJointAngleEstimation); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WJointAngleEstimation::WJointAngleEstimation(const std::shared_ptr& jointAngleEstimation) : + spJointAngleEstimation{jointAngleEstimation} + { + } + + template + WJointAngleEstimation::~WJointAngleEstimation() + { + } + + template + void WJointAngleEstimation::initializationOnThread() + { + try + { + spJointAngleEstimation->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WJointAngleEstimation::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Input + auto& tDatumPtr = tDatums->at(0); + const auto& poseKeypoints3D = tDatumPtr->poseKeypoints3D; + const auto& faceKeypoints3D = tDatumPtr->faceKeypoints3D; + const auto& handKeypoints3D = tDatumPtr->handKeypoints3D; + // Running Adam model + spJointAngleEstimation->adamFastFit( + tDatumPtr->adamPose, tDatumPtr->adamTranslation, tDatumPtr->vtVec, tDatumPtr->j0Vec, + tDatumPtr->adamFaceCoeffsExp, poseKeypoints3D, faceKeypoints3D, handKeypoints3D); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WJointAngleEstimation); +} + +#endif // OPENPOSE_3D_W_JOINT_ANGLE_ESTIMATION_HPP +#endif diff --git a/usr/local/include/openpose/3d/wPoseTriangulation.hpp b/usr/local/include/openpose/3d/wPoseTriangulation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4dca916c1d44501d5257b46f091a704e43550f53 --- /dev/null +++ b/usr/local/include/openpose/3d/wPoseTriangulation.hpp @@ -0,0 +1,119 @@ +#ifndef OPENPOSE_3D_W_POSE_TRIANGULATION_HPP +#define OPENPOSE_3D_W_POSE_TRIANGULATION_HPP + +#include +#include +#include + +namespace op +{ + template + class WPoseTriangulation : public Worker + { + public: + explicit WPoseTriangulation(const std::shared_ptr& poseTriangulation); + + virtual ~WPoseTriangulation(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spPoseTriangulation; + + DELETE_COPY(WPoseTriangulation); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPoseTriangulation::WPoseTriangulation(const std::shared_ptr& poseTriangulation) : + spPoseTriangulation{poseTriangulation} + { + } + + template + WPoseTriangulation::~WPoseTriangulation() + { + } + + template + void WPoseTriangulation::initializationOnThread() + { + try + { + spPoseTriangulation->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WPoseTriangulation::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // 3-D triangulation and reconstruction + std::vector cameraMatrices; + std::vector> poseKeypointVector; + std::vector> faceKeypointVector; + std::vector> leftHandKeypointVector; + std::vector> rightHandKeypointVector; + std::vector> imageSizes; + for (auto& tDatumPtr : *tDatums) + { + poseKeypointVector.emplace_back(tDatumPtr->poseKeypoints); + faceKeypointVector.emplace_back(tDatumPtr->faceKeypoints); + leftHandKeypointVector.emplace_back(tDatumPtr->handKeypoints[0]); + rightHandKeypointVector.emplace_back(tDatumPtr->handKeypoints[1]); + cameraMatrices.emplace_back(tDatumPtr->cameraMatrix); + imageSizes.emplace_back( + Point{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}); + } + // Pose 3-D reconstruction + auto poseKeypoints3Ds = spPoseTriangulation->reconstructArray( + {poseKeypointVector, faceKeypointVector, leftHandKeypointVector, rightHandKeypointVector}, + cameraMatrices, imageSizes); + // Assign to all tDatums + for (auto& tDatumPtr : *tDatums) + { + tDatumPtr->poseKeypoints3D = poseKeypoints3Ds[0]; + tDatumPtr->faceKeypoints3D = poseKeypoints3Ds[1]; + tDatumPtr->handKeypoints3D[0] = poseKeypoints3Ds[2]; + tDatumPtr->handKeypoints3D[1] = poseKeypoints3Ds[3]; + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPoseTriangulation); +} + +#endif // OPENPOSE_3D_W_POSE_TRIANGULATION_HPP diff --git a/usr/local/include/openpose/calibration/cameraParameterEstimation.hpp b/usr/local/include/openpose/calibration/cameraParameterEstimation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c32f4e8859641ccfc4fa25e19815179f3f5cf95e --- /dev/null +++ b/usr/local/include/openpose/calibration/cameraParameterEstimation.hpp @@ -0,0 +1,36 @@ +#ifndef OPENPOSE_CALIBRATION_CAMERA_PARAMETER_ESTIMATION_HPP +#define OPENPOSE_CALIBRATION_CAMERA_PARAMETER_ESTIMATION_HPP + +#include + +namespace op +{ + /** + * This function estimate and saves the intrinsic parameters (K and distortion coefficients). + * @param gridInnerCorners The Point of the board, i.e., the number of squares by width and height + * @param gridSquareSizeMm Floating number with the size of a square in your defined unit (point, millimeter,etc). + * @param flags Integer with the OpenCV flags for calibration (e.g., CALIB_RATIONAL_MODEL, + * CALIB_THIN_PRISM_MODEL, or CALIB_TILTED_MODEL) + * @param outputFilePath String with the name of the file where to write + */ + OP_API void estimateAndSaveIntrinsics( + const Point& gridInnerCorners, const float gridSquareSizeMm, const int flags, + const std::string& outputParameterFolder, const std::string& imageFolder, const std::string& serialNumber, + const bool saveImagesWithCorners = false); + + OP_API void estimateAndSaveExtrinsics( + const std::string& parameterFolder, const std::string& imageFolder, const Point& gridInnerCorners, + const float gridSquareSizeMm, const int index0, const int index1, const bool imagesAreUndistorted, + const bool combineCam0Extrinsics); + + OP_API void refineAndSaveExtrinsics( + const std::string& parameterFolder, const std::string& imageFolder, const Point& gridInnerCorners, + const float gridSquareSizeMm, const int numberCameras, const bool imagesAreUndistorted, + const bool saveImagesWithCorners = false); + + OP_API void estimateAndSaveSiftFile( + const Point& gridInnerCorners, const std::string& imageFolder, const int numberCameras, + const bool saveImagesWithCorners = false); +} + +#endif // OPENPOSE_CALIBRATION_CAMERA_PARAMETER_ESTIMATION_HPP diff --git a/usr/local/include/openpose/calibration/headers.hpp b/usr/local/include/openpose/calibration/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..55d0cc50c138b8aa4816df49bf9ca43c0cced57e --- /dev/null +++ b/usr/local/include/openpose/calibration/headers.hpp @@ -0,0 +1,7 @@ +#ifndef OPENPOSE_CALIBRATION_HEADERS_HPP +#define OPENPOSE_CALIBRATION_HEADERS_HPP + +// calibration module +#include + +#endif // OPENPOSE_CALIBRATION_HEADERS_HPP diff --git a/usr/local/include/openpose/core/array.hpp b/usr/local/include/openpose/core/array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7e0b707c008c73a69d82156d249dff8d094af3c1 --- /dev/null +++ b/usr/local/include/openpose/core/array.hpp @@ -0,0 +1,516 @@ +#ifndef OPENPOSE_CORE_ARRAY_HPP +#define OPENPOSE_CORE_ARRAY_HPP + +#include // std::shared_ptr +#include +#include +#include +#include + +namespace op +{ + /** + * Array: The OpenPose Basic Raw Data Container + * This template class implements a multidimensional data array. It is our basic data container, analogous to + * Mat in OpenCV, Tensor in Torch/TensorFlow or Blob in Caffe. + * It wraps a Matrix and a std::shared_ptr, both of them pointing to the same raw data. I.e. they both share the + * same memory, so we can read and modify this data in both formats with no performance impact. + * Hence, it keeps high performance while adding high-level functions. + */ + template + class Array + { + public: + // ------------------------------ Constructors and Data Allocator Functions ------------------------------ // + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + */ + explicit Array(const int size); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size = {}). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * `new T[3*5*2]`. + */ + explicit Array(const std::vector& sizes = {}); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const int size, const T value). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + * @param value Initial value for each component of the Array. + */ + Array(const int size, const T value); + + /** + * Array constructor. + * Equivalent to default constructor + reset(const std::vector& size, const T value). + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * `new T[3*5*2]`. + * @param value Initial value for each component of the Array. + */ + Array(const std::vector& sizes, const T value); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + Array(const int size, T* const dataPtr); + + /** + * Array constructor. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * `new T[3*5*2]`. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + Array(const std::vector& sizes, T* const dataPtr); + + /** + * Array constructor. + * @param array Array with the original data array to slice. + * @param index indicates the index of the array to extract. + * @param noCopy indicates whether to perform a copy. Copy will never go to undefined behavior, however, if + * noCopy == true, then: + * 1. It is faster, as no data copy is involved, but... + * 2. If the Array array goes out of scope, then the resulting Array will provoke an undefined behavior. + * 3. If the returned Array is modified, the information in the Array array will also be. + * @return Array with the same dimension than array expect the first dimension being 1. E.g., if array + * is {p,k,m}, the resulting Array is {1,k,m}. + */ + Array(const Array& array, const int index, const bool noCopy = false); + + /** + * Array constructor. It manually copies the Array into the new Array + * @param array Array with a format T2 different to the current Array type T. + */ + template + Array(const Array& array) : + Array{array.getSize()} + { + try + { + // Copy + for (auto i = 0u ; i < array.getVolume() ; i++) + pData[i] = T(array[i]); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + /** + * Copy constructor. + * It performs `fast copy`: For performance purpose, copying a Array or Datum or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Array. + * @param array Array to be copied. + */ + Array(const Array& array); + + /** + * Copy assignment. + * Similar to Array(const Array& array). + * @param array Array to be copied. + * @return The resulting Array. + */ + Array& operator=(const Array& array); + + /** + * Move constructor. + * It destroys the original Array to be moved. + * @param array Array to be moved. + */ + Array(Array&& array); + + /** + * Move assignment. + * Similar to Array(Array&& array). + * @param array Array to be moved. + * @return The resulting Array. + */ + Array& operator=(Array&& array); + + /** + * Clone function. + * Similar to cv::Mat::clone and Datum::clone. + * It performs a real but slow copy of the data, i.e., even if the copied element is modified, the original + * one is not. + * @return The resulting Array. + */ + Array clone() const; + + /** + * Data allocation function. + * It allocates the required space for the memory (it does not initialize that memory). + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + */ + void reset(const int size); + + /** + * Data allocation function. + * Similar to reset(const int size), but it allocates a multi-dimensional array of dimensions each of the + * values of the argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * `new T[3*5*2]`. + */ + void reset(const std::vector& sizes = {}); + + /** + * Data allocation function. + * Similar to reset(const int size), but initializing the data to the value specified by the second argument. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + * @param value Initial value for each component of the Array. + */ + void reset(const int size, const T value); + + /** + * Data allocation function. + * Similar to reset(const std::vector& size), but initializing the data to the value specified by the + * second argument. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to + * `new T[3*5*2]`. + * @param value Initial value for each component of the Array. + */ + void reset(const std::vector& sizes, const T value); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param size Integer with the number of T element to be allocated. E.g., size = 5 is internally similar to + * `new T[5]`. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + void reset(const int size, T* const dataPtr); + + /** + * Data allocation function. + * Equivalent to default constructor, but it does not allocate memory, but rather use dataPtr. + * @param sizes Vector with the size of each dimension. E.g., size = {3, 5, 2} is internally similar to: + * `new T[3*5*2]`. + * @param dataPtr Pointer to the memory to be used by the Array. + */ + void reset(const std::vector& sizes, T* const dataPtr); + + /** + * Data allocation function. + * It internally allocates memory and copies the data of the argument to the Array allocated memory. + * @param cvMat Matrix to be copied. + */ + void setFrom(const Matrix& cvMat); + + /** + * Data allocation function. + * It internally assigns all the allocated memory to the value indicated by the argument. + * @param value Value for each component of the Array. + */ + void setTo(const T value); + + + + // ------------------------------ Data Information Functions ------------------------------ // + /** + * Check whether memory has been allocated. + * @return True if no memory has been allocated, false otherwise. + */ + inline bool empty() const + { + return (mVolume == 0); + } + + /** + * Return a vector with the size of each dimension allocated. + * @return A std::vector with the size of each dimension. If no memory has been allocated, it will return + * an empty std::vector. + */ + inline std::vector getSize() const + { + return mSize; + } + + /** + * Return a vector with the size of the desired dimension. + * @param index Dimension to check its size. + * @return Size of the desired dimension. It will return 0 if the requested dimension is higher than the number + * of dimensions. + */ + int getSize(const int index) const; + + /** + * Return a string with the size of each dimension allocated. + * @return A std::stringwith the size of each dimension. If no memory has been allocated, it will return an + * empty string. + */ + std::string printSize() const; + + /** + * Return the total number of dimensions, equivalent to getSize().size(). + * @return The number of dimensions. If no memory is allocated, it returns 0. + */ + inline size_t getNumberDimensions() const + { + return mSize.size(); + } + + /** + * Return the total number of elements allocated, equivalent to multiply all the components from getSize(). + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements is: 2x5x3 = 30. + * @return The total volume of the allocated data. If no memory is allocated, it returns 0. + */ + inline size_t getVolume() const + { + return mVolume; + } + + /** + * Similar to getVolume(), but in this case it just returns the volume between the desired dimensions. + * E.g., for a Array of size = {2,5,3}, the volume or total number of elements for getVolume(1,2) is + * 5x3 = 15. + * @param indexA Dimension where to start. + * @param indexB Dimension where to stop. If indexB == -1, then it will take up to the last dimension. + * @return The total volume of the allocated data between the desired dimensions. If the index are out of + * bounds, it throws an error. + */ + size_t getVolume(const int indexA, const int indexB = -1) const; + + /** + * Return the stride or step size of the array. + * E.g., given and Array of size 5x3, getStride() would return the following vector: + * {5x3sizeof(T), 3sizeof(T), sizeof(T)}. + */ + std::vector getStride() const; + + /** + * Return the stride or step size of the array at the index-th dimension. + * E.g., given and Array of size 5x3, getStride(2) would return sizeof(T). + */ + int getStride(const int index) const; + + + + // ------------------------------ Data Access Functions And Operators ------------------------------ // + /** + * Return a raw pointer to the data. Similar to: std::shared_ptr::get(). + * Note: if you modify the pointer data, you will directly modify it in the Array instance too. + * If you know you do not want to modify the data, then use getConstPtr() instead. + * @return A raw pointer to the data. + */ + inline T* getPtr() + { + return pData; // spData.get() + } + + /** + * Similar to getPtr(), but it forbids the data to be edited. + * @return A raw const pointer to the data. + */ + inline const T* getConstPtr() const + { + return pData; // spData.get() + } + + /** + * Similar to getConstPtr(), but it allows the data to be edited. + * This function is only implemented for Pybind11 usage. + * @return A raw pointer to the data. + */ + inline T* getPseudoConstPtr() const + { + return pData; // spData.get() + } + + /** + * Return a Matrix wrapper to the data. It forbids the data to be modified. + * OpenCV only admits unsigned char, signed char, int, float & double. If the T class is not supported by + * OpenCV, it will throw an error. + * Note: Array does not return an editable Matrix because some OpenCV functions reallocate memory and it + * would not longer point to the Array instance. + * If you want to perform some OpenCV operation on the Array data, you can use: + * editedCvMat = array.getConstCvMat().clone(); + * // modify data + * array.setFrom(editedCvMat) + * @return A const Matrix pointing to the data. + */ + const Matrix& getConstCvMat() const; + + /** + * Analogous to getConstCvMat, but in this case it returns a editable Matrix. + * Very important: Only allowed functions which do not provoke data reallocation. + * E.g., resizing functions will not work and they would provoke an undefined behavior and/or execution + * crashes. + * @return A Matrix pointing to the data. + */ + Matrix& getCvMat(); + + /** + * [] operator + * Similar to the [] operator for raw pointer data. + * If debug mode is enabled, then it will check that the desired index is in the data range, and it will throw + * an exception otherwise (similar to the at operator). + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + inline T& operator[](const int index) + { + #ifdef NDEBUG + return pData[index]; // spData.get()[index] + #else + return at(index); + #endif + } + + /** + * [] operator + * Same functionality as operator[](const int index), but it forbids modifying the value. Otherwise, const + * functions would not be able to call the [] operator. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + inline const T& operator[](const int index) const + { + #ifdef NDEBUG + return pData[index]; // spData.get()[index] + #else + return at(index); + #endif + } + + /** + * [] operator + * Same functionality as operator[](const int index), but it lets the user introduce the multi-dimensional + * index. + * E.g., given a (10 x 10 x 10) array, array[11] is equivalent to array[{1,1,0}] + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + inline T& operator[](const std::vector& indexes) + { + return operator[](getIndex(indexes)); + } + + /** + * [] operator + * Same functionality as operator[](const std::vector& indexes), but it forbids modifying the value. + * Otherwise, const functions would not be able to call the [] operator. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + inline const T& operator[](const std::vector& indexes) const + { + return operator[](getIndex(indexes)); + } + + /** + * at() function + * Same functionality as operator[](const int index), but it always check whether the indexes are within the + * data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A editable reference to the data on the desired index location. + */ + inline T& at(const int index) + { + return commonAt(index); + } + + /** + * at() function + * Same functionality as operator[](const int index) const, but it always check whether the indexes are within + * the data bounds. Otherwise, it will throw an error. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + inline const T& at(const int index) const + { + return commonAt(index); + } + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes), but it always check whether the indexes + * are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A editable reference to the data on the desired index location. + */ + inline T& at(const std::vector& indexes) + { + return at(getIndexAndCheck(indexes)); + } + + /** + * at() function + * Same functionality as operator[](const std::vector& indexes) const, but it always check whether the + * indexes are within the data bounds. Otherwise, it will throw an error. + * @param indexes Vector with the desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + inline const T& at(const std::vector& indexes) const + { + return at(getIndexAndCheck(indexes)); + } + + /** + * It returns a string with the whole array data. Useful for debugging. + * The format is: values separated by a space, and a enter for each dimension. E.g., + * For the Array{2, 2, 3}, it will print: + * Array::toString(): + * x1 x2 x3 + * x4 x5 x6 + * + * x7 x8 x9 + * x10 x11 x12 + * @return A string with the array values in the above format. + */ + const std::string toString() const; + + private: + std::vector mSize; + size_t mVolume; + std::shared_ptr spData; + T* pData; // pData is a wrapper of spData. Used for Pybind11 binding. + std::pair mCvMatData; + + /** + * Auxiliary function that both operator[](const std::vector& indexes) and + * operator[](const std::vector& indexes) const use. + * It turn the multi-dimensions indexes into the 1-dimension equivalent index. + * @param indexes Vector with the desired memory location. + * @return The equivalent 1-D index. + */ + int getIndex(const std::vector& indexes) const; + + /** + * Similar to getIndex(const std::vector& indexes) const, but used for at(const std::vector& indexes) + * and at(const std::vector& indexes) const. + * It also checks whether the index is within the allocated memory. + * @param indexes Vector with the desired memory location. + * @return The equivalent 1-D index. + */ + int getIndexAndCheck(const std::vector& indexes) const; + + /** + * Auxiliary function that both at(const int index) and at(const int index) const use. + * @param index The desired memory location. + * @return A non-editable reference to the data on the desired index location. + */ + T& commonAt(const int index) const; + + void resetAuxiliary(const std::vector& sizes, T* const dataPtr = nullptr); + }; + + // Static methods + OVERLOAD_C_OUT(Array) +} + +#endif // OPENPOSE_CORE_ARRAY_HPP diff --git a/usr/local/include/openpose/core/arrayCpuGpu.hpp b/usr/local/include/openpose/core/arrayCpuGpu.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ed6451be578238b4bd876560324d7c76b848a490 --- /dev/null +++ b/usr/local/include/openpose/core/arrayCpuGpu.hpp @@ -0,0 +1,112 @@ +#ifndef OPENPOSE_CORE_ARRAY_CPU_GPU_HPP +#define OPENPOSE_CORE_ARRAY_CPU_GPU_HPP + +#include // std::shared_ptr +#include +#include +#include + +namespace op +{ + /** + * ArrayCpuGpu: Bind of caffe::Blob to avoid Caffe as dependency in the headers. + */ + template + class ArrayCpuGpu + { + public: + ArrayCpuGpu(); + /** + * @param caffeBlobTPtr should be a caffe::Blob* element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + explicit ArrayCpuGpu(const void* caffeBlobTPtr); + /** + * Create an ArrayCpuGpu from the data in the Array element (it will automatically copy that data). + * @param array Array where the data to be copied is. + * @param copyFromGpu If false (default), it will copy the data to the CPU. If true, it will copy it to the + * GPU memory (using CUDA copy function). + */ + explicit ArrayCpuGpu(const Array& array, const bool copyFromGpu); + explicit ArrayCpuGpu(const int num, const int channels, const int height, const int width); + // explicit ArrayCpuGpu(const std::vector& shape); + + void Reshape(const int num, const int channels, const int height, const int width); + void Reshape(const std::vector& shape); + // // void Reshape(const BlobShape& shape); + // // void ReshapeLike(const Blob& other); + // void ReshapeLike(const ArrayCpuGpu& other); + std::string shape_string() const; + const std::vector& shape() const; + int shape(const int index) const; + int num_axes() const; + int count() const; + int count(const int start_axis, const int end_axis) const; + int count(const int start_axis) const; + + int CanonicalAxisIndex(const int axis_index) const; + + int num() const; + int channels() const; + int height() const; + int width() const; + int LegacyShape(const int index) const; + + int offset(const int n, const int c = 0, const int h = 0, const int w = 0) const; + // int offset(const std::vector& indices) const; // Caffe warning + + // // void CopyFrom(const Blob& source, bool copy_diff = false, bool reshape = false); + // void CopyFrom(const ArrayCpuGpu& source, bool copy_diff = false, bool reshape = false); + + T data_at(const int n, const int c, const int h, const int w) const; + T diff_at(const int n, const int c, const int h, const int w) const; + // T data_at(const std::vector& index) const; // Caffe warning + // T diff_at(const std::vector& index) const; // Caffe warning + + // const boost::shared_ptr& data() const; + // const boost::shared_ptr& diff() const; + + const T* cpu_data() const; + void set_cpu_data(T* data); + const int* gpu_shape() const; + const T* gpu_data() const; + void set_gpu_data(T* data); + const T* cpu_diff() const; + const T* gpu_diff() const; + T* mutable_cpu_data(); + T* mutable_gpu_data(); + T* mutable_cpu_diff(); + T* mutable_gpu_diff(); + void Update(); + // void FromProto(const BlobProto& proto, bool reshape = true); + // void ToProto(BlobProto* proto, bool write_diff = false) const; + + T asum_data() const; + T asum_diff() const; + T sumsq_data() const; + T sumsq_diff() const; + + void scale_data(const T scale_factor); + void scale_diff(const T scale_factor); + + // void ShareData(const Blob& other); + // void ShareDiff(const Blob& other); + + // bool ShapeEquals(const BlobProto& other); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplArrayCpuGpu; + std::shared_ptr spImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(ArrayCpuGpu); + }; + + // // Static methods + // OVERLOAD_C_OUT(ArrayCpuGpu) +} + +#endif // OPENPOSE_CORE_ARRAY_CPU_GPU_HPP diff --git a/usr/local/include/openpose/core/common.hpp b/usr/local/include/openpose/core/common.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b30d99dc7c2b7eda99d2008aacb997e0fd870b4 --- /dev/null +++ b/usr/local/include/openpose/core/common.hpp @@ -0,0 +1,22 @@ +#ifndef OPENPOSE_CORE_COMMON_HPP +#define OPENPOSE_CORE_COMMON_HPP + +// Std library most used classes +#include +#include // std::shared_ptr, std::unique_ptr +#include +#include +// OpenPose most used classes +#include +#include +#include +#include +#include +#include +#include +#include +#include +// Datum at the end, otherwise circular dependency with array, point & rectangle +#include + +#endif // OPENPOSE_CORE_COMMON_HPP diff --git a/usr/local/include/openpose/core/cvMatToOpInput.hpp b/usr/local/include/openpose/core/cvMatToOpInput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7480051ec64e9df40689e096b0b14ffaa6688d45 --- /dev/null +++ b/usr/local/include/openpose/core/cvMatToOpInput.hpp @@ -0,0 +1,31 @@ +#ifndef OPENPOSE_CORE_CV_MAT_TO_OP_INPUT_HPP +#define OPENPOSE_CORE_CV_MAT_TO_OP_INPUT_HPP + +#include +#include + +namespace op +{ + class OP_API CvMatToOpInput + { + public: + CvMatToOpInput(const PoseModel poseModel = PoseModel::BODY_25, const bool gpuResize = false); + + virtual ~CvMatToOpInput(); + + std::vector> createArray( + const Matrix& inputData, const std::vector& scaleInputToNetInputs, + const std::vector>& netInputSizes); + + private: + const PoseModel mPoseModel; + const bool mGpuResize; + unsigned char* pInputImageCuda; + float* pInputImageReorderedCuda; + float* pOutputImageCuda; + unsigned long long pInputMaxSize; + unsigned long long pOutputMaxSize; + }; +} + +#endif // OPENPOSE_CORE_CV_MAT_TO_OP_INPUT_HPP diff --git a/usr/local/include/openpose/core/cvMatToOpOutput.hpp b/usr/local/include/openpose/core/cvMatToOpOutput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0644d74a7acd9e6bc98d714c2cb7e6e9c0d85924 --- /dev/null +++ b/usr/local/include/openpose/core/cvMatToOpOutput.hpp @@ -0,0 +1,31 @@ +#ifndef OPENPOSE_CORE_CV_MAT_TO_OP_OUTPUT_HPP +#define OPENPOSE_CORE_CV_MAT_TO_OP_OUTPUT_HPP + +#include + +namespace op +{ + class OP_API CvMatToOpOutput + { + public: + CvMatToOpOutput(const bool gpuResize = false); + + virtual ~CvMatToOpOutput(); + + std::tuple, std::shared_ptr, std::shared_ptr> + getSharedParameters(); + + Array createArray( + const Matrix& inputData, const double scaleInputToOutput, const Point& outputResolution); + + private: + const bool mGpuResize; + unsigned char* pInputImageCuda; + std::shared_ptr spOutputImageCuda; + unsigned long long pInputMaxSize; + std::shared_ptr spOutputMaxSize; + std::shared_ptr spGpuMemoryAllocated; + }; +} + +#endif // OPENPOSE_CORE_CV_MAT_TO_OP_OUTPUT_HPP diff --git a/usr/local/include/openpose/core/datum.hpp b/usr/local/include/openpose/core/datum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da93c6941fd4f3d0c890898672d2c430c85c0d46 --- /dev/null +++ b/usr/local/include/openpose/core/datum.hpp @@ -0,0 +1,410 @@ +#ifndef OPENPOSE_CORE_DATUM_HPP +#define OPENPOSE_CORE_DATUM_HPP + +#ifdef USE_3D_ADAM_MODEL + #ifdef USE_EIGEN + #include + #endif +#endif +#include + +namespace op +{ + /** + * Datum: The OpenPose Basic Piece of Information Between Threads + * Datum is one the main OpenPose classes/structs. The workers and threads share by default a + * std::shared_ptr>. It contains all the parameters that the different workers and threads need + * to exchange. + */ + struct OP_API Datum + { + // ---------------------------------------- ID parameters ---------------------------------------- // + unsigned long long id; /**< Datum ID. Internally used to sort the Datums if multi-threading is used. */ + + unsigned long long subId; /**< Datum sub-ID. Internally used to sort the Datums if multi-threading is used. */ + + unsigned long long subIdMax; /**< Datum maximum sub-ID. Used to sort the Datums if multi-threading is used. */ + + /** + * Name used when saving the data to disk (e.g., `write_images` or `write_keypoint` flags in the demo). + */ + std::string name; + + /** + * Corresponding frame number. + * If the producer (e.g., video) starts from frame 0 and does not repeat any frame, then frameNumber should + * match the field id. + */ + unsigned long long frameNumber; + + // ------------------------------ Input image and rendered version parameters ------------------------------ // + /** + * Original image to be processed in cv::Mat uchar format. + * Size: (input_width x input_height) x 3 channels + */ + Matrix cvInputData; + + /** + * Original image to be processed in Array format. + * It has been resized to the net input resolution, as well as reformatted Array format to be compatible + * with the net. + * If >1 scales, each scale is right- and bottom-padded to fill the greatest resolution. The + * scales are sorted from bigger to smaller. + * Vector size: #scales + * Each array size: 3 x input_net_height x input_net_width + */ + std::vector> inputNetData; + + /** + * Rendered image in Array format. + * It consists of a blending of the cvInputData and the pose/body part(s) heatmap/PAF(s). + * If rendering is disabled (e.g., `no_render_pose` flag in the demo), outputData will be empty. + * Size: 3 x output_net_height x output_net_width + */ + Array outputData; + + /** + * Rendered image in cv::Mat uchar format. + * It has been resized to the desired output resolution (e.g., `resolution` flag in the demo). + * If outputData is empty, cvOutputData will also be empty. + * Size: (output_height x output_width) x 3 channels + */ + Matrix cvOutputData; + + /** + * Rendered 3D image in cv::Mat uchar format. + */ + Matrix cvOutputData3D; + + // ------------------------------ Resulting Array data parameters ------------------------------ // + /** + * Body pose (x,y,score) locations for each person in the image. + * It has been resized to the desired output resolution (e.g., `resolution` flag in the demo). + * Size: #people x #body parts (e.g., 18 for COCO or 15 for MPI) x 3 ((x,y) coordinates + score) + */ + Array poseKeypoints; + + /** + * People ID + * It returns a person ID for each body pose, providing temporal consistency. The ID will be the same one + * for a person across frames. I.e. this ID allows to keep track of the same person in time. + * If either person identification is disabled or poseKeypoints is empty, poseIds will also be empty. + * Size: #people + */ + Array poseIds; + + /** + * Body pose global confidence/score for each person in the image. + * It does not only consider the score of each body keypoint, but also the score of each PAF association. + * Optimized for COCO evaluation metric. + * It will highly penalyze people with missing body parts (e.g., cropped people on the borders of the image). + * If poseKeypoints is empty, poseScores will also be empty. + * Size: #people + */ + Array poseScores; + + /** + * Body pose heatmaps (body parts, background and/or PAFs) for the whole image. + * This parameter is by default empty and disabled for performance. Each group (body parts, background and + * PAFs) can be individually enabled. + * #heatmaps = #body parts (if enabled) + 1 (if background enabled) + 2 x #PAFs (if enabled). Each PAF has 2 + * consecutive channels, one for x- and one for y-coordinates. + * Order heatmaps: body parts + background (as appears in POSE_BODY_PART_MAPPING) + (x,y) channel of each PAF + * (sorted as appears in POSE_BODY_PART_PAIRS). See `pose/poseParameters.hpp`. + * The user can choose the heatmaps normalization: ranges [0, 1], [-1, 1] or [0, 255]. Check the + * `heatmaps_scale` flag in {OpenPose_path}/doc/advanced/demo_advanced.md for more details. + * Size: #heatmaps x output_net_height x output_net_width + */ + Array poseHeatMaps; + + /** + * Body pose candidates for the whole image. + * This parameter is by default empty and disabled for performance. It can be enabled with `candidates_body`. + * Candidates refer to all the detected body parts, before being assembled into people. Note that the number + * of candidates is equal or higher than the number of body parts after being assembled into people. + * Size: #body parts x min(part candidates, POSE_MAX_PEOPLE) x 3 (x,y,score). + * Rather than vector, it should ideally be: + * std::array>, #BP> poseCandidates; + */ + std::vector>> poseCandidates; + + /** + * Face detection locations (x,y,width,height) for each person in the image. + * It is resized to cvInputData.size(). + * Size: #people + */ + std::vector> faceRectangles; + + /** + * Face keypoints (x,y,score) locations for each person in the image. + * It has been resized to the same resolution as `poseKeypoints`. + * Size: #people x #face parts (70) x 3 ((x,y) coordinates + score) + */ + Array faceKeypoints; + + /** + * Face pose heatmaps (face parts and/or background) for the whole image. + * Analogous of bodyHeatMaps applied to face. However, there is no PAFs and the size is different. + * Size: #people x #face parts (70) x output_net_height x output_net_width + */ + Array faceHeatMaps; + + /** + * Hand detection locations (x,y,width,height) for each person in the image. + * It is resized to cvInputData.size(). + * Size: #people + */ + std::vector, 2>> handRectangles; + + /** + * Hand keypoints (x,y,score) locations for each person in the image. + * It has been resized to the same resolution as `poseKeypoints`. + * handKeypoints[0] corresponds to left hands, and handKeypoints[1] to right ones. + * Size each Array: #people x #hand parts (21) x 3 ((x,y) coordinates + score) + */ + std::array, 2> handKeypoints; + + /** + * Hand pose heatmaps (hand parts and/or background) for the whole image. + * Analogous of faceHeatMaps applied to face. + * Size each Array: #people x #hand parts (21) x output_net_height x output_net_width + */ + std::array, 2> handHeatMaps; + + // ---------------------------------------- 3-D Reconstruction parameters ---------------------------------------- // + /** + * Body pose (x,y,z,score) locations for each person in the image. + * Size: #people x #body parts (e.g., 18 for COCO or 15 for MPI) x 4 ((x,y,z) coordinates + score) + */ + Array poseKeypoints3D; + + /** + * Face keypoints (x,y,z,score) locations for each person in the image. + * It has been resized to the same resolution as `poseKeypoints3D`. + * Size: #people x #face parts (70) x 4 ((x,y,z) coordinates + score) + */ + Array faceKeypoints3D; + + /** + * Hand keypoints (x,y,z,score) locations for each person in the image. + * It has been resized to the same resolution as `poseKeypoints3D`. + * handKeypoints[0] corresponds to left hands, and handKeypoints[1] to right ones. + * Size each Array: #people x #hand parts (21) x 4 ((x,y,z) coordinates + score) + */ + std::array, 2> handKeypoints3D; + + /** + * 3x4 camera matrix of the camera (equivalent to cameraIntrinsics * cameraExtrinsics). + */ + Matrix cameraMatrix; + + /** + * 3x4 extrinsic parameters of the camera. + */ + Matrix cameraExtrinsics; + + /** + * 3x3 intrinsic parameters of the camera. + */ + Matrix cameraIntrinsics; + + /** + * If it is not empty, OpenPose will not run its internal body pose estimation network and will instead use + * this data as the substitute of its network. The size of this element must match the size of the output of + * its internal network, or it will lead to core dumped (segmentation) errors. You can modify the pose + * estimation flags to match the dimension of both elements (e.g., `--net_resolution`, `--scale_number`, etc.). + */ + Array poseNetOutput; + + // ---------------------------------------- Other (internal) parameters ---------------------------------------- // + /** + * Scale ratio between the input Datum::cvInputData and the net input size. + */ + std::vector scaleInputToNetInputs; + + /** + * Size(s) (width x height) of the image(s) fed to the pose deep net. + * The size of the std::vector corresponds to the number of scales. + */ + std::vector> netInputSizes; + + /** + * Scale ratio between the input Datum::cvInputData and the output Datum::cvOutputData. + */ + double scaleInputToOutput; + + /** + * Size (width x height) of the image returned by the deep net. + */ + Point netOutputSize; + + /** + * Scale ratio between the net output and the final output Datum::cvOutputData. + */ + double scaleNetToOutput; + + /** + * Pair with the element key id POSE_BODY_PART_MAPPING on `pose/poseParameters.hpp` and its mapped value (e.g. + * 1 and "Neck"). + */ + std::pair elementRendered; + + // 3D/Adam parameters (experimental code not meant to be publicly used) + #ifdef USE_3D_ADAM_MODEL + // Adam/Unity params + std::vector adamPosePtr; + int adamPoseRows; + std::vector adamTranslationPtr; + std::vector vtVecPtr; + int vtVecRows; + std::vector j0VecPtr; + int j0VecRows; + std::vector adamFaceCoeffsExpPtr; + int adamFaceCoeffsExpRows; + #ifdef USE_EIGEN + // Adam/Unity params + Eigen::Matrix adamPose; + Eigen::Vector3d adamTranslation; + // Adam params (Jacobians) + Eigen::Matrix vtVec; + Eigen::Matrix j0Vec; + Eigen::VectorXd adamFaceCoeffsExp; + #endif + #endif + + + + + + // ---------------------------------------- Functions ---------------------------------------- // + /** + * Default constructor struct. + * It simply initializes the struct, id is temporary set to 0 and each other variable is assigned to its + * default value. + */ + explicit Datum(); + + /** + * Copy constructor. + * It performs `fast copy`: For performance purpose, copying a Datum or Array or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Array. + * @param datum Datum to be copied. + */ + Datum(const Datum& datum); + + /** + * Copy assignment. + * Similar to Datum::Datum(const Datum& datum). + * @param datum Datum to be copied. + * @return The resulting Datum. + */ + Datum& operator=(const Datum& datum); + + /** + * Move constructor. + * It destroys the original Datum to be moved. + * @param datum Datum to be moved. + */ + Datum(Datum&& datum); + + /** + * Move assignment. + * Similar to Datum::Datum(Datum&& datum). + * @param datum Datum to be moved. + * @return The resulting Datum. + */ + Datum& operator=(Datum&& datum); + + /** + * Destructor class. + * Declared virtual so that Datum can be inherited. + */ + virtual ~Datum(); + + /** + * Clone function. + * Similar to cv::Mat::clone and Array::clone. + * It performs a real but slow copy of the data, i.e., even if the copied element is modified, the original + * one is not. + * @return The resulting Datum. + */ + Datum clone() const; + + + + + + // ---------------------------------------- Comparison operators ---------------------------------------- // + /** + * Less comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator<(const Datum& datum) const + { + // return id < datum.id; + return id < datum.id || (id == datum.id && subId < datum.subId); + } + /** + * Greater comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator>(const Datum& datum) const + { + // return id > datum.id; + return id > datum.id || (id == datum.id && subId > datum.subId); + } + /** + * Less or equal comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator<=(const Datum& datum) const + { + // return id <= datum.id; + return id < datum.id || (id == datum.id && subId <= datum.subId); + } + /** + * Greater or equal comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator>=(const Datum& datum) const + { + // return id >= datum.id; + return id > datum.id || (id == datum.id && subId >= datum.subId); + } + /** + * Equal comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator==(const Datum& datum) const + { + // return id == datum.id; + return id == datum.id && subId == datum.subId; + } + /** + * Not equal comparison operator. + * @param datum Datum to be compared. + * @result Whether the instance satisfies the condition with respect to datum. + */ + inline bool operator!=(const Datum& datum) const + { + // return id != datum.id; + return id != datum.id || subId != datum.subId; + } + }; + + // Defines for Datum. Added here rather than in `macros.hpp` to avoid circular dependencies + #define BASE_DATUM Datum + #define BASE_DATUMS std::vector> + #define BASE_DATUMS_SH std::shared_ptr + #define DEFINE_TEMPLATE_DATUM(templateName) template class OP_API templateName + #define COMPILE_TEMPLATE_DATUM(templateName) extern template class templateName +} + +#endif // OPENPOSE_CORE_DATUM_HPP diff --git a/usr/local/include/openpose/core/enumClasses.hpp b/usr/local/include/openpose/core/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..783aa974a8deb3823f76c27aedb3138be7dd2808 --- /dev/null +++ b/usr/local/include/openpose/core/enumClasses.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_CORE_ENUM_CLASSES_HPP +#define OPENPOSE_CORE_ENUM_CLASSES_HPP + +namespace op +{ + enum class ScaleMode : unsigned char + { + InputResolution, + NetOutputResolution, + OutputResolution, + ZeroToOne, // [0, 1] + ZeroToOneFixedAspect, // [0, 1] + PlusMinusOne, // [-1, 1] + PlusMinusOneFixedAspect, // [-1, 1] + UnsignedChar, // [0, 255] + NoScale, + }; + + enum class HeatMapType : unsigned char + { + Parts, + Background, + PAFs, + }; + + enum class RenderMode : unsigned char + { + None, + Auto, // It will select Gpu if CUDA version, or Cpu otherwise + Cpu, + Gpu, + }; + + enum class ElementToRender : unsigned char + { + Skeleton, + Background, + AddKeypoints, + AddPAFs, + }; +} + +#endif // OPENPOSE_CORE_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/core/gpuRenderer.hpp b/usr/local/include/openpose/core/gpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b53f7feb20a6d7bf4558ce732e3d82536d7d79c --- /dev/null +++ b/usr/local/include/openpose/core/gpuRenderer.hpp @@ -0,0 +1,51 @@ +#ifndef OPENPOSE_CORE_GPU_RENDERER_HPP +#define OPENPOSE_CORE_GPU_RENDERER_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API GpuRenderer : public Renderer + { + public: + explicit GpuRenderer( + const float renderThreshold, const float alphaKeypoint, const float alphaHeatMap, + const bool blendOriginalFrame = true, const unsigned int elementToRender = 0u, + const unsigned int numberElementsToRender = 0u); + + virtual ~GpuRenderer(); + + std::tuple, std::shared_ptr, std::shared_ptr>, + std::shared_ptr, std::shared_ptr> + getSharedParameters(); + + void setSharedParametersAndIfLast( + const std::tuple, std::shared_ptr, std::shared_ptr>, + std::shared_ptr, std::shared_ptr>& tuple, + const bool isLast); + + void setSharedParameters( + const std::tuple, std::shared_ptr, + std::shared_ptr>& tuple); + + protected: + std::shared_ptr spGpuMemory; + + void cpuToGpuMemoryIfNotCopiedYet(const float* const cpuMemory, const unsigned long long memoryVolume); + + void gpuToCpuMemoryIfLastRenderer(float* cpuMemory, const unsigned long long memoryVolume); + + private: + std::shared_ptr spVolume; + bool mIsFirstRenderer; + bool mIsLastRenderer; + std::shared_ptr spGpuMemoryAllocated; + + DELETE_COPY(GpuRenderer); + }; +} + +#endif // OPENPOSE_CORE_GPU_RENDERER_HPP diff --git a/usr/local/include/openpose/core/headers.hpp b/usr/local/include/openpose/core/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a8a63c38b62eecc6a79680c4707dba951ed8bb2a --- /dev/null +++ b/usr/local/include/openpose/core/headers.hpp @@ -0,0 +1,32 @@ +#ifndef OPENPOSE_CORE_HEADERS_HPP +#define OPENPOSE_CORE_HEADERS_HPP + +// core module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_CORE_HEADERS_HPP diff --git a/usr/local/include/openpose/core/keepTopNPeople.hpp b/usr/local/include/openpose/core/keepTopNPeople.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f3e8a43388142fb5bdd841aae6afadb41a34e82b --- /dev/null +++ b/usr/local/include/openpose/core/keepTopNPeople.hpp @@ -0,0 +1,22 @@ +#ifndef OPENPOSE_CORE_KEEP_TOP_N_PEOPLE_HPP +#define OPENPOSE_CORE_KEEP_TOP_N_PEOPLE_HPP + +#include + +namespace op +{ + class OP_API KeepTopNPeople + { + public: + explicit KeepTopNPeople(const int numberPeopleMax); + + virtual ~KeepTopNPeople(); + + Array keepTopPeople(const Array& peopleArrays, const Array& poseScores) const; + + private: + const int mNumberPeopleMax; + }; +} + +#endif // OPENPOSE_CORE_KEEP_TOP_N_PEOPLE_HPP diff --git a/usr/local/include/openpose/core/keypointScaler.hpp b/usr/local/include/openpose/core/keypointScaler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a37da645b99044b963114e42d6fe8f50188c765f --- /dev/null +++ b/usr/local/include/openpose/core/keypointScaler.hpp @@ -0,0 +1,30 @@ +#ifndef OPENPOSE_CORE_KEYPOINT_SCALER_HPP +#define OPENPOSE_CORE_KEYPOINT_SCALER_HPP + +#include +#include + +namespace op +{ + class OP_API KeypointScaler + { + public: + explicit KeypointScaler(const ScaleMode scaleMode); + + virtual ~KeypointScaler(); + + void scale(Array& arrayToScale, const double scaleInputToOutput, const double scaleNetToOutput, + const Point& producerSize) const; + + void scale(std::vector>& arraysToScale, const double scaleInputToOutput, + const double scaleNetToOutput, const Point& producerSize) const; + + void scale(std::vector>>& poseCandidates, const double scaleInputToOutput, + const double scaleNetToOutput, const Point& producerSize) const; + + private: + const ScaleMode mScaleMode; + }; +} + +#endif // OPENPOSE_CORE_KEYPOINT_SCALER_HPP diff --git a/usr/local/include/openpose/core/macros.hpp b/usr/local/include/openpose/core/macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b84b016d43b0e699101773495be46f1fdf6d7c3 --- /dev/null +++ b/usr/local/include/openpose/core/macros.hpp @@ -0,0 +1,88 @@ +#ifndef OPENPOSE_CORE_MACROS_HPP +#define OPENPOSE_CORE_MACROS_HPP + +#include // std::chrono:: functionaligy, e.g., std::chrono::milliseconds +#include // std::shared_ptr +#include +#include +#include // std::this_thread +#include + +// OpenPose name and version +const std::string OPEN_POSE_NAME_STRING = "OpenPose"; +const std::string OPEN_POSE_VERSION_STRING = "1.7.0"; +const std::string OPEN_POSE_NAME_AND_VERSION = OPEN_POSE_NAME_STRING + " " + OPEN_POSE_VERSION_STRING; +// #define COMMERCIAL_LICENSE + +#ifndef _WIN32 + #define OP_API +#elif defined OP_EXPORTS + #define OP_API __declspec(dllexport) +#else + #define OP_API __declspec(dllimport) +#endif + +// Disable some Windows Warnings +#ifdef _WIN32 + #pragma warning(disable: 4251) // 'XXX': class 'YYY' needs to have dll-interface to be used by clients of class 'ZZZ' +#endif + +#define UNUSED(unusedVariable) (void)(unusedVariable) + +#define DELETE_COPY(className) \ + className(const className&) = delete; \ + className& operator=(const className&) = delete + +// Instantiate a class with all the basic types +#define COMPILE_TEMPLATE_BASIC_TYPES_CLASS(className) COMPILE_TEMPLATE_BASIC_TYPES(className, class) +#define COMPILE_TEMPLATE_BASIC_TYPES_STRUCT(className) COMPILE_TEMPLATE_BASIC_TYPES(className, struct) +#define COMPILE_TEMPLATE_BASIC_TYPES(className, classType) \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className + +// Instantiate a class with float and double specifications +#define COMPILE_TEMPLATE_FLOATING_TYPES_CLASS(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, class) +#define COMPILE_TEMPLATE_FLOATING_TYPES_STRUCT(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, struct) +#define COMPILE_TEMPLATE_FLOATING_TYPES(className, classType) \ + char gInstantiationGuard##className; \ + template classType OP_API className; \ + template classType OP_API className + +// Instantiate a class with float and double specifications +#define COMPILE_TEMPLATE_FLOATING_INT_TYPES_CLASS(className) COMPILE_TEMPLATE_FLOATING_INT_TYPES(className, class) +#define COMPILE_TEMPLATE_FLOATING_INT_TYPES_STRUCT(className) COMPILE_TEMPLATE_FLOATING_INT_TYPES(className, struct) +#define COMPILE_TEMPLATE_FLOATING_INT_TYPES(className, classType) \ + char gInstantiationGuard##className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className; \ + template classType OP_API className + +/** + * cout operator overload calling toString() function + * @return std::ostream containing output from toString() + */ +#define OVERLOAD_C_OUT(className) \ + template std::ostream &operator<<(std::ostream& ostream, const op::className& obj) \ + { \ + ostream << obj.toString(); \ + return ostream; \ + } + +// PIMPL does not work if function arguments need the 3rd-party class. Alternative: +// stackoverflow.com/questions/13978775/how-to-avoid-include-dependency-to-external-library?answertab=active#tab-top +struct dim3; + +#endif // OPENPOSE_CORE_MACROS_HPP diff --git a/usr/local/include/openpose/core/matrix.hpp b/usr/local/include/openpose/core/matrix.hpp new file mode 100644 index 0000000000000000000000000000000000000000..67d77812fb00b479b66845f0a21856ce0a71aee1 --- /dev/null +++ b/usr/local/include/openpose/core/matrix.hpp @@ -0,0 +1,208 @@ +#ifndef OPENPOSE_CORE_MAT_HPP +#define OPENPOSE_CORE_MAT_HPP + +#include // std::shared_ptr +#include + +namespace op +{ + // Convert from Matrix into cv::Mat. Usage example: + // #include + // ... + // cv::Mat opMat = OP2CVMAT(cv::Mat()); + #define OP_OP2CVMAT(opMat) \ + (*((cv::Mat*)((opMat).getCvMat()))) + + // Convert from Matrix into const cv::Mat. Usage example: + // #include + // ... + // cv::Mat opMat = OP2CVCONSTMAT(cv::Mat()); + #define OP_OP2CVCONSTMAT(opMat) \ + (*((cv::Mat*)((opMat).getConstCvMat()))) + + // Convert from cv::Mat into Matrix. Usage example: + // #include + // ... + // Matrix opMat = CV2OPMAT(Matrix()); + #define OP_CV2OPMAT(cvMat) \ + (op::Matrix((void*)&(cvMat))) + + // Convert from cv::Mat into const Matrix. Usage example: + // #include + // ... + // Matrix opMat = CV2OPCONSTMAT(Matrix()); + #define OP_CV2OPCONSTMAT(cvMat) \ + (op::Matrix((const void*)&(cvMat))) + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // std::vector opMats; // Assume filled + // OP_OP2CVVECTORMAT(cvMats, opMats); + #define OP_OP2CVVECTORMAT(cvMats, opMats) \ + std::vector cvMats; \ + for (auto& opMat : (opMats)) \ + { \ + const auto cvMat = OP_OP2CVCONSTMAT(opMat); \ + cvMats.emplace_back(cvMat); \ + } + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // std::vector cvMats; // Assume filled + // OP_CV2OPVECTORMAT(opMats, cvMats); + #define OP_CV2OPVECTORMAT(opMats, cvMats) \ + std::vector opMats; \ + for (auto& cvMat : (cvMats)) \ + { \ + const auto opMat = OP_CV2OPMAT(cvMat); \ + opMats.emplace_back(opMat); \ + } + + // Convert from std::vector into std::vector. Usage example: + // #include + // ... + // // Equivalents: + // OP_CV_VOID_FUNCTION(opMat, size()); + // // and + // OP_OP2CVMAT(cvMat, opMat); + // cvMat.size(); + #define OP_MAT_VOID_FUNCTION(opMat, function) \ + { \ + cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); \ + cvMat.function; \ + } + #define OP_CONST_MAT_VOID_FUNCTION(opMat, function) \ + { \ + const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); \ + cvMat.function; \ + } + #define OP_MAT_RETURN_FUNCTION(outputVariable, opMat, function) \ + { \ + cv::Mat cvMat = OP_OP2CVMAT(cvMat, opMat); \ + outputVariable = cvMat.function; \ + } + #define OP_CONST_MAT_RETURN_FUNCTION(outputVariable, opMat, function) \ + { \ + const cv::Mat cvMat = OP_OP2CVCONSTMAT(opMat); \ + outputVariable = cvMat.function; \ + } + + /** + * Matrix: Bind of cv::Mat to avoid OpenCV as dependency in the headers. + */ + class OP_API Matrix + { + public: + /** + * @param matrixesResized For 3-D OpenPose, if >1, it will assume the image is composed of + * numberImagesStackedHorizontally horizontally stacked images. It must be already resized to avoid + * internally allocating/removing elements of std::vector (to avoid errors if using different std DLLs) + * @param cvMatPtr should be a cv::Mat element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + static void splitCvMatIntoVectorMatrix(std::vector& matrixesResized, const void* const cvMatPtr); + + Matrix(); + + /** + * @param cvMatPtr should be a cv::Mat element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + explicit Matrix(const void* cvMatPtr); + + /** + * Analog to cv::Mat(int rows, int cols, int type, void *data, size_t step=AUTO_STEP) + */ + explicit Matrix(const int rows, const int cols, const int type); + + /** + * Analog to cv::Mat(int rows, int cols, int type, void *data, size_t step=AUTO_STEP) + * Very important: This Matrix will only "borrow" this pointer, so the caller must make sure to maintain the + * memory allocated until this Matrix destructor is called and also to handle the ucharPtr memory deallocation. + * @param ucharPtr should be a cv::Mat::data (or analog) element or it will provoke a core dumped. Done to + * avoid explicitly exposing 3rdparty libraries on the headers. + */ + explicit Matrix(const int rows, const int cols, const int type, void* cvMatPtr); + + Matrix clone() const; + + /** + * @return cv::Mat*. + */ + void* getCvMat(); + + /** + * @return const cv::Mat*. + */ + const void* getConstCvMat() const; + + /** + * Equivalent to cv::Mat::data + * @return A raw pointer to the internal data of cv::Mat. + */ + unsigned char* data(); + /** + * Equivalent to cv::Mat::data + * @return A raw pointer to the internal data of cv::Mat. + */ + const unsigned char* dataConst() const; + /** + * Similar to dataConst(), but it allows the data to be edited. + * This function is only implemented for Pybind11 usage. + * @return A raw pointer to the internal data of cv::Mat. + */ + unsigned char* dataPseudoConst() const; + + /** + * Equivalent to cv::Mat::eye + */ + static Matrix eye(const int rows, const int cols, const int type); + /** + * Equivalent to cv::Mat::cols + */ + int cols() const; + /** + * Equivalent to cv::Mat::rows + */ + int rows() const; + /** + * Equivalent to cv::Mat::size[dimension] + */ + int size(const int dimension) const; + /** + * Equivalent to cv::Mat::dims + */ + int dims() const; + + /** + * Equivalent to their analog cv::Mat functions + */ + bool isContinuous() const; + bool isSubmatrix() const; + size_t elemSize() const; + size_t elemSize1() const; + int type() const; + int depth() const; + int channels() const; + size_t step1(const int i = 0) const; + bool empty() const; + size_t total() const; + int checkVector(const int elemChannels, const int depth = -1, const bool requireContinuous = true) const; + + /** + * Similar to their analog cv::Mat functions + */ + void setTo(const double value); + void copyTo(Matrix& outputMat) const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplMatrix; + std::shared_ptr spImpl; + }; +} + +#endif // OPENPOSE_CORE_MAT_HPP diff --git a/usr/local/include/openpose/core/opOutputToCvMat.hpp b/usr/local/include/openpose/core/opOutputToCvMat.hpp new file mode 100644 index 0000000000000000000000000000000000000000..77eb2b4cc91416b0a2b51e9b8fe5cec81aa4e3f8 --- /dev/null +++ b/usr/local/include/openpose/core/opOutputToCvMat.hpp @@ -0,0 +1,32 @@ +#ifndef OPENPOSE_CORE_OP_OUTPUT_TO_CV_MAT_HPP +#define OPENPOSE_CORE_OP_OUTPUT_TO_CV_MAT_HPP + +#include + +namespace op +{ + class OP_API OpOutputToCvMat + { + public: + OpOutputToCvMat(const bool gpuResize = false); + + virtual ~OpOutputToCvMat(); + + void setSharedParameters( + const std::tuple, std::shared_ptr, std::shared_ptr>& tuple); + + Matrix formatToCvMat(const Array& outputData); + + private: + const bool mGpuResize; + // Shared variables + std::shared_ptr spOutputImageFloatCuda; + std::shared_ptr spOutputMaxSize; + std::shared_ptr spGpuMemoryAllocated; + // Local variables + unsigned char* pOutputImageUCharCuda; + unsigned long long mOutputMaxSizeUChar; + }; +} + +#endif // OPENPOSE_CORE_OP_OUTPUT_TO_CV_MAT_HPP diff --git a/usr/local/include/openpose/core/point.hpp b/usr/local/include/openpose/core/point.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f5486dadef08fd0220a9aa4ab79898e87886af2c --- /dev/null +++ b/usr/local/include/openpose/core/point.hpp @@ -0,0 +1,161 @@ +#ifndef OPENPOSE_CORE_POINT_HPP +#define OPENPOSE_CORE_POINT_HPP + +#include +#include + +namespace op +{ + template + struct Point + { + T x; + T y; + + Point(const T x = 0, const T y = 0); + + /** + * Copy constructor. + * It performs `fast copy`: For performance purpose, copying a Point or Point or cv::Mat just copies the + * reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Point. + * @param point Point to be copied. + */ + Point(const Point& point); + + /** + * Copy assignment. + * Similar to Point(const Point& point). + * @param point Point to be copied. + * @return The resulting Point. + */ + Point& operator=(const Point& point); + + /** + * Move constructor. + * It destroys the original Point to be moved. + * @param point Point to be moved. + */ + Point(Point&& point); + + /** + * Move assignment. + * Similar to Point(Point&& point). + * @param point Point to be moved. + * @return The resulting Point. + */ + Point& operator=(Point&& point); + + inline T area() const + { + return x * y; + } + + /** + * It returns a string with the whole Point data. Useful for debugging. + * The format is: `[x, y]` + * @return A string with the Point values in the above format. + */ + std::string toString() const; + + + + + + // ------------------------------ Comparison operators ------------------------------ // + /** + * Less comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator<(const Point& point) const + { + return area() < point.area(); + } + + /** + * Greater comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator>(const Point& point) const + { + return area() > point.area(); + } + + /** + * Less or equal comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator<=(const Point& point) const + { + return area() <= point.area(); + } + + /** + * Greater or equal comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator>=(const Point& point) const + { + return area() >= point.area(); + } + + /** + * Equal comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator==(const Point& point) const + { + return area() == point.area(); + } + + /** + * Not equal comparison operator. + * @param point Point to be compared. + * @result Whether the instance satisfies the condition with respect to point. + */ + inline bool operator!=(const Point& point) const + { + return area() != point.area(); + } + + + + + + // ------------------------------ Basic Operators ------------------------------ // + Point& operator+=(const Point& point); + + Point operator+(const Point& point) const; + + Point& operator+=(const T value); + + Point operator+(const T value) const; + + Point& operator-=(const Point& point); + + Point operator-(const Point& point) const; + + Point& operator-=(const T value); + + Point operator-(const T value) const; + + Point& operator*=(const T value); + + Point operator*(const T value) const; + + Point& operator/=(const T value); + + Point operator/(const T value) const; + }; + + // Static methods + OVERLOAD_C_OUT(Point) +} + +#endif // OPENPOSE_CORE_POINT_HPP diff --git a/usr/local/include/openpose/core/rectangle.hpp b/usr/local/include/openpose/core/rectangle.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5ffe0a5e6e189fdbb011915a1319d12b52647f9 --- /dev/null +++ b/usr/local/include/openpose/core/rectangle.hpp @@ -0,0 +1,93 @@ +#ifndef OPENPOSE_CORE_RECTANGLE_HPP +#define OPENPOSE_CORE_RECTANGLE_HPP + +#include +#include +#include + +namespace op +{ + template + struct Rectangle + { + T x; + T y; + T width; + T height; + + Rectangle(const T x = 0, const T y = 0, const T width = 0, const T height = 0); + + /** + * Copy constructor. + * It performs `fast copy`: For performance purpose, copying a Rectangle or Datum or cv::Mat just copies + * the reference, it still shares the same internal data. + * Modifying the copied element will modify the original one. + * Use clone() for a slower but real copy, similarly to cv::Mat and Rectangle. + * @param rectangle Rectangle to be copied. + */ + Rectangle(const Rectangle& rectangle); + + /** + * Copy assignment. + * Similar to Rectangle(const Rectangle& rectangle). + * @param rectangle Rectangle to be copied. + * @return The resulting Rectangle. + */ + Rectangle& operator=(const Rectangle& rectangle); + + /** + * Move constructor. + * It destroys the original Rectangle to be moved. + * @param rectangle Rectangle to be moved. + */ + Rectangle(Rectangle&& rectangle); + + /** + * Move assignment. + * Similar to Rectangle(Rectangle&& rectangle). + * @param rectangle Rectangle to be moved. + * @return The resulting Rectangle. + */ + Rectangle& operator=(Rectangle&& rectangle); + + Point center() const; + + inline Point topLeft() const + { + return Point{x, y}; + } + + Point bottomRight() const; + + inline T area() const + { + return width * height; + } + + void recenter(const T newWidth, const T newHeight); + + /** + * It returns a string with the whole Rectangle data. Useful for debugging. + * The format is: `[x, y, width, height]` + * @return A string with the Rectangle values in the above format. + */ + std::string toString() const; + + // ------------------------------ Basic Operators ------------------------------ // + Rectangle& operator*=(const T value); + + Rectangle operator*(const T value) const; + + Rectangle& operator/=(const T value); + + Rectangle operator/(const T value) const; + }; + + // Static methods + template + Rectangle recenter(const Rectangle& rectangle, const T newWidth, const T newHeight); + + OVERLOAD_C_OUT(Rectangle) +} + +#endif // OPENPOSE_CORE_RECTANGLE_HPP diff --git a/usr/local/include/openpose/core/renderer.hpp b/usr/local/include/openpose/core/renderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5fb0f3b81bb42f9a2ce6c7067d0264a033b7dc6 --- /dev/null +++ b/usr/local/include/openpose/core/renderer.hpp @@ -0,0 +1,56 @@ +#ifndef OPENPOSE_CORE_RENDERER_HPP +#define OPENPOSE_CORE_RENDERER_HPP + +#include +#include +#include + +namespace op +{ + class OP_API Renderer + { + public: + explicit Renderer(const float renderThreshold, const float alphaKeypoint, const float alphaHeatMap, + const bool blendOriginalFrame = true, const unsigned int elementToRender = 0u, + const unsigned int numberElementsToRender = 0u); + + virtual ~Renderer(); + + void increaseElementToRender(const int increment); + + void setElementToRender(const int elementToRender); + + void setElementToRender(const ElementToRender elementToRender); + + bool getBlendOriginalFrame() const; + + void setBlendOriginalFrame(const bool blendOriginalFrame); + + float getAlphaKeypoint() const; + + void setAlphaKeypoint(const float alphaKeypoint); + + float getAlphaHeatMap() const; + + void setAlphaHeatMap(const float alphaHeatMap); + + bool getShowGooglyEyes() const; + + void setShowGooglyEyes(const bool showGooglyEyes); + + protected: + const float mRenderThreshold; + std::atomic mBlendOriginalFrame; + std::shared_ptr> spElementToRender; + std::shared_ptr spNumberElementsToRender; + std::atomic mShowGooglyEyes; + + private: + float mAlphaKeypoint; + float mAlphaHeatMap; + + DELETE_COPY(Renderer); + }; +} + +#endif // OPENPOSE_CORE_RENDERER_HPP diff --git a/usr/local/include/openpose/core/scaleAndSizeExtractor.hpp b/usr/local/include/openpose/core/scaleAndSizeExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cace5a29086a4c445f56cb7d8a6b8ffbc0d3156b --- /dev/null +++ b/usr/local/include/openpose/core/scaleAndSizeExtractor.hpp @@ -0,0 +1,29 @@ +#ifndef OPENPOSE_CORE_SCALE_AND_SIZE_EXTRACTOR_HPP +#define OPENPOSE_CORE_SCALE_AND_SIZE_EXTRACTOR_HPP + +#include +#include + +namespace op +{ + class OP_API ScaleAndSizeExtractor + { + public: + ScaleAndSizeExtractor(const Point& netInputResolution, const float netInputResolutionDynamicBehavior, + const Point& outputResolution, const int scaleNumber = 1, const double scaleGap = 0.25); + + virtual ~ScaleAndSizeExtractor(); + + std::tuple, std::vector>, double, Point> extract( + const Point& inputResolution) const; + + private: + const Point mNetInputResolution; + const float mNetInputResolutionDynamicBehavior; + const Point mOutputSize; + const int mScaleNumber; + const double mScaleGap; + }; +} + +#endif // OPENPOSE_CORE_SCALE_AND_SIZE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/core/string.hpp b/usr/local/include/openpose/core/string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..76407204d601a7ef9a8d37d7f74bcdf12cc52090 --- /dev/null +++ b/usr/local/include/openpose/core/string.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_CORE_STRING_HPP +#define OPENPOSE_CORE_STRING_HPP + +#include // std::shared_ptr +#include +#include + +namespace op +{ + /** + * String: Basic container for std::string to avoid std::string in the WrapperStructXXX classes. Otherwise, + * cryptic runtime DLL errors could occur when exporting OpenPose to other projects using different STL DLLs. + */ + class OP_API String + { + public: + String(); + + /** + * It will force a copy of the char* of std::string to avoid DLL runtime errors. Example usages: + * std::string stdString = "This is a std::string"; + * String string(stdString.c_str()); + */ + String(const char* charPtr); + + /** + * It will force a copy of string + */ + explicit String(const std::string& string); + + const std::string& getStdString() const; + + bool empty() const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplString; + std::shared_ptr spImpl; + }; +} + +#endif // OPENPOSE_CORE_STRING_HPP diff --git a/usr/local/include/openpose/core/verbosePrinter.hpp b/usr/local/include/openpose/core/verbosePrinter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ccc1615b4c5c1b7aaad3cf371a4271d8190bdcd1 --- /dev/null +++ b/usr/local/include/openpose/core/verbosePrinter.hpp @@ -0,0 +1,24 @@ +#ifndef OPENPOSE_CORE_VERBOSE_PRINTER_HPP +#define OPENPOSE_CORE_VERBOSE_PRINTER_HPP + +#include + +namespace op +{ + class OP_API VerbosePrinter + { + public: + VerbosePrinter(const double verbose, const unsigned long long numberFrames); + + virtual ~VerbosePrinter(); + + void printVerbose(const unsigned long long frameNumber) const; + + private: + const unsigned long long mNumberFrames; + const std::string mNumberFramesString; + const double mVerbose; + }; +} + +#endif // OPENPOSE_CORE_VERBOSE_PRINTER_HPP diff --git a/usr/local/include/openpose/core/wCvMatToOpInput.hpp b/usr/local/include/openpose/core/wCvMatToOpInput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..80d08ffc3ef85af1133a8524eb2b2a0515609b89 --- /dev/null +++ b/usr/local/include/openpose/core/wCvMatToOpInput.hpp @@ -0,0 +1,86 @@ +#ifndef OPENPOSE_CORE_W_CV_MAT_TO_OP_INPUT_HPP +#define OPENPOSE_CORE_W_CV_MAT_TO_OP_INPUT_HPP + +#include +#include +#include + +namespace op +{ + template + class WCvMatToOpInput : public Worker + { + public: + explicit WCvMatToOpInput(const std::shared_ptr& cvMatToOpInput); + + virtual ~WCvMatToOpInput(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spCvMatToOpInput; + + DELETE_COPY(WCvMatToOpInput); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WCvMatToOpInput::WCvMatToOpInput(const std::shared_ptr& cvMatToOpInput) : + spCvMatToOpInput{cvMatToOpInput} + { + } + + template + WCvMatToOpInput::~WCvMatToOpInput() + { + } + + template + void WCvMatToOpInput::initializationOnThread() + { + } + + template + void WCvMatToOpInput::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // cv::Mat -> float* + for (auto& tDatumPtr : *tDatums) + tDatumPtr->inputNetData = spCvMatToOpInput->createArray( + tDatumPtr->cvInputData, tDatumPtr->scaleInputToNetInputs, tDatumPtr->netInputSizes); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WCvMatToOpInput); +} + +#endif // OPENPOSE_CORE_W_CV_MAT_TO_OP_INPUT_HPP diff --git a/usr/local/include/openpose/core/wCvMatToOpOutput.hpp b/usr/local/include/openpose/core/wCvMatToOpOutput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e4d819a6f2305f5409ac2c08fe78e47fa9e63d9f --- /dev/null +++ b/usr/local/include/openpose/core/wCvMatToOpOutput.hpp @@ -0,0 +1,89 @@ +#ifndef OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP +#define OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP + +#include +#include +#include + +namespace op +{ + template + class WCvMatToOpOutput : public Worker + { + public: + explicit WCvMatToOpOutput(const std::shared_ptr& cvMatToOpOutput); + + virtual ~WCvMatToOpOutput(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spCvMatToOpOutput; + + DELETE_COPY(WCvMatToOpOutput); + }; +} + + + + + +// Implementation +#include +#include +namespace op +{ + template + WCvMatToOpOutput::WCvMatToOpOutput(const std::shared_ptr& cvMatToOpOutput) : + spCvMatToOpOutput{cvMatToOpOutput} + { + } + + template + WCvMatToOpOutput::~WCvMatToOpOutput() + { + } + + template + void WCvMatToOpOutput::initializationOnThread() + { + } + + template + void WCvMatToOpOutput::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // cv::Mat -> float* + for (auto& tDatumPtr : tDatumsNoPtr) + tDatumPtr->outputData = spCvMatToOpOutput->createArray( + tDatumPtr->cvInputData, tDatumPtr->scaleInputToOutput, tDatumPtr->netOutputSize); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WCvMatToOpOutput); +} + +#endif // OPENPOSE_CORE_W_CV_MAT_TO_OP_OUTPUT_HPP diff --git a/usr/local/include/openpose/core/wKeepTopNPeople.hpp b/usr/local/include/openpose/core/wKeepTopNPeople.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b0dd7dd9e07b3a6ccebb065789876231a15f688e --- /dev/null +++ b/usr/local/include/openpose/core/wKeepTopNPeople.hpp @@ -0,0 +1,92 @@ +#ifndef OPENPOSE_CORE_W_KEEP_TOP_N_PEOPLE_HPP +#define OPENPOSE_CORE_W_KEEP_TOP_N_PEOPLE_HPP + +#include +#include +#include + +namespace op +{ + template + class WKeepTopNPeople : public Worker + { + public: + explicit WKeepTopNPeople(const std::shared_ptr& keepTopNPeople); + + virtual ~WKeepTopNPeople(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spKeepTopNPeople; + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WKeepTopNPeople::WKeepTopNPeople(const std::shared_ptr& keepTopNPeople) : + spKeepTopNPeople{keepTopNPeople} + { + } + + template + WKeepTopNPeople::~WKeepTopNPeople() + { + } + + template + void WKeepTopNPeople::initializationOnThread() + { + } + + template + void WKeepTopNPeople::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Rescale pose data + for (auto& tDatumPtr : *tDatums) + { + tDatumPtr->poseKeypoints = spKeepTopNPeople->keepTopPeople( + tDatumPtr->poseKeypoints, tDatumPtr->poseScores); + tDatumPtr->faceKeypoints = spKeepTopNPeople->keepTopPeople( + tDatumPtr->faceKeypoints, tDatumPtr->poseScores); + tDatumPtr->handKeypoints[0] = spKeepTopNPeople->keepTopPeople( + tDatumPtr->handKeypoints[0], tDatumPtr->poseScores); + tDatumPtr->handKeypoints[1] = spKeepTopNPeople->keepTopPeople( + tDatumPtr->handKeypoints[1], tDatumPtr->poseScores); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WKeepTopNPeople); +} + +#endif // OPENPOSE_CORE_W_KEEP_TOP_N_PEOPLE_HPP diff --git a/usr/local/include/openpose/core/wKeypointScaler.hpp b/usr/local/include/openpose/core/wKeypointScaler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..74ceaa2d97fde3df3f095931f7097b7c8450d213 --- /dev/null +++ b/usr/local/include/openpose/core/wKeypointScaler.hpp @@ -0,0 +1,94 @@ +#ifndef OPENPOSE_CORE_W_KEYPOINT_SCALER_HPP +#define OPENPOSE_CORE_W_KEYPOINT_SCALER_HPP + +#include +#include +#include + +namespace op +{ + template + class WKeypointScaler : public Worker + { + public: + explicit WKeypointScaler(const std::shared_ptr& keypointScaler); + + virtual ~WKeypointScaler(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spKeypointScaler; + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WKeypointScaler::WKeypointScaler(const std::shared_ptr& keypointScaler) : + spKeypointScaler{keypointScaler} + { + } + + template + WKeypointScaler::~WKeypointScaler() + { + } + + template + void WKeypointScaler::initializationOnThread() + { + } + + template + void WKeypointScaler::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Rescale pose data + for (auto& tDatumPtr : *tDatums) + { + std::vector> arraysToScale{ + tDatumPtr->poseKeypoints, tDatumPtr->handKeypoints[0], + tDatumPtr->handKeypoints[1], tDatumPtr->faceKeypoints}; + spKeypointScaler->scale( + arraysToScale, tDatumPtr->scaleInputToOutput, tDatumPtr->scaleNetToOutput, + Point{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}); + // Rescale part candidates + spKeypointScaler->scale( + tDatumPtr->poseCandidates, tDatumPtr->scaleInputToOutput, tDatumPtr->scaleNetToOutput, + Point{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WKeypointScaler); +} + +#endif // OPENPOSE_CORE_W_KEYPOINT_SCALER_HPP diff --git a/usr/local/include/openpose/core/wOpOutputToCvMat.hpp b/usr/local/include/openpose/core/wOpOutputToCvMat.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ececaa822ab3be3d72fb5f559284f98316835794 --- /dev/null +++ b/usr/local/include/openpose/core/wOpOutputToCvMat.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP +#define OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP + +#include +#include +#include + +namespace op +{ + template + class WOpOutputToCvMat : public Worker + { + public: + explicit WOpOutputToCvMat(const std::shared_ptr& opOutputToCvMat); + + virtual ~WOpOutputToCvMat(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spOpOutputToCvMat; + + DELETE_COPY(WOpOutputToCvMat); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WOpOutputToCvMat::WOpOutputToCvMat(const std::shared_ptr& opOutputToCvMat) : + spOpOutputToCvMat{opOutputToCvMat} + { + } + + template + WOpOutputToCvMat::~WOpOutputToCvMat() + { + } + + template + void WOpOutputToCvMat::initializationOnThread() + { + } + + template + void WOpOutputToCvMat::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // float* -> cv::Mat + for (auto& tDatumPtr : *tDatums) + tDatumPtr->cvOutputData = spOpOutputToCvMat->formatToCvMat(tDatumPtr->outputData); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WOpOutputToCvMat); +} + +#endif // OPENPOSE_CORE_W_OP_OUTPUT_TO_CV_MAT_HPP diff --git a/usr/local/include/openpose/core/wScaleAndSizeExtractor.hpp b/usr/local/include/openpose/core/wScaleAndSizeExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d9640a76c56b27cb7f71a498ad4468fc38a09e05 --- /dev/null +++ b/usr/local/include/openpose/core/wScaleAndSizeExtractor.hpp @@ -0,0 +1,90 @@ +#ifndef OPENPOSE_CORE_W_SCALE_AND_SIZE_EXTRACTOR_HPP +#define OPENPOSE_CORE_W_SCALE_AND_SIZE_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + template + class WScaleAndSizeExtractor : public Worker + { + public: + explicit WScaleAndSizeExtractor(const std::shared_ptr& scaleAndSizeExtractor); + + virtual ~WScaleAndSizeExtractor(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spScaleAndSizeExtractor; + + DELETE_COPY(WScaleAndSizeExtractor); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WScaleAndSizeExtractor::WScaleAndSizeExtractor( + const std::shared_ptr& scaleAndSizeExtractor) : + spScaleAndSizeExtractor{scaleAndSizeExtractor} + { + } + + template + WScaleAndSizeExtractor::~WScaleAndSizeExtractor() + { + } + + template + void WScaleAndSizeExtractor::initializationOnThread() + { + } + + template + void WScaleAndSizeExtractor::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // cv::Mat -> float* + for (auto& tDatumPtr : *tDatums) + { + const Point inputSize{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}; + std::tie(tDatumPtr->scaleInputToNetInputs, tDatumPtr->netInputSizes, tDatumPtr->scaleInputToOutput, + tDatumPtr->netOutputSize) = spScaleAndSizeExtractor->extract(inputSize); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WScaleAndSizeExtractor); +} + +#endif // OPENPOSE_CORE_W_SCALE_AND_SIZE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/core/wVerbosePrinter.hpp b/usr/local/include/openpose/core/wVerbosePrinter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5109bde9dc502f9069a6d4a5f51d243a6574ca79 --- /dev/null +++ b/usr/local/include/openpose/core/wVerbosePrinter.hpp @@ -0,0 +1,89 @@ +#ifndef OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP +#define OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP + +#include +#include +#include + +namespace op +{ + template + class WVerbosePrinter : public Worker + { + public: + explicit WVerbosePrinter(const std::shared_ptr& verbosePrinter); + + virtual ~WVerbosePrinter(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const std::shared_ptr spVerbosePrinter; + + DELETE_COPY(WVerbosePrinter); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WVerbosePrinter::WVerbosePrinter( + const std::shared_ptr& verbosePrinter) : + spVerbosePrinter{verbosePrinter} + { + } + + template + WVerbosePrinter::~WVerbosePrinter() + { + } + + template + void WVerbosePrinter::initializationOnThread() + { + } + + template + void WVerbosePrinter::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Print verbose + if (checkNoNullNorEmpty(tDatums)) + { + const auto tDatumPtr = (*tDatums)[0]; + spVerbosePrinter->printVerbose(tDatumPtr->frameNumber); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WVerbosePrinter); +} + +#endif // OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP diff --git a/usr/local/include/openpose/face/faceCpuRenderer.hpp b/usr/local/include/openpose/face/faceCpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3b8ec10ed17ed0f0141d682bcf0e5bf3c2fb4dba --- /dev/null +++ b/usr/local/include/openpose/face/faceCpuRenderer.hpp @@ -0,0 +1,25 @@ +#ifndef OPENPOSE_FACE_FACE_CPU_RENDERER_HPP +#define OPENPOSE_FACE_FACE_CPU_RENDERER_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API FaceCpuRenderer : public Renderer, public FaceRenderer + { + public: + FaceCpuRenderer(const float renderThreshold, const float alphaKeypoint = FACE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = FACE_DEFAULT_ALPHA_HEAT_MAP); + + virtual ~FaceCpuRenderer(); + + void renderFaceInherited(Array& outputData, const Array& faceKeypoints); + + DELETE_COPY(FaceCpuRenderer); + }; +} + +#endif // OPENPOSE_FACE_FACE_CPU_RENDERER_HPP diff --git a/usr/local/include/openpose/face/faceDetector.hpp b/usr/local/include/openpose/face/faceDetector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff9b7648a1da3cb7ad6d01eb3a95f0cf3ec897a3 --- /dev/null +++ b/usr/local/include/openpose/face/faceDetector.hpp @@ -0,0 +1,30 @@ +#ifndef OPENPOSE_FACE_FACE_DETECTOR_HPP +#define OPENPOSE_FACE_FACE_DETECTOR_HPP + +#include +#include + +namespace op +{ + class OP_API FaceDetector + { + public: + explicit FaceDetector(const PoseModel poseModel); + + virtual ~FaceDetector(); + + std::vector> detectFaces(const Array& poseKeypoints) const; + + private: + const unsigned int mNeck; + const unsigned int mNose; + const unsigned int mLEar; + const unsigned int mREar; + const unsigned int mLEye; + const unsigned int mREye; + + DELETE_COPY(FaceDetector); + }; +} + +#endif // OPENPOSE_FACE_FACE_DETECTOR_HPP diff --git a/usr/local/include/openpose/face/faceDetectorOpenCV.hpp b/usr/local/include/openpose/face/faceDetectorOpenCV.hpp new file mode 100644 index 0000000000000000000000000000000000000000..577aebef4b29681690665e9b016eee7418b243f7 --- /dev/null +++ b/usr/local/include/openpose/face/faceDetectorOpenCV.hpp @@ -0,0 +1,28 @@ +#ifndef OPENPOSE_FACE_FACE_DETECTOR_OPENCV_HPP +#define OPENPOSE_FACE_FACE_DETECTOR_OPENCV_HPP + +#include + +namespace op +{ + class OP_API FaceDetectorOpenCV + { + public: + explicit FaceDetectorOpenCV(const std::string& modelFolder); + + virtual ~FaceDetectorOpenCV(); + + // No thread-save + std::vector> detectFaces(const Matrix& inputData); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplFaceDetectorOpenCV; + std::unique_ptr upImpl; + + DELETE_COPY(FaceDetectorOpenCV); + }; +} + +#endif // OPENPOSE_FACE_FACE_DETECTOR_OPENCV_HPP diff --git a/usr/local/include/openpose/face/faceExtractorCaffe.hpp b/usr/local/include/openpose/face/faceExtractorCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6bc40c25e62a7a7d2e2fd9510c9d3729c7357f1c --- /dev/null +++ b/usr/local/include/openpose/face/faceExtractorCaffe.hpp @@ -0,0 +1,57 @@ +#ifndef OPENPOSE_FACE_FACE_EXTRACTOR_CAFFE_HPP +#define OPENPOSE_FACE_FACE_EXTRACTOR_CAFFE_HPP + +#include +#include +#include + +namespace op +{ + /** + * Face keypoint extractor class for Caffe framework. + */ + class OP_API FaceExtractorCaffe : public FaceExtractorNet + { + public: + /** + * Constructor of the FaceExtractor class. + * @param netInputSize Size at which the cropped image (where the face is located) is resized. + * @param netOutputSize Size of the final results. At the moment, it must be equal than netOutputSize. + */ + FaceExtractorCaffe(const Point& netInputSize, const Point& netOutputSize, + const std::string& modelFolder, const int gpuId, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect, + const bool enableGoogleLogging = true); + + virtual ~FaceExtractorCaffe(); + + /** + * This function must be call before using any other function. It must also be called inside the thread in + * which the functions are going to be used. + */ + void netInitializationOnThread(); + + /** + * This function extracts the face keypoints for each detected face in the image. + * @param faceRectangles location of the faces in the image. It is a length-variable std::vector, where + * each index corresponds to a different person in the image. Internally, a op::Rectangle + * (similar to cv::Rect for floating values) with the position of that face (or 0,0,0,0 if + * some face is missing, e.g., if a specific person has only half of the body inside the image). + * @param cvInputData Original image in Mat format and BGR format. + */ + void forwardPass(const std::vector>& faceRectangles, const Matrix& inputData); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplFaceExtractorCaffe; + std::unique_ptr upImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(FaceExtractorCaffe); + }; +} + +#endif // OPENPOSE_FACE_FACE_EXTRACTOR_CAFFE_HPP diff --git a/usr/local/include/openpose/face/faceExtractorNet.hpp b/usr/local/include/openpose/face/faceExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..19f06362af76c2a172c8c8759b106bf4f6987d37 --- /dev/null +++ b/usr/local/include/openpose/face/faceExtractorNet.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_FACE_FACE_EXTRACTOR_HPP +#define OPENPOSE_FACE_FACE_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + /** + * Face keypoint extractor class. + */ + class OP_API FaceExtractorNet + { + public: + /** + * Constructor of the FaceExtractorNet class. + * @param netInputSize Size at which the cropped image (where the face is located) is resized. + * @param netOutputSize Size of the final results. At the moment, it must be equal than netOutputSize. + */ + explicit FaceExtractorNet(const Point& netInputSize, const Point& netOutputSize, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect); + + /** + * Virtual destructor of the HandExtractor class. + * Required to allow inheritance. + */ + virtual ~FaceExtractorNet(); + + /** + * This function must be call before using any other function. It must also be called inside the thread in + * which the functions are going to be used. + */ + void initializationOnThread(); + + /** + * This function extracts the face keypoints for each detected face in the image. + * @param faceRectangles location of the faces in the image. It is a length-variable std::vector, where + * each index corresponds to a different person in the image. Internally, a op::Rectangle + * (similar to cv::Rect for floating values) with the position of that face (or 0,0,0,0 if + * some face is missing, e.g., if a specific person has only half of the body inside the image). + * @param cvInputData Original image in Mat format and BGR format. + */ + virtual void forwardPass(const std::vector>& faceRectangles, const Matrix& inputData) = 0; + + Array getHeatMaps() const; + + /** + * This function returns the face keypoins. VERY IMPORTANT: use getFaceKeypoints().clone() if the keypoints are + * going to be edited in a different thread. + * @return A Array with all the face keypoints. It follows the pose structure, i.e., the first dimension + * corresponds to all the people in the image, the second to each specific keypoint, and the third one to + * (x, y, score). + */ + Array getFaceKeypoints() const; + + bool getEnabled() const; + + void setEnabled(const bool enabled); + + protected: + const Point mNetOutputSize; + Array mFaceImageCrop; + Array mFaceKeypoints; + // HeatMaps parameters + Array mHeatMaps; + const ScaleMode mHeatMapScaleMode; + const std::vector mHeatMapTypes; + // Temporarily disable it + std::atomic mEnabled; + + virtual void netInitializationOnThread() = 0; + + private: + // Init with thread + std::thread::id mThreadId; + + void checkThread() const; + + DELETE_COPY(FaceExtractorNet); + }; +} + +#endif // OPENPOSE_FACE_FACE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/face/faceGpuRenderer.hpp b/usr/local/include/openpose/face/faceGpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f0d82a4b4c2dc06a1c0402df86dbdc888bb4f1da --- /dev/null +++ b/usr/local/include/openpose/face/faceGpuRenderer.hpp @@ -0,0 +1,34 @@ +#ifndef OPENPOSE_FACE_FACE_GPU_RENDERER_HPP +#define OPENPOSE_FACE_FACE_GPU_RENDERER_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API FaceGpuRenderer : public GpuRenderer, public FaceRenderer + { + public: + FaceGpuRenderer(const float renderThreshold, + const float alphaKeypoint = FACE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = FACE_DEFAULT_ALPHA_HEAT_MAP); + + virtual ~FaceGpuRenderer(); + + void initializationOnThread(); + + void renderFaceInherited(Array& outputData, const Array& faceKeypoints); + + private: + float* pGpuFace; // GPU aux memory + float* pMaxPtr; // GPU aux memory + float* pMinPtr; // GPU aux memory + float* pScalePtr; // GPU aux memory + + DELETE_COPY(FaceGpuRenderer); + }; +} + +#endif // OPENPOSE_FACE_FACE_GPU_RENDERER_HPP diff --git a/usr/local/include/openpose/face/faceParameters.hpp b/usr/local/include/openpose/face/faceParameters.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a5f1141d1e8538a8f7865dbb4b13cd42f4f626e9 --- /dev/null +++ b/usr/local/include/openpose/face/faceParameters.hpp @@ -0,0 +1,33 @@ +#ifndef OPENPOSE_FACE_FACE_PARAMETERS_HPP +#define OPENPOSE_FACE_FACE_PARAMETERS_HPP + +#include +#include + +namespace op +{ + const auto FACE_MAX_FACES = POSE_MAX_PEOPLE; + + const auto FACE_NUMBER_PARTS = 70u; + #define FACE_PAIRS_RENDER_GPU \ + 0,1, 1,2, 2,3, 3,4, 4,5, 5,6, 6,7, 7,8, 8,9, 9,10, 10,11, 11,12, 12,13, 13,14, 14,15, 15,16, 17,18, 18,19, 19,20, \ + 20,21, 22,23, 23,24, 24,25, 25,26, 27,28, 28,29, 29,30, 31,32, 32,33, 33,34, 34,35, 36,37, 37,38, 38,39, 39,40, 40,41, \ + 41,36, 42,43, 43,44, 44,45, 45,46, 46,47, 47,42, 48,49, 49,50, 50,51, 51,52, 52,53, 53,54, 54,55, 55,56, 56,57, 57,58, \ + 58,59, 59,48, 60,61, 61,62, 62,63, 63,64, 64,65, 65,66, 66,67, 67,60 + #define FACE_SCALES_RENDER_GPU 1 + const std::vector FACE_PAIRS_RENDER {FACE_PAIRS_RENDER_GPU}; + #define FACE_COLORS_RENDER_GPU 255.f, 255.f, 255.f + const std::vector FACE_COLORS_RENDER{FACE_COLORS_RENDER_GPU}; + const std::vector FACE_SCALES_RENDER{FACE_SCALES_RENDER_GPU}; + + // Constant parameters + const auto FACE_CCN_DECREASE_FACTOR = 8.f; + const std::string FACE_PROTOTXT{"face/pose_deploy.prototxt"}; + const std::string FACE_TRAINED_MODEL{"face/pose_iter_116000.caffemodel"}; + + // Rendering parameters + const auto FACE_DEFAULT_ALPHA_KEYPOINT = POSE_DEFAULT_ALPHA_KEYPOINT; + const auto FACE_DEFAULT_ALPHA_HEAT_MAP = POSE_DEFAULT_ALPHA_HEAT_MAP; +} + +#endif // OPENPOSE_FACE_FACE_PARAMETERS_HPP diff --git a/usr/local/include/openpose/face/faceRenderer.hpp b/usr/local/include/openpose/face/faceRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9cea5f9ef638966a8eddb20c7c5a03e81c835be2 --- /dev/null +++ b/usr/local/include/openpose/face/faceRenderer.hpp @@ -0,0 +1,23 @@ +#ifndef OPENPOSE_FACE_FACE_RENDERER_HPP +#define OPENPOSE_FACE_FACE_RENDERER_HPP + +#include + +namespace op +{ + class OP_API FaceRenderer + { + public: + virtual ~FaceRenderer(){}; + + virtual void initializationOnThread(){}; + + void renderFace(Array& outputData, const Array& faceKeypoints, + const float scaleInputToOutput); + + private: + virtual void renderFaceInherited(Array& outputData, const Array& faceKeypoints) = 0; + }; +} + +#endif // OPENPOSE_FACE_FACE_RENDERER_HPP diff --git a/usr/local/include/openpose/face/headers.hpp b/usr/local/include/openpose/face/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c0ecce607251ec8d714d733a208c2bc21d99f52b --- /dev/null +++ b/usr/local/include/openpose/face/headers.hpp @@ -0,0 +1,19 @@ +#ifndef OPENPOSE_FACE_HEADERS_HPP +#define OPENPOSE_FACE_HEADERS_HPP + +// face module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_FACE_HEADERS_HPP diff --git a/usr/local/include/openpose/face/renderFace.hpp b/usr/local/include/openpose/face/renderFace.hpp new file mode 100644 index 0000000000000000000000000000000000000000..771618b9de5ebeddc54cb7bbbbf9cfd73c4520d9 --- /dev/null +++ b/usr/local/include/openpose/face/renderFace.hpp @@ -0,0 +1,18 @@ +#ifndef OPENPOSE_FACE_RENDER_FACE_HPP +#define OPENPOSE_FACE_RENDER_FACE_HPP + +#include +#include + +namespace op +{ + OP_API void renderFaceKeypointsCpu( + Array& frameArray, const Array& faceKeypoints, const float renderThreshold); + + void renderFaceKeypointsGpu( + float* framePtr, float* maxPtr, float* minPtr, float* scalePtr, const Point& frameSize, + const float* const facePtr, const int numberPeople, const float renderThreshold, + const float alphaColorToAdd = FACE_DEFAULT_ALPHA_KEYPOINT); +} + +#endif // OPENPOSE_FACE_RENDER_FACE_HPP diff --git a/usr/local/include/openpose/face/wFaceDetector.hpp b/usr/local/include/openpose/face/wFaceDetector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f5da5f08367a7e1c487a93c714690a8bacc730b6 --- /dev/null +++ b/usr/local/include/openpose/face/wFaceDetector.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_FACE_W_FACE_EXTRACTOR_HPP +#define OPENPOSE_FACE_W_FACE_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + template + class WFaceDetector : public Worker + { + public: + explicit WFaceDetector(const std::shared_ptr& faceDetector); + + virtual ~WFaceDetector(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spFaceDetector; + + DELETE_COPY(WFaceDetector); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WFaceDetector::WFaceDetector(const std::shared_ptr& faceDetector) : + spFaceDetector{faceDetector} + { + } + + template + WFaceDetector::~WFaceDetector() + { + } + + template + void WFaceDetector::initializationOnThread() + { + } + + template + void WFaceDetector::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people face + for (auto& tDatumPtr : *tDatums) + tDatumPtr->faceRectangles = spFaceDetector->detectFaces(tDatumPtr->poseKeypoints); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFaceDetector); +} + +#endif // OPENPOSE_FACE_W_FACE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/face/wFaceDetectorOpenCV.hpp b/usr/local/include/openpose/face/wFaceDetectorOpenCV.hpp new file mode 100644 index 0000000000000000000000000000000000000000..098b3fec1076539164ee6f637d3f5b76cbe5214d --- /dev/null +++ b/usr/local/include/openpose/face/wFaceDetectorOpenCV.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_FACE_W_FACE_EXTRACTOR_OPENCV_HPP +#define OPENPOSE_FACE_W_FACE_EXTRACTOR_OPENCV_HPP + +#include +#include +#include + +namespace op +{ + template + class WFaceDetectorOpenCV : public Worker + { + public: + explicit WFaceDetectorOpenCV(const std::shared_ptr& faceDetectorOpenCV); + + virtual ~WFaceDetectorOpenCV(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spFaceDetectorOpenCV; + + DELETE_COPY(WFaceDetectorOpenCV); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WFaceDetectorOpenCV::WFaceDetectorOpenCV(const std::shared_ptr& faceDetectorOpenCV) : + spFaceDetectorOpenCV{faceDetectorOpenCV} + { + } + + template + WFaceDetectorOpenCV::~WFaceDetectorOpenCV() + { + } + + template + void WFaceDetectorOpenCV::initializationOnThread() + { + } + + template + void WFaceDetectorOpenCV::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people face + for (auto& tDatumPtr : *tDatums) + tDatumPtr->faceRectangles = spFaceDetectorOpenCV->detectFaces(tDatumPtr->cvInputData); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFaceDetectorOpenCV); +} + +#endif // OPENPOSE_FACE_W_FACE_EXTRACTOR_OPENCV_HPP diff --git a/usr/local/include/openpose/face/wFaceExtractorNet.hpp b/usr/local/include/openpose/face/wFaceExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9139bd4ac040e4b41e93f6e91234e161c1a0097f --- /dev/null +++ b/usr/local/include/openpose/face/wFaceExtractorNet.hpp @@ -0,0 +1,90 @@ +#ifndef OPENPOSE_FACE_W_FACE_DETECTOR_NET_HPP +#define OPENPOSE_FACE_W_FACE_DETECTOR_NET_HPP + +#include +#include +#include + +namespace op +{ + template + class WFaceExtractorNet : public Worker + { + public: + explicit WFaceExtractorNet(const std::shared_ptr& faceExtractorNet); + + virtual ~WFaceExtractorNet(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spFaceExtractorNet; + + DELETE_COPY(WFaceExtractorNet); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WFaceExtractorNet::WFaceExtractorNet(const std::shared_ptr& faceExtractorNet) : + spFaceExtractorNet{faceExtractorNet} + { + } + + template + WFaceExtractorNet::~WFaceExtractorNet() + { + } + + template + void WFaceExtractorNet::initializationOnThread() + { + spFaceExtractorNet->initializationOnThread(); + } + + template + void WFaceExtractorNet::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Extract people face + for (auto& tDatumPtr : *tDatums) + { + spFaceExtractorNet->forwardPass(tDatumPtr->faceRectangles, tDatumPtr->cvInputData); + tDatumPtr->faceHeatMaps = spFaceExtractorNet->getHeatMaps().clone(); + tDatumPtr->faceKeypoints = spFaceExtractorNet->getFaceKeypoints().clone(); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFaceExtractorNet); +} + +#endif // OPENPOSE_FACE_W_FACE_DETECTOR_NET_HPP diff --git a/usr/local/include/openpose/face/wFaceRenderer.hpp b/usr/local/include/openpose/face/wFaceRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0986631cc9a856c1ecfa41aad1a1e41a2e441bfc --- /dev/null +++ b/usr/local/include/openpose/face/wFaceRenderer.hpp @@ -0,0 +1,87 @@ +#ifndef OPENPOSE_FACE_W_FACE_RENDERER_HPP +#define OPENPOSE_FACE_W_FACE_RENDERER_HPP + +#include +#include +#include + +namespace op +{ + template + class WFaceRenderer : public Worker + { + public: + explicit WFaceRenderer(const std::shared_ptr& faceRenderer); + + virtual ~WFaceRenderer(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spFaceRenderer; + + DELETE_COPY(WFaceRenderer); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WFaceRenderer::WFaceRenderer(const std::shared_ptr& faceRenderer) : + spFaceRenderer{faceRenderer} + { + } + + template + WFaceRenderer::~WFaceRenderer() + { + } + + template + void WFaceRenderer::initializationOnThread() + { + spFaceRenderer->initializationOnThread(); + } + + template + void WFaceRenderer::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Render people face + for (auto& tDatumPtr : *tDatums) + spFaceRenderer->renderFace( + tDatumPtr->outputData, tDatumPtr->faceKeypoints, (float)tDatumPtr->scaleInputToOutput); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFaceRenderer); +} + +#endif // OPENPOSE_FACE_W_FACE_RENDERER_HPP diff --git a/usr/local/include/openpose/filestream/bvhSaver.hpp b/usr/local/include/openpose/filestream/bvhSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ee708ff8681bbaddf02e0fd26e49a96c3784745 --- /dev/null +++ b/usr/local/include/openpose/filestream/bvhSaver.hpp @@ -0,0 +1,41 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_FILESTREAM_BVH_SAVER_HPP +#define OPENPOSE_FILESTREAM_BVH_SAVER_HPP + +#ifdef USE_3D_ADAM_MODEL + #include +#endif +#include + +namespace op +{ + class OP_API BvhSaver + { + public: + BvhSaver(const std::string bvhFilePath, + const std::shared_ptr& totalModel = nullptr, + const double fps = 30.); + + virtual ~BvhSaver(); + + void initializationOnThread(); + + void updateBvh(const Eigen::Matrix& adamPose, + const Eigen::Vector3d& adamTranslation, + const Eigen::Matrix& j0Vec); + + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplBvhSaver; + std::shared_ptr spImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(BvhSaver); + }; +} + +#endif // OPENPOSE_FILESTREAM_BVH_SAVER_HPP +#endif diff --git a/usr/local/include/openpose/filestream/cocoJsonSaver.hpp b/usr/local/include/openpose/filestream/cocoJsonSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4d5cc35e95755222bdb1fdd76246571aef0ade2 --- /dev/null +++ b/usr/local/include/openpose/filestream/cocoJsonSaver.hpp @@ -0,0 +1,44 @@ +#ifndef OPENPOSE_FILESTREAM_POSE_JSON_COCO_SAVER_HPP +#define OPENPOSE_FILESTREAM_POSE_JSON_COCO_SAVER_HPP + +#include +#include +#include +#include + +namespace op +{ + /** + * The CocoJsonSaver class creates a COCO validation json file with details about the processed images. It + * inherits from Recorder. + */ + class OP_API CocoJsonSaver + { + public: + /** + * This constructor of CocoJsonSaver extends the Recorder::Recorder(const std::string & filePathToSave) + * constructor. + * @param filePathToSave const std::string parameter with the final file path where the generated json file + * will be saved. + */ + explicit CocoJsonSaver( + const std::string& filePathToSave, const PoseModel poseModel, const bool humanReadable = true, + const int cocoJsonVariants = 1, const CocoJsonFormat cocoJsonFormat = CocoJsonFormat::Body, + const int cocoJsonVariant = 0); + + virtual ~CocoJsonSaver(); + + void record( + const Array& poseKeypoints, const Array& poseScores, const std::string& imageName, + const unsigned long long frameNumber); + + private: + const PoseModel mPoseModel; + const int mCocoJsonVariant; + std::vector> mJsonOfstreams; + + DELETE_COPY(CocoJsonSaver); + }; +} + +#endif // OPENPOSE_FILESTREAM_POSE_JSON_COCO_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/enumClasses.hpp b/usr/local/include/openpose/filestream/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff8e984fe8d32e0a6d56b3161e3e97fd730739df --- /dev/null +++ b/usr/local/include/openpose/filestream/enumClasses.hpp @@ -0,0 +1,26 @@ +#ifndef OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP +#define OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP + +namespace op +{ + enum class DataFormat : unsigned char + { + Json, + Xml, + Yaml, + Yml, + }; + + enum class CocoJsonFormat : unsigned char + { + Body, + Hand21, + Hand42, + Face, + Foot, + Car, + Size, + }; +} + +#endif // OPENPOSE_FILESTREAM_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/filestream/fileSaver.hpp b/usr/local/include/openpose/filestream/fileSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..610ff0acc42aee8445778c4ded8b6dcbfb040f78 --- /dev/null +++ b/usr/local/include/openpose/filestream/fileSaver.hpp @@ -0,0 +1,25 @@ +#ifndef OPENPOSE_FILESTREAM_DATA_SAVER_HPP +#define OPENPOSE_FILESTREAM_DATA_SAVER_HPP + +#include +#include + +namespace op +{ + class OP_API FileSaver + { + protected: + explicit FileSaver(const std::string& directoryPath); + + virtual ~FileSaver(); + + std::string getNextFileName(const unsigned long long index) const; + + std::string getNextFileName(const std::string& fileNameNoExtension) const; + + private: + const std::string mDirectoryPath; + }; +} + +#endif // OPENPOSE_FILESTREAM_DATA_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/fileStream.hpp b/usr/local/include/openpose/filestream/fileStream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c6478d67ba87a712b88b1dafbb911f9a914e581e --- /dev/null +++ b/usr/local/include/openpose/filestream/fileStream.hpp @@ -0,0 +1,64 @@ +#ifndef OPENPOSE_FILESTREAM_FILE_STREAM_HPP +#define OPENPOSE_FILESTREAM_FILE_STREAM_HPP + +#include +#include +#include + +namespace op +{ + OP_API std::string dataFormatToString(const DataFormat dataFormat); + + OP_API DataFormat stringToDataFormat(const std::string& dataFormat); + + // Save custom float format + // Example to read it in Python, assuming a (18 x 300 x 500) size Array + // x = np.fromfile(heatMapFullPath, dtype=np.float32) + // assert x[0] == 3 # First parameter saves the number of dimensions (18x300x500 = 3 dimensions) + // shape_x = x[1:1+int(x[0])] + // assert len(shape_x[0]) == 3 # Number of dimensions + // assert shape_x[0] == 18 # Size of the first dimension + // assert shape_x[1] == 300 # Size of the second dimension + // assert shape_x[2] == 500 # Size of the third dimension + // arrayData = x[1+int(round(x[0])):] + OP_API void saveFloatArray(const Array& array, const std::string& fullFilePath); + + // Save/load json, xml, yaml, yml + OP_API void saveData( + const std::vector& opMats, const std::vector& cvMatNames, + const std::string& fileNameNoExtension, const DataFormat dataFormat); + + OP_API void saveData( + const Matrix& opMat, const std::string cvMatName, const std::string& fileNameNoExtension, + const DataFormat dataFormat); + + OP_API std::vector loadData( + const std::vector& cvMatNames, const std::string& fileNameNoExtension, + const DataFormat dataFormat); + + OP_API Matrix loadData( + const std::string& cvMatName, const std::string& fileNameNoExtension, const DataFormat dataFormat); + + // Json - Saving as *.json not available in OpenCV versions < 3.0, this function is a quick fix + OP_API void savePeopleJson( + const Array& keypoints, const std::vector>>& candidates, + const std::string& keypointName, const std::string& fileName, const bool humanReadable); + + // It will save a bunch of Array elements + OP_API void savePeopleJson( + const std::vector, std::string>>& keypointVector, + const std::vector>>& candidates, const std::string& fileName, + const bool humanReadable); + + // Save/load image + OP_API void saveImage( + const Matrix& matrix, const std::string& fullFilePath, + const std::vector& openCvCompressionParams + = {getCvImwriteJpegQuality(), 100, getCvImwritePngCompression(), 9}); + + OP_API Matrix loadImage(const std::string& fullFilePath, const int openCvFlags = getCvLoadImageAnydepth()); + + OP_API std::vector, 2>> loadHandDetectorTxt(const std::string& txtFilePath); +} + +#endif // OPENPOSE_FILESTREAM_FILE_STREAM_HPP diff --git a/usr/local/include/openpose/filestream/headers.hpp b/usr/local/include/openpose/filestream/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..68db0bc56a71d776f301cfa8f8b991366aa86bf1 --- /dev/null +++ b/usr/local/include/openpose/filestream/headers.hpp @@ -0,0 +1,29 @@ +#ifndef OPENPOSE_FILESTREAM_HEADERS_HPP +#define OPENPOSE_FILESTREAM_HEADERS_HPP + +// fileStream module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_FILESTREAM_HEADERS_HPP diff --git a/usr/local/include/openpose/filestream/heatMapSaver.hpp b/usr/local/include/openpose/filestream/heatMapSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c9c58a47cad3ad53b17d1a3bfeacc1366f365775 --- /dev/null +++ b/usr/local/include/openpose/filestream/heatMapSaver.hpp @@ -0,0 +1,23 @@ +#ifndef OPENPOSE_FILESTREAM_HEAT_MAP_SAVER_HPP +#define OPENPOSE_FILESTREAM_HEAT_MAP_SAVER_HPP + +#include +#include + +namespace op +{ + class OP_API HeatMapSaver : public FileSaver + { + public: + HeatMapSaver(const std::string& directoryPath, const std::string& imageFormat); + + virtual ~HeatMapSaver(); + + void saveHeatMaps(const std::vector>& heatMaps, const std::string& fileName) const; + + private: + const std::string mImageFormat; + }; +} + +#endif // OPENPOSE_FILESTREAM_HEAT_MAP_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/imageSaver.hpp b/usr/local/include/openpose/filestream/imageSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b1d9a0f561e4f9902ba8d44aa651d52fe5e153b --- /dev/null +++ b/usr/local/include/openpose/filestream/imageSaver.hpp @@ -0,0 +1,25 @@ +#ifndef OPENPOSE_FILESTREAM_IMAGE_SAVER_HPP +#define OPENPOSE_FILESTREAM_IMAGE_SAVER_HPP + +#include +#include + +namespace op +{ + class OP_API ImageSaver : public FileSaver + { + public: + ImageSaver(const std::string& directoryPath, const std::string& imageFormat); + + virtual ~ImageSaver(); + + void saveImages(const Matrix& cvOutputData, const std::string& fileName) const; + + void saveImages(const std::vector& matOutputDatas, const std::string& fileName) const; + + private: + const std::string mImageFormat; + }; +} + +#endif // OPENPOSE_FILESTREAM_IMAGE_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/jsonOfstream.hpp b/usr/local/include/openpose/filestream/jsonOfstream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..768ab6c942dccbbe556b133064da279439ac8483 --- /dev/null +++ b/usr/local/include/openpose/filestream/jsonOfstream.hpp @@ -0,0 +1,66 @@ +#ifndef OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP +#define OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP + +#include // std::ofstream +#include + +namespace op +{ + class OP_API JsonOfstream + { + public: + explicit JsonOfstream(const std::string& filePath, const bool humanReadable = true); + + /** + * Move constructor. + * It destroys the original JsonOfstream to be moved. + * @param array JsonOfstream to be moved. + */ + JsonOfstream(JsonOfstream&& jsonOfstream); + + /** + * Move assignment. + * Similar to JsonOfstream(JsonOfstream&& jsonOfstream). + * @param array JsonOfstream to be moved. + * @return The resulting JsonOfstream. + */ + JsonOfstream& operator=(JsonOfstream&& jsonOfstream); + + virtual ~JsonOfstream(); + + void objectOpen(); + + void objectClose(); + + void arrayOpen(); + + void arrayClose(); + + void version(const std::string& version); + + void key(const std::string& string); + + template + inline void plainText(const T& value) + { + *upOfstream << value; + } + + inline void comma() + { + *upOfstream << ","; + } + + void enter(); + + private: + bool mHumanReadable; + long long mBracesCounter; + long long mBracketsCounter; + std::unique_ptr upOfstream; // std::unique_ptr to solve std::move issue in GCC < 5 + + DELETE_COPY(JsonOfstream); + }; +} + +#endif // OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP diff --git a/usr/local/include/openpose/filestream/keypointSaver.hpp b/usr/local/include/openpose/filestream/keypointSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c30a6e1b4e9aeda6af854eab6121c601704ae48 --- /dev/null +++ b/usr/local/include/openpose/filestream/keypointSaver.hpp @@ -0,0 +1,25 @@ +#ifndef OPENPOSE_FILESTREAM_KEYPOINT_SAVER_HPP +#define OPENPOSE_FILESTREAM_KEYPOINT_SAVER_HPP + +#include +#include +#include + +namespace op +{ + class OP_API KeypointSaver : public FileSaver + { + public: + KeypointSaver(const std::string& directoryPath, const DataFormat format); + + virtual ~KeypointSaver(); + + void saveKeypoints(const std::vector>& keypointVector, const std::string& fileName, + const std::string& keypointName) const; + + private: + const DataFormat mFormat; + }; +} + +#endif // OPENPOSE_FILESTREAM_KEYPOINT_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/peopleJsonSaver.hpp b/usr/local/include/openpose/filestream/peopleJsonSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ed74df021329eb46e987be95882c34f583bdf6c --- /dev/null +++ b/usr/local/include/openpose/filestream/peopleJsonSaver.hpp @@ -0,0 +1,23 @@ +#ifndef OPENPOSE_FILESTREAM_PEOPLE_JSON_SAVER_HPP +#define OPENPOSE_FILESTREAM_PEOPLE_JSON_SAVER_HPP + +#include +#include + +namespace op +{ + class OP_API PeopleJsonSaver : public FileSaver + { + public: + PeopleJsonSaver(const std::string& directoryPath); + + virtual ~PeopleJsonSaver(); + + void save( + const std::vector, std::string>>& keypointVector, + const std::vector>>& candidates, const std::string& fileName, + const bool humanReadable = true) const; + }; +} + +#endif // OPENPOSE_FILESTREAM_PEOPLE_JSON_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/udpSender.hpp b/usr/local/include/openpose/filestream/udpSender.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dfbf2dcbd286fba48f57b7b243408827ca62964c --- /dev/null +++ b/usr/local/include/openpose/filestream/udpSender.hpp @@ -0,0 +1,31 @@ +#ifndef OPENPOSE_FILESTREAM_UDP_SENDER_HPP +#define OPENPOSE_FILESTREAM_UDP_SENDER_HPP + +#include + +namespace op +{ + class OP_API UdpSender + { + public: + UdpSender(const std::string& udpHost, const std::string& udpPort); + + virtual ~UdpSender(); + + void sendJointAngles(const double* const adamPosePtr, const int adamPoseRows, + const double* const adamTranslationPtr, + const double* const adamFaceCoeffsExpPtr, const int faceCoeffRows); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplUdpSender; + std::shared_ptr spImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(UdpSender); + }; +} + +#endif // OPENPOSE_FILESTREAM_UDP_SENDER_HPP diff --git a/usr/local/include/openpose/filestream/videoSaver.hpp b/usr/local/include/openpose/filestream/videoSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f300ed03fd5c5ca444fa38e5cbda4a42a4b0ba83 --- /dev/null +++ b/usr/local/include/openpose/filestream/videoSaver.hpp @@ -0,0 +1,33 @@ +#ifndef OPENPOSE_FILESTREAM_VIDEO_SAVER_HPP +#define OPENPOSE_FILESTREAM_VIDEO_SAVER_HPP + +#include + +namespace op +{ + class OP_API VideoSaver + { + public: + VideoSaver( + const std::string& videoSaverPath, const int cvFourcc, const double fps, + const std::string& addAudioFromThisVideo = ""); + + virtual ~VideoSaver(); + + bool isOpened(); + + void write(const Matrix& matToSave); + + void write(const std::vector& matsToSave); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplVideoSaver; + std::unique_ptr upImpl; + + DELETE_COPY(VideoSaver); + }; +} + +#endif // OPENPOSE_FILESTREAM_VIDEO_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wBvhSaver.hpp b/usr/local/include/openpose/filestream/wBvhSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..16335295107a22de91d71792d36118ebbc9310ee --- /dev/null +++ b/usr/local/include/openpose/filestream/wBvhSaver.hpp @@ -0,0 +1,87 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_FILESTREAM_W_BVH_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_BVH_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WBvhSaver : public WorkerConsumer + { + public: + explicit WBvhSaver(const std::shared_ptr& bvhSaver); + + virtual ~WBvhSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spBvhSaver; + + DELETE_COPY(WBvhSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WBvhSaver::WBvhSaver(const std::shared_ptr& bvhSaver) : + spBvhSaver{bvhSaver} + { + } + + template + WBvhSaver::~WBvhSaver() + { + } + + template + void WBvhSaver::initializationOnThread() + { + } + + template + void WBvhSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Record BVH file + const auto& tDatumPtr = (*tDatums)[0]; + if (!tDatumPtr->poseKeypoints3D.empty()) + spBvhSaver->updateBvh(tDatumPtr->adamPose, tDatumPtr->adamTranslation, tDatumPtr->j0Vec); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WBvhSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_BVH_SAVER_HPP +#endif diff --git a/usr/local/include/openpose/filestream/wCocoJsonSaver.hpp b/usr/local/include/openpose/filestream/wCocoJsonSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3712dbf806c813d640c6027bc664be33a67040fe --- /dev/null +++ b/usr/local/include/openpose/filestream/wCocoJsonSaver.hpp @@ -0,0 +1,89 @@ +#ifndef OPENPOSE_FILESTREAM_W_COCO_JSON_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_COCO_JSON_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WCocoJsonSaver : public WorkerConsumer + { + public: + explicit WCocoJsonSaver(const std::shared_ptr& cocoJsonSaver); + + virtual ~WCocoJsonSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spCocoJsonSaver; + + DELETE_COPY(WCocoJsonSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WCocoJsonSaver::WCocoJsonSaver(const std::shared_ptr& cocoJsonSaver) : + spCocoJsonSaver{cocoJsonSaver} + { + } + + template + WCocoJsonSaver::~WCocoJsonSaver() + { + } + + template + void WCocoJsonSaver::initializationOnThread() + { + } + + template + void WCocoJsonSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Check tDatums->size() == 1 + if (tDatums->size() > 1) + error("Function only ready for tDatums->size() == 1", __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + const auto& tDatumPtr = tDatums->at(0); + // Record json in COCO format + spCocoJsonSaver->record( + tDatumPtr->poseKeypoints, tDatumPtr->poseScores, tDatumPtr->name, tDatumPtr->frameNumber); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WCocoJsonSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_COCO_JSON_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wFaceSaver.hpp b/usr/local/include/openpose/filestream/wFaceSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d0806dd4725a91453a1cf655b6d95c7b4e75a804 --- /dev/null +++ b/usr/local/include/openpose/filestream/wFaceSaver.hpp @@ -0,0 +1,91 @@ +#ifndef OPENPOSE_FILESTREAM_W_FACE_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_FACE_SAVER_HPP + +#include +#include +#include +#include + +namespace op +{ + template + class WFaceSaver : public WorkerConsumer + { + public: + explicit WFaceSaver(const std::shared_ptr& keypointSaver); + + virtual ~WFaceSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spKeypointSaver; + + DELETE_COPY(WFaceSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WFaceSaver::WFaceSaver(const std::shared_ptr& keypointSaver) : + spKeypointSaver{keypointSaver} + { + } + + template + WFaceSaver::~WFaceSaver() + { + } + + template + void WFaceSaver::initializationOnThread() + { + } + + template + void WFaceSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record people face keypoint data + std::vector> keypointVector(tDatumsNoPtr.size()); + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + keypointVector[i] = tDatumsNoPtr[i]->faceKeypoints; + const auto fileName = (!tDatumsNoPtr[0]->name.empty() + ? tDatumsNoPtr[0]->name : std::to_string(tDatumsNoPtr[0]->id)); + spKeypointSaver->saveKeypoints(keypointVector, fileName, "face"); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFaceSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_FACE_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wHandSaver.hpp b/usr/local/include/openpose/filestream/wHandSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0d6fb158eef138d25065885a08aaeab8eddad75c --- /dev/null +++ b/usr/local/include/openpose/filestream/wHandSaver.hpp @@ -0,0 +1,96 @@ +#ifndef OPENPOSE_FILESTREAM_W_HAND_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_HAND_SAVER_HPP + +#include +#include +#include +#include + +namespace op +{ + template + class WHandSaver : public WorkerConsumer + { + public: + explicit WHandSaver(const std::shared_ptr& keypointSaver); + + virtual ~WHandSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spKeypointSaver; + + DELETE_COPY(WHandSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandSaver::WHandSaver(const std::shared_ptr& keypointSaver) : + spKeypointSaver{keypointSaver} + { + } + + template + WHandSaver::~WHandSaver() + { + } + + template + void WHandSaver::initializationOnThread() + { + } + + template + void WHandSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record people hand keypoint data + const auto fileName = (!tDatumsNoPtr[0]->name.empty() + ? tDatumsNoPtr[0]->name : std::to_string(tDatumsNoPtr[0]->id)); + std::vector> keypointVector(tDatumsNoPtr.size()); + // Left hand + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + keypointVector[i] = tDatumsNoPtr[i]->handKeypoints[0]; + spKeypointSaver->saveKeypoints(keypointVector, fileName, "hand_left"); + // Right hand + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + keypointVector[i] = tDatumsNoPtr[i]->handKeypoints[1]; + spKeypointSaver->saveKeypoints(keypointVector, fileName, "hand_right"); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_HAND_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wHeatMapSaver.hpp b/usr/local/include/openpose/filestream/wHeatMapSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5a897a49e345968f7de3cf2b2f29e2db795e7805 --- /dev/null +++ b/usr/local/include/openpose/filestream/wHeatMapSaver.hpp @@ -0,0 +1,91 @@ +#ifndef OPENPOSE_FILESTREAM_W_HEAT_MAP_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_HEAT_MAP_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WHeatMapSaver : public WorkerConsumer + { + public: + explicit WHeatMapSaver(const std::shared_ptr& heatMapSaver); + + virtual ~WHeatMapSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spHeatMapSaver; + + DELETE_COPY(WHeatMapSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHeatMapSaver::WHeatMapSaver(const std::shared_ptr& heatMapSaver) : + spHeatMapSaver{heatMapSaver} + { + } + + template + WHeatMapSaver::~WHeatMapSaver() + { + } + + template + void WHeatMapSaver::initializationOnThread() + { + } + + template + void WHeatMapSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record pose heatmap image(s) on disk + std::vector> poseHeatMaps(tDatumsNoPtr.size()); + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + poseHeatMaps[i] = tDatumsNoPtr[i]->poseHeatMaps; + const auto fileName = (!tDatumsNoPtr[0]->name.empty() + ? tDatumsNoPtr[0]->name : std::to_string(tDatumsNoPtr[0]->id)) + "_pose_heatmaps"; + spHeatMapSaver->saveHeatMaps(poseHeatMaps, fileName); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, + __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHeatMapSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_HEAT_MAP_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wImageSaver.hpp b/usr/local/include/openpose/filestream/wImageSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..66a4289957eb66234803303da132ef28f293b0b9 --- /dev/null +++ b/usr/local/include/openpose/filestream/wImageSaver.hpp @@ -0,0 +1,90 @@ +#ifndef OPENPOSE_FILESTREAM_W_IMAGE_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_IMAGE_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WImageSaver : public WorkerConsumer + { + public: + explicit WImageSaver(const std::shared_ptr& imageSaver); + + virtual ~WImageSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spImageSaver; + + DELETE_COPY(WImageSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WImageSaver::WImageSaver(const std::shared_ptr& imageSaver) : + spImageSaver{imageSaver} + { + } + + template + WImageSaver::~WImageSaver() + { + } + + template + void WImageSaver::initializationOnThread() + { + } + + template + void WImageSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record image(s) on disk + std::vector opOutputDatas(tDatumsNoPtr.size()); + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + opOutputDatas[i] = tDatumsNoPtr[i]->cvOutputData; + const auto fileName = (!tDatumsNoPtr[0]->name.empty() + ? tDatumsNoPtr[0]->name : std::to_string(tDatumsNoPtr[0]->id)); + spImageSaver->saveImages(opOutputDatas, fileName); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WImageSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_IMAGE_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wPeopleJsonSaver.hpp b/usr/local/include/openpose/filestream/wPeopleJsonSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b17741b80c3345950b50019e357f3bd219d316f2 --- /dev/null +++ b/usr/local/include/openpose/filestream/wPeopleJsonSaver.hpp @@ -0,0 +1,113 @@ +#ifndef OPENPOSE_FILESTREAM_W_PEOPLE_JSON_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_PEOPLE_JSON_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WPeopleJsonSaver : public WorkerConsumer + { + public: + explicit WPeopleJsonSaver(const std::shared_ptr& peopleJsonSaver); + + virtual ~WPeopleJsonSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spPeopleJsonSaver; + + DELETE_COPY(WPeopleJsonSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPeopleJsonSaver::WPeopleJsonSaver(const std::shared_ptr& peopleJsonSaver) : + spPeopleJsonSaver{peopleJsonSaver} + { + } + + template + WPeopleJsonSaver::~WPeopleJsonSaver() + { + } + + template + void WPeopleJsonSaver::initializationOnThread() + { + } + + template + void WPeopleJsonSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Save body/face/hand keypoints to JSON file + const auto& tDatumFirstPtr = (*tDatums)[0]; + const auto baseFileName = (!tDatumFirstPtr->name.empty() ? tDatumFirstPtr->name + : std::to_string(tDatumFirstPtr->id)) + "_keypoints"; + const bool humanReadable = false; + for (auto i = 0u ; i < tDatums->size() ; i++) + { + const auto& tDatumPtr = (*tDatums)[i]; + // const auto fileName = baseFileName; + const auto fileName = baseFileName + (i != 0 ? "_" + std::to_string(i) : ""); + + // Pose IDs from long long to float + Array poseIds{tDatumPtr->poseIds}; + + const std::vector, std::string>> keypointVector{ + // Pose IDs + std::make_pair(poseIds, "person_id"), + // 2D + std::make_pair(tDatumPtr->poseKeypoints, "pose_keypoints_2d"), + std::make_pair(tDatumPtr->faceKeypoints, "face_keypoints_2d"), + std::make_pair(tDatumPtr->handKeypoints[0], "hand_left_keypoints_2d"), + std::make_pair(tDatumPtr->handKeypoints[1], "hand_right_keypoints_2d"), + // 3D + std::make_pair(tDatumPtr->poseKeypoints3D, "pose_keypoints_3d"), + std::make_pair(tDatumPtr->faceKeypoints3D, "face_keypoints_3d"), + std::make_pair(tDatumPtr->handKeypoints3D[0], "hand_left_keypoints_3d"), + std::make_pair(tDatumPtr->handKeypoints3D[1], "hand_right_keypoints_3d") + }; + // Save keypoints + spPeopleJsonSaver->save( + keypointVector, tDatumPtr->poseCandidates, fileName, humanReadable); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPeopleJsonSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_PEOPLE_JSON_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wPoseSaver.hpp b/usr/local/include/openpose/filestream/wPoseSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..efeeaeb723cffcb2e5b772a6ca41904f8600c376 --- /dev/null +++ b/usr/local/include/openpose/filestream/wPoseSaver.hpp @@ -0,0 +1,91 @@ +#ifndef OPENPOSE_FILESTREAM_W_POSE_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_POSE_SAVER_HPP + +#include +#include +#include +#include + +namespace op +{ + template + class WPoseSaver : public WorkerConsumer + { + public: + explicit WPoseSaver(const std::shared_ptr& keypointSaver); + + virtual ~WPoseSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spKeypointSaver; + + DELETE_COPY(WPoseSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPoseSaver::WPoseSaver(const std::shared_ptr& keypointSaver) : + spKeypointSaver{keypointSaver} + { + } + + template + WPoseSaver::~WPoseSaver() + { + } + + template + void WPoseSaver::initializationOnThread() + { + } + + template + void WPoseSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record people pose keypoint data + std::vector> keypointVector(tDatumsNoPtr.size()); + for (auto i = 0u; i < tDatumsNoPtr.size(); i++) + keypointVector[i] = tDatumsNoPtr[i]->poseKeypoints; + const auto fileName = (!tDatumsNoPtr[0]->name.empty() + ? tDatumsNoPtr[0]->name : std::to_string(tDatumsNoPtr[0]->id)); + spKeypointSaver->saveKeypoints(keypointVector, fileName, "pose"); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPoseSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_POSE_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wUdpSender.hpp b/usr/local/include/openpose/filestream/wUdpSender.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5f88c152eb7e9f698592f019b9c8fee8deca9226 --- /dev/null +++ b/usr/local/include/openpose/filestream/wUdpSender.hpp @@ -0,0 +1,103 @@ +#ifndef OPENPOSE_FILESTREAM_W_UDP_SENDER_HPP +#define OPENPOSE_FILESTREAM_W_UDP_SENDER_HPP + +#include +#include +#include + +namespace op +{ + template + class WUdpSender : public WorkerConsumer + { + public: + explicit WUdpSender(const std::shared_ptr& udpSender); + + virtual ~WUdpSender(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + const std::shared_ptr spUdpSender; + + DELETE_COPY(WUdpSender); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WUdpSender::WUdpSender(const std::shared_ptr& udpSender) : + spUdpSender{udpSender} + { + } + + template + WUdpSender::~WUdpSender() + { + } + + template + void WUdpSender::initializationOnThread() + { + } + + template + void WUdpSender::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Send though UDP communication +#ifdef USE_3D_ADAM_MODEL + const auto& tDatumPtr = (*tDatums)[0]; + if (!tDatumPtr->poseKeypoints3D.empty()) + { + const auto& adamPose = tDatumPtr->adamPose; // Eigen::Matrix + const auto& adamTranslation = tDatumPtr->adamTranslation; // Eigen::Vector3d(3, 1) + const auto adamFaceCoeffsExp = tDatumPtr->adamFaceCoeffsExp; // Eigen::VectorXd resized to (200, 1) + //const float mouth_open = tDatumPtr->mouthOpening; // tDatumPtr->mouth_open; + //const float leye_open = tDatumPtr->rightEyeOpening; // tDatumPtr->leye_open; + //const float reye_open = tDatumPtr->leftEyeOpening; // tDatumPtr->reye_open; + //const float dist_root_foot = Datum.distanceRootFoot; // tDatumPtr->dist_root_foot; + // m_adam_t: + // 1. Total translation (centimeters) of the root in camera/global coordinate representation. + // m_adam_pose: + // 1. First row is global rotation, in AngleAxis representation. Radians (not degrees!) + // 2. Rest are joint-angles in Euler-Angle representation. Degrees. + spUdpSender->sendJointAngles( + adamPose.data(), adamPose.rows(), adamTranslation.data(), adamFaceCoeffsExp.data(), + adamFaceCoeffsExp.rows()); + } +#endif + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WUdpSender); +} + +#endif // OPENPOSE_FILESTREAM_W_UDP_SENDER_HPP diff --git a/usr/local/include/openpose/filestream/wVideoSaver.hpp b/usr/local/include/openpose/filestream/wVideoSaver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8a43098f409407919e92eaf49880e3dec740c0b --- /dev/null +++ b/usr/local/include/openpose/filestream/wVideoSaver.hpp @@ -0,0 +1,88 @@ +#ifndef OPENPOSE_FILESTREAM_W_VIDEO_SAVER_HPP +#define OPENPOSE_FILESTREAM_W_VIDEO_SAVER_HPP + +#include +#include +#include + +namespace op +{ + template + class WVideoSaver : public WorkerConsumer + { + public: + explicit WVideoSaver(const std::shared_ptr& videoSaver); + + virtual ~WVideoSaver(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spVideoSaver; + + DELETE_COPY(WVideoSaver); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WVideoSaver::WVideoSaver(const std::shared_ptr& videoSaver) : + spVideoSaver{videoSaver} + { + } + + template + WVideoSaver::~WVideoSaver() + { + } + + template + void WVideoSaver::initializationOnThread() + { + } + + template + void WVideoSaver::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record video(s) + std::vector opOutputDatas(tDatumsNoPtr.size()); + for (auto i = 0u ; i < opOutputDatas.size() ; i++) + opOutputDatas[i] = tDatumsNoPtr[i]->cvOutputData; + spVideoSaver->write(opOutputDatas); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WVideoSaver); +} + +#endif // OPENPOSE_FILESTREAM_W_VIDEO_SAVER_HPP diff --git a/usr/local/include/openpose/filestream/wVideoSaver3D.hpp b/usr/local/include/openpose/filestream/wVideoSaver3D.hpp new file mode 100644 index 0000000000000000000000000000000000000000..58d32634b0101de54e95ae391e95d7dad4fea02b --- /dev/null +++ b/usr/local/include/openpose/filestream/wVideoSaver3D.hpp @@ -0,0 +1,86 @@ +#ifndef OPENPOSE_FILESTREAM_W_VIDEO_SAVER_3D_HPP +#define OPENPOSE_FILESTREAM_W_VIDEO_SAVER_3D_HPP + +#include +#include +#include + +namespace op +{ + template + class WVideoSaver3D : public WorkerConsumer + { + public: + explicit WVideoSaver3D(const std::shared_ptr& videoSaver); + + virtual ~WVideoSaver3D(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spVideoSaver; + + DELETE_COPY(WVideoSaver3D); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WVideoSaver3D::WVideoSaver3D(const std::shared_ptr& videoSaver) : + spVideoSaver{videoSaver} + { + } + + template + WVideoSaver3D::~WVideoSaver3D() + { + } + + template + void WVideoSaver3D::initializationOnThread() + { + } + + template + void WVideoSaver3D::workConsumer(const TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // T* to T + auto& tDatumsNoPtr = *tDatums; + // Record video(s) + if (!tDatumsNoPtr.empty()) + spVideoSaver->write(tDatumsNoPtr[0]->cvOutputData3D); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WVideoSaver3D); +} + +#endif // OPENPOSE_FILESTREAM_W_VIDEO_SAVER_3D_HPP diff --git a/usr/local/include/openpose/flags.hpp b/usr/local/include/openpose/flags.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f724e3b17e25b51f256985c33fbd2dc9ce125aa --- /dev/null +++ b/usr/local/include/openpose/flags.hpp @@ -0,0 +1,280 @@ +#ifndef OPENPOSE_FLAGS_HPP +#define OPENPOSE_FLAGS_HPP + +// Note: This class is not included within the basic OpenPose `headers.hpp` and must be explicitly included. In +// addition, Google Flags library must also be linked to the resulting binary or library. OpenPose library does +// not force to use Google Flags, but the OpenPose examples do so. + +// GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string +#include +// Allow Google Flags in Ubuntu 14 +#ifndef GFLAGS_GFLAGS_H_ + namespace gflags = google; +#endif + +// See all the available parameter options with the `--help` flag. E.g., `build/examples/openpose/openpose.bin --help` +// Note: This command will show you flags for other unnecessary 3rdparty files. Check only the flags for the OpenPose +// executable. E.g., for `openpose.bin`, look for `Flags from examples/openpose/openpose.cpp:`. +// Debugging/Other +DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any opLog() message," + " while 255 will not output any. Current OpenPose library messages are in the range 0-4:" + " 1 for low priority messages and 4 for important ones."); +DEFINE_bool(disable_multi_thread, false, "It would slightly reduce the frame rate in order to highly reduce the lag. Mainly useful" + " for 1) Cases where it is needed a low latency (e.g., webcam in real-time scenarios with" + " low-range GPU devices); and 2) Debugging OpenPose when it is crashing to locate the" + " error."); +DEFINE_int32(profile_speed, 1000, "If PROFILER_ENABLED was set in CMake or Makefile.config files, OpenPose will show some" + " runtime statistics at this frame number."); +#ifndef OPENPOSE_FLAGS_DISABLE_POSE +#ifndef OPENPOSE_FLAGS_DISABLE_PRODUCER +// Producer +DEFINE_int32(camera, -1, "The camera index for cv::VideoCapture. Integer in the range [0, 9]. Select a negative" + " number (by default), to auto-detect and open the first available camera."); +DEFINE_string(camera_resolution, "-1x-1", "Set the camera resolution (either `--camera` or `--flir_camera`). `-1x-1` will use the" + " default 1280x720 for `--camera`, or the maximum flir camera resolution available for" + " `--flir_camera`"); +DEFINE_string(video, "", "Use a video file instead of the camera. Use `examples/media/video.avi` for our default" + " example video."); +DEFINE_string(image_dir, "", "Process a directory of images. Use `examples/media/` for our default example folder with 20" + " images. Read all standard formats (jpg, png, bmp, etc.)."); +DEFINE_bool(flir_camera, false, "Whether to use FLIR (Point-Grey) stereo camera."); +DEFINE_int32(flir_camera_index, -1, "Select -1 (default) to run on all detected flir cameras at once. Otherwise, select the flir" + " camera index to run, where 0 corresponds to the detected flir camera with the lowest" + " serial number, and `n` to the `n`-th lowest serial number camera."); +DEFINE_string(ip_camera, "", "String with the IP camera URL. It supports protocols like RTSP and HTTP."); +DEFINE_uint64(frame_first, 0, "Start on desired frame number. Indexes are 0-based, i.e., the first frame has index 0."); +DEFINE_uint64(frame_step, 1, "Step or gap between processed frames. E.g., `--frame_step 5` would read and process frames" + " 0, 5, 10, etc.."); +DEFINE_uint64(frame_last, -1, "Finish on desired frame number. Select -1 to disable. Indexes are 0-based, e.g., if set to" + " 10, it will process 11 frames (0-10)."); +DEFINE_bool(frame_flip, false, "Flip/mirror each frame (e.g., for real time webcam demonstrations)."); +DEFINE_int32(frame_rotate, 0, "Rotate each frame, 4 possible values: 0, 90, 180, 270."); +DEFINE_bool(frames_repeat, false, "Repeat frames when finished."); +DEFINE_bool(process_real_time, false, "Enable to keep the original source frame rate (e.g., for video). If the processing time is" + " too long, it will skip frames. If it is too fast, it will slow it down."); +DEFINE_string(camera_parameter_path, "models/cameraParameters/flir/", "String with the folder where the camera parameters are located. If there" + " is only 1 XML file (for single video, webcam, or images from the same camera), you must" + " specify the whole XML file path (ending in .xml)."); +DEFINE_bool(frame_undistort, false, "If false (default), it will not undistort the image, if true, it will undistortionate them" + " based on the camera parameters found in `camera_parameter_path`"); +#endif // OPENPOSE_FLAGS_DISABLE_PRODUCER +// OpenPose +DEFINE_string(model_folder, "models/", "Folder path (absolute or relative) where the models (pose, face, ...) are located."); +DEFINE_string(prototxt_path, "", "The combination `--model_folder` + `--prototxt_path` represents the whole path to the" + " prototxt file. If empty, it will use the default OpenPose ProtoTxt file."); +DEFINE_string(caffemodel_path, "", "The combination `--model_folder` + `--caffemodel_path` represents the whole path to the" + " caffemodel file. If empty, it will use the default OpenPose CaffeModel file."); +DEFINE_string(output_resolution, "-1x-1", "The image resolution (display and output). Use \"-1x-1\" to force the program to use the" + " input image resolution."); +DEFINE_int32(num_gpu, -1, "The number of GPU devices to use. If negative, it will use all the available GPUs in your" + " machine."); +DEFINE_int32(num_gpu_start, 0, "GPU device start number."); +DEFINE_int32(keypoint_scale, 0, "Scaling of the (x,y) coordinates of the final pose data array, i.e., the scale of the (x,y)" + " coordinates that will be saved with the `write_json` & `write_keypoint` flags." + " Select `0` to scale it to the original source resolution; `1`to scale it to the net output" + " size (set with `net_resolution`); `2` to scale it to the final output size (set with" + " `resolution`); `3` to scale it in the range [0,1], where (0,0) would be the top-left" + " corner of the image, and (1,1) the bottom-right one; and 4 for range [-1,1], where" + " (-1,-1) would be the top-left corner of the image, and (1,1) the bottom-right one. Non" + " related with `scale_number` and `scale_gap`."); +DEFINE_int32(number_people_max, -1, "This parameter will limit the maximum number of people detected, by keeping the people with" + " top scores. The score is based in person area over the image, body part score, as well as" + " joint score (between each pair of connected body parts). Useful if you know the exact" + " number of people in the scene, so it can remove false positives (if all the people have" + " been detected. However, it might also include false negatives by removing very small or" + " highly occluded people. -1 will keep them all."); +DEFINE_bool(maximize_positives, false, "It reduces the thresholds to accept a person candidate. It highly increases both false and" + " true positives. I.e., it maximizes average recall but could harm average precision."); +DEFINE_double(fps_max, -1., "Maximum processing frame rate. By default (-1), OpenPose will process frames as fast as" + " possible. Example usage: If OpenPose is displaying images too quickly, this can reduce" + " the speed so the user can analyze better each frame from the GUI."); +// OpenPose Body Pose +DEFINE_int32(body, 1, "Select 0 to disable body keypoint detection (e.g., for faster but less accurate face" + " keypoint detection, custom hand detector, etc.), 1 (default) for body keypoint" + " estimation, and 2 to disable its internal body pose estimation network but still" + " still run the greedy association parsing algorithm"); +DEFINE_string(model_pose, "BODY_25", "Model to be used. E.g., `BODY_25` (fastest for CUDA version, most accurate, and includes" + " foot keypoints), `COCO` (18 keypoints), `MPI` (15 keypoints, least accurate model but" + " fastest on CPU), `MPI_4_layers` (15 keypoints, even faster but less accurate)."); +DEFINE_string(net_resolution, "-1x368", "Multiples of 16. If it is increased, the accuracy potentially increases. If it is" + " decreased, the speed increases. For maximum speed-accuracy balance, it should keep the" + " closest aspect ratio possible to the images or videos to be processed. Using `-1` in" + " any of the dimensions, OP will choose the optimal aspect ratio depending on the user's" + " input value. E.g., the default `-1x368` is equivalent to `656x368` in 16:9 resolutions," + " e.g., full HD (1980x1080) and HD (1280x720) resolutions."); +DEFINE_double(net_resolution_dynamic, 1., "This flag only applies to images or custom inputs (not to video or webcam). If it is zero" + " or a negative value, it means that using `-1` in `net_resolution` will behave as explained" + " in its description. Otherwise, and to avoid out of memory errors, the `-1` in" + " `net_resolution` will clip to this value times the default 16/9 aspect ratio value (which" + " is 656 width for a 368 height). E.g., `net_resolution_dynamic 10 net_resolution -1x368`" + " will clip to 6560x368 (10 x 656). Recommended 1 for small GPUs (to avoid out of memory" + " errors but maximize speed) and 0 for big GPUs (for maximum accuracy and speed)."); +DEFINE_int32(scale_number, 1, "Number of scales to average."); +DEFINE_double(scale_gap, 0.25, "Scale gap between scales. No effect unless scale_number > 1. Initial scale is always 1." + " If you want to change the initial scale, you actually want to multiply the" + " `net_resolution` by your desired initial scale."); +// OpenPose Body Pose Heatmaps and Part Candidates +DEFINE_bool(heatmaps_add_parts, false, "If true, it will fill op::Datum::poseHeatMaps array with the body part heatmaps, and" + " analogously face & hand heatmaps to op::Datum::faceHeatMaps & op::Datum::handHeatMaps." + " If more than one `add_heatmaps_X` flag is enabled, it will place then in sequential" + " memory order: body parts + bkg + PAFs. It will follow the order on" + " POSE_BODY_PART_MAPPING in `src/openpose/pose/poseParameters.cpp`. Program speed will" + " considerably decrease. Not required for OpenPose, enable it only if you intend to" + " explicitly use this information later."); +DEFINE_bool(heatmaps_add_bkg, false, "Same functionality as `add_heatmaps_parts`, but adding the heatmap corresponding to" + " background."); +DEFINE_bool(heatmaps_add_PAFs, false, "Same functionality as `add_heatmaps_parts`, but adding the PAFs."); +DEFINE_int32(heatmaps_scale, 2, "Set 0 to scale op::Datum::poseHeatMaps in the range [-1,1], 1 for [0,1]; 2 for integer" + " rounded [0,255]; and 3 for no scaling."); +DEFINE_bool(part_candidates, false, "Also enable `write_json` in order to save this information. If true, it will fill the" + " op::Datum::poseCandidates array with the body part candidates. Candidates refer to all" + " the detected body parts, before being assembled into people. Note that the number of" + " candidates is equal or higher than the number of final body parts (i.e., after being" + " assembled into people). The empty body parts are filled with 0s. Program speed will" + " slightly decrease. Not required for OpenPose, enable it only if you intend to explicitly" + " use this information."); +DEFINE_double(upsampling_ratio, 0., "Upsampling ratio between the `net_resolution` and the output net results. A value less" + " or equal than 0 (default) will use the network default value (recommended)."); +// OpenPose Face +DEFINE_bool(face, false, "Enables face keypoint detection. It will share some parameters from the body pose, e.g." + " `model_folder`. Note that this will considerable slow down the performance and increase" + " the required GPU memory. In addition, the greater number of people on the image, the" + " slower OpenPose will be."); +DEFINE_int32(face_detector, 0, "Kind of face rectangle detector. Select 0 (default) to select OpenPose body detector (most" + " accurate one and fastest one if body is enabled), 1 to select OpenCV face detector (not" + " implemented for hands), 2 to indicate that it will be provided by the user, or 3 to" + " also apply hand tracking (only for hand). Hand tracking might improve hand keypoint" + " detection for webcam (if the frame rate is high enough, i.e., >7 FPS per GPU) and video." + " This is not person ID tracking, it simply looks for hands in positions at which hands were" + " located in previous frames, but it does not guarantee the same person ID among frames."); +DEFINE_string(face_net_resolution, "368x368", "Multiples of 16 and squared. Analogous to `net_resolution` but applied to the face keypoint" + " detector. 320x320 usually works fine while giving a substantial speed up when multiple" + " faces on the image."); +// OpenPose Hand +DEFINE_bool(hand, false, "Enables hand keypoint detection. It will share some parameters from the body pose, e.g." + " `model_folder`. Analogously to `--face`, it will also slow down the performance, increase" + " the required GPU memory and its speed depends on the number of people."); +DEFINE_int32(hand_detector, 0, "Kind of hand rectangle detector. Analogous to `--face_detector`."); +DEFINE_string(hand_net_resolution, "368x368", "Multiples of 16 and squared. Analogous to `net_resolution` but applied to the hand keypoint" + " detector."); +DEFINE_int32(hand_scale_number, 1, "Analogous to `scale_number` but applied to the hand keypoint detector. Our best results" + " were found with `hand_scale_number` = 6 and `hand_scale_range` = 0.4."); +DEFINE_double(hand_scale_range, 0.4, "Analogous purpose than `scale_gap` but applied to the hand keypoint detector. Total range" + " between smallest and biggest scale. The scales will be centered in ratio 1. E.g., if" + " scaleRange = 0.4 and scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2."); +// OpenPose 3-D Reconstruction +DEFINE_bool(3d, false, "Running OpenPose 3-D reconstruction demo: 1) Reading from a stereo camera system." + " 2) Performing 3-D reconstruction from the multiple views. 3) Displaying 3-D reconstruction" + " results. Note that it will only display 1 person. If multiple people is present, it will" + " fail."); +DEFINE_int32(3d_min_views, -1, "Minimum number of views required to reconstruct each keypoint. By default (-1), it will" + " require max(2, min(4, #cameras-1)) cameras to see the keypoint in order to reconstruct" + " it."); +DEFINE_int32(3d_views, -1, "Complementary option for `--image_dir` or `--video`. OpenPose will read as many images per" + " iteration, allowing tasks such as stereo camera processing (`--3d`). Note that" + " `--camera_parameter_path` must be set. OpenPose must find as many `xml` files in the" + " parameter folder as this number indicates."); +// Extra algorithms +DEFINE_bool(identification, false, "Experimental, not available yet. Whether to enable people identification across frames."); +DEFINE_int32(tracking, -1, "Experimental, not available yet. Whether to enable people tracking across frames. The" + " value indicates the number of frames where tracking is run between each OpenPose keypoint" + " detection. Select -1 (default) to disable it or 0 to run simultaneously OpenPose keypoint" + " detector and tracking for potentially higher accuracy than only OpenPose."); +DEFINE_int32(ik_threads, 0, "Experimental, not available yet. Whether to enable inverse kinematics (IK) from 3-D" + " keypoints to obtain 3-D joint angles. By default (0 threads), it is disabled. Increasing" + " the number of threads will increase the speed but also the global system latency."); +// OpenPose Rendering +DEFINE_int32(part_to_show, 0, "Prediction channel to visualize: 0 (default) for all the body parts, 1 for the background" + " heat map, 2 for the superposition of heatmaps, 3 for the superposition of PAFs," + " 4-(4+#keypoints) for each body part heat map, the following ones for each body part pair" + " PAF."); +DEFINE_bool(disable_blending, false, "If enabled, it will render the results (keypoint skeletons or heatmaps) on a black" + " background, instead of being rendered into the original image. Related: `part_to_show`," + " `alpha_pose`, and `alpha_pose`."); +// OpenPose Rendering Pose +DEFINE_double(render_threshold, 0.05, "Only estimated keypoints whose score confidences are higher than this threshold will be" + " rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in" + " the saved results. Generally, a high threshold (> 0.5) will only render very clear body" + " parts; while small thresholds (~0.1) will also output guessed and occluded keypoints," + " but also more false positives (i.e., wrong detections)."); +DEFINE_int32(render_pose, -1, "Set to 0 for no rendering, 1 for CPU rendering (slightly faster), and 2 for GPU rendering" + " (slower but greater functionality, e.g., `alpha_X` flags). If -1, it will pick CPU if" + " CPU_ONLY is enabled, or GPU if CUDA is enabled. If rendering is enabled, it will render" + " both `outputData` and `cvOutputData` with the original image and desired body part to be" + " shown (i.e., keypoints, heat maps or PAFs)."); +DEFINE_double(alpha_pose, 0.6, "Blending factor (range 0-1) for the body part rendering. 1 will show it completely, 0 will" + " hide it. Only valid for GPU rendering."); +DEFINE_double(alpha_heatmap, 0.7, "Blending factor (range 0-1) between heatmap and original frame. 1 will only show the" + " heatmap, 0 will only show the frame. Only valid for GPU rendering."); +// OpenPose Rendering Face +DEFINE_double(face_render_threshold, 0.4, "Analogous to `render_threshold`, but applied to the face keypoints."); +DEFINE_int32(face_render, -1, "Analogous to `render_pose` but applied to the face. Extra option: -1 to use the same" + " configuration that `render_pose` is using."); +DEFINE_double(face_alpha_pose, 0.6, "Analogous to `alpha_pose` but applied to face."); +DEFINE_double(face_alpha_heatmap, 0.7, "Analogous to `alpha_heatmap` but applied to face."); +// OpenPose Rendering Hand +DEFINE_double(hand_render_threshold, 0.2, "Analogous to `render_threshold`, but applied to the hand keypoints."); +DEFINE_int32(hand_render, -1, "Analogous to `render_pose` but applied to the hand. Extra option: -1 to use the same" + " configuration that `render_pose` is using."); +DEFINE_double(hand_alpha_pose, 0.6, "Analogous to `alpha_pose` but applied to hand."); +DEFINE_double(hand_alpha_heatmap, 0.7, "Analogous to `alpha_heatmap` but applied to hand."); +#ifndef OPENPOSE_FLAGS_DISABLE_DISPLAY +// Display +DEFINE_bool(fullscreen, false, "Run in full-screen mode (press f during runtime to toggle)."); +DEFINE_bool(no_gui_verbose, false, "Do not write text on output images on GUI (e.g., number of current frame and people). It" + " does not affect the pose rendering."); +DEFINE_int32(display, -1, "Display mode: -1 for automatic selection; 0 for no display (useful if there is no X server" + " and/or to slightly speed up the processing if visual output is not required); 2 for 2-D" + " display; 3 for 3-D display (if `--3d` enabled); and 1 for both 2-D and 3-D display."); +#endif // OPENPOSE_FLAGS_DISABLE_DISPLAY +// Command Line Interface Verbose +DEFINE_double(cli_verbose, -1.f, "If -1, it will be disabled (default). If it is a positive integer number, it will print on" + " the command line every `verbose` frames. If number in the range (0,1), it will print the" + " progress every `verbose` times the total of frames."); +// Result Saving +DEFINE_string(write_images, "", "Directory to write rendered frames in `write_images_format` image format."); +DEFINE_string(write_images_format, "png", "File extension and format for `write_images`, e.g., png, jpg or bmp. Check the OpenCV" + " function cv::imwrite for all compatible extensions."); +DEFINE_string(write_video, "", "Full file path to write rendered frames in motion JPEG video format. It might fail if the" + " final path does not finish in `.avi`. It internally uses cv::VideoWriter. Flag" + " `write_video_fps` controls FPS. Alternatively, the video extension can be `.mp4`," + " resulting in a file with a much smaller size and allowing `--write_video_with_audio`." + " However, that would require: 1) Ubuntu or Mac system, 2) FFmpeg library installed" + " (`sudo apt-get install ffmpeg`), 3) the creation temporarily of a folder with the same" + " file path than the final video (without the extension) to storage the intermediate frames" + " that will later be used to generate the final MP4 video."); +DEFINE_double(write_video_fps, -1., "Frame rate for the recorded video. By default, it will try to get the input frames producer" + " frame rate (e.g., input video or webcam frame rate). If the input frames producer does not" + " have a set FPS (e.g., image_dir or webcam if OpenCV not compiled with its support), set" + " this value accordingly (e.g., to the frame rate displayed by the OpenPose GUI)."); +DEFINE_bool(write_video_with_audio, false, "If the input is video and the output is so too, it will save the video with audio. It" + " requires the output video file path finishing in `.mp4` format (see `write_video` for" + " details)."); +DEFINE_string(write_video_3d, "", "Analogous to `--write_video`, but applied to the 3D output."); +DEFINE_string(write_video_adam, "", "Experimental, not available yet. Analogous to `--write_video`, but applied to Adam model."); +DEFINE_string(write_json, "", "Directory to write OpenPose output in JSON format. It includes body, hand, and face pose" + " keypoints (2-D and 3-D), as well as pose candidates (if `--part_candidates` enabled)."); +DEFINE_string(write_coco_json, "", "Full file path to write people pose data with JSON COCO validation format. If foot, face," + " hands, etc. JSON is also desired (`--write_coco_json_variants`), they are saved with" + " different file name suffix."); +DEFINE_int32(write_coco_json_variants, 1, "Add 1 for body, add 2 for foot, 4 for face, and/or 8 for hands. Use 0 to use all the" + " possible candidates. E.g., 7 would mean body+foot+face COCO JSON."); +DEFINE_int32(write_coco_json_variant, 0, "Currently, this option is experimental and only makes effect on car JSON generation. It" + " selects the COCO variant for cocoJsonSaver."); +DEFINE_string(write_heatmaps, "", "Directory to write body pose heatmaps in PNG format. At least 1 `add_heatmaps_X` flag" + " must be enabled."); +DEFINE_string(write_heatmaps_format, "png", "File extension and format for `write_heatmaps`, analogous to `write_images_format`." + " For lossless compression, recommended `png` for integer `heatmaps_scale` and `float` for" + " floating values. See `doc/02_output.md` for more details."); +DEFINE_string(write_keypoint, "", "(Deprecated, use `write_json`) Directory to write the people pose keypoint data. Set format" + " with `write_keypoint_format`."); +DEFINE_string(write_keypoint_format, "yml", "(Deprecated, use `write_json`) File extension and format for `write_keypoint`: json, xml," + " yaml & yml. Json not available for OpenCV < 3.0, use `write_json` instead."); +// Result Saving - Extra Algorithms +DEFINE_string(write_bvh, "", "Experimental, not available yet. E.g., `~/Desktop/mocapResult.bvh`."); +// UDP Communication +DEFINE_string(udp_host, "", "Experimental, not available yet. IP for UDP communication. E.g., `192.168.0.1`."); +DEFINE_string(udp_port, "8051", "Experimental, not available yet. Port number for UDP communication."); +#endif // OPENPOSE_FLAGS_DISABLE_POSE + +#endif // OPENPOSE_FLAGS_HPP diff --git a/usr/local/include/openpose/gpu/cuda.hpp b/usr/local/include/openpose/gpu/cuda.hpp new file mode 100644 index 0000000000000000000000000000000000000000..50aad8cf95f48e9c6c16f87bc2378d29de9c3478 --- /dev/null +++ b/usr/local/include/openpose/gpu/cuda.hpp @@ -0,0 +1,32 @@ +#ifndef OPENPOSE_GPU_CUDA_HPP +#define OPENPOSE_GPU_CUDA_HPP + +#include // std::pair +#include + +namespace op +{ + const auto CUDA_NUM_THREADS = 512u; + + OP_API void cudaCheck(const int line = -1, const std::string& function = "", const std::string& file = ""); + + OP_API int getCudaGpuNumber(); + + inline unsigned int getNumberCudaBlocks( + const unsigned int totalRequired, const unsigned int numberCudaThreads = CUDA_NUM_THREADS) + { + return (totalRequired + numberCudaThreads - 1) / numberCudaThreads; + } + + OP_API void getNumberCudaThreadsAndBlocks( + dim3& numberCudaThreads, dim3& numberCudaBlocks, const Point& frameSize); + + template + void reorderAndNormalize( + T* targetPtr, const unsigned char* const srcPtr, const int width, const int height, const int channels); + + template + void uCharImageCast(unsigned char* targetPtr, const T* const srcPtr, const int volume); +} + +#endif // OPENPOSE_GPU_CUDA_HPP diff --git a/usr/local/include/openpose/gpu/enumClasses.hpp b/usr/local/include/openpose/gpu/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d94b2296f7d0300a94d7ac6e051f950462aa65e7 --- /dev/null +++ b/usr/local/include/openpose/gpu/enumClasses.hpp @@ -0,0 +1,15 @@ +#ifndef OPENPOSE_GPU_ENUM_CLASSES_HPP +#define OPENPOSE_GPU_ENUM_CLASSES_HPP + +namespace op +{ + enum class GpuMode : unsigned char + { + Cuda = 0, + OpenCL = 1, + NoGpu = 2, + Size, + }; +} + +#endif // OPENPOSE_GPU_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/gpu/gpu.hpp b/usr/local/include/openpose/gpu/gpu.hpp new file mode 100644 index 0000000000000000000000000000000000000000..76c655681d84d6f78f7d61f010451407c143ca7c --- /dev/null +++ b/usr/local/include/openpose/gpu/gpu.hpp @@ -0,0 +1,14 @@ +#ifndef OPENPOSE_GPU_GPU_HPP +#define OPENPOSE_GPU_GPU_HPP + +#include +#include + +namespace op +{ + OP_API int getGpuNumber(); + + OP_API GpuMode getGpuMode(); +} + +#endif // OPENPOSE_GPU_GPU_HPP diff --git a/usr/local/include/openpose/gpu/headers.hpp b/usr/local/include/openpose/gpu/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..08f4b8531f2a589c8084ffff378b8cc680c3b8ad --- /dev/null +++ b/usr/local/include/openpose/gpu/headers.hpp @@ -0,0 +1,9 @@ +#ifndef OPENPOSE_GPU_HEADERS_HPP +#define OPENPOSE_GPU_HEADERS_HPP + +// gpu module +#include +#include +#include + +#endif // OPENPOSE_GPU_HEADERS_HPP diff --git a/usr/local/include/openpose/gui/enumClasses.hpp b/usr/local/include/openpose/gui/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..924bc0c29281eaeae73203c0ad67accace6564d2 --- /dev/null +++ b/usr/local/include/openpose/gui/enumClasses.hpp @@ -0,0 +1,30 @@ +#ifndef OPENPOSE_GUI_ENUM_CLASSES_HPP +#define OPENPOSE_GUI_ENUM_CLASSES_HPP + +namespace op +{ + /** + * GUI display modes. + * An enum class with the different output screen options. E.g., 2-D, 3-D, all, none. + */ + enum class DisplayMode : unsigned short + { + NoDisplay, /**< No display. */ + DisplayAll, /**< All (2-D and 3-D/Adam) displays */ + Display2D, /**< Only 2-D display. */ + Display3D, /**< Only 3-D display. */ + DisplayAdam /**< Only Adam display. */ + }; + + /** + * Full screen modes. + * An enum class with the different full screen mode options, i.e., full screen or windored. + */ + enum class FullScreenMode : bool + { + FullScreen, /**< Full screen mode. */ + Windowed, /**< Windowed mode, depending on the frame output size. */ + }; +} + +#endif // OPENPOSE_GUI_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/gui/frameDisplayer.hpp b/usr/local/include/openpose/gui/frameDisplayer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e5347bd11d72c09406cf52e2441f0a22ef9ac938 --- /dev/null +++ b/usr/local/include/openpose/gui/frameDisplayer.hpp @@ -0,0 +1,65 @@ +#ifndef OPENPOSE_GUI_FRAMES_DISPLAY_HPP +#define OPENPOSE_GUI_FRAMES_DISPLAY_HPP + +#include +#include + +namespace op +{ + /** + * The FrameDisplayer class is the one presenting visually the processed frame to the user. + */ + class OP_API FrameDisplayer + { + public: + /** + * Constructor of the FrameDisplayer class. + * @param windowedName const std::string value with the opencv resulting display name. Showed at the top-left + * part of the window. + * @param initialWindowedSize const Point with the initial window output resolution (width and height). + * @param fullScreen bool from which the FrameDisplayer::FullScreenMode property mFullScreenMode will be set, + * i.e., specifying the type of initial display (it can be changed later). + */ + FrameDisplayer(const std::string& windowedName = OPEN_POSE_NAME_AND_VERSION, + const Point& initialWindowedSize = Point{}, const bool fullScreen = false); + + virtual ~FrameDisplayer(); + + // Due to OpenCV visualization issues (all visualization functions must be in the same thread) + void initializationOnThread(); + + /** + * This function set the new FrameDisplayer::FullScreenMode (e.g., full screen). + * @param fullScreenMode New FrameDisplayer::FullScreenMode state. + */ + void setFullScreenMode(const FullScreenMode fullScreenMode); + + /** + * This function switch between full screen and windowed modes (e.g., when double-click on video players or + * Ctrt+Enter are presed). + */ + void switchFullScreenMode(); + + /** + * This function displays an image on the display. + * @param frame Mat image to display. + * @param waitKeyValue int value that specifies the argument parameter for cv::waitKey (see OpenCV + * documentation for more information). Special cases: select -1 + * not to use cv::waitKey or 0 for cv::waitKey(0). OpenCV doc: + * http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html?highlight=waitkey + */ + void displayFrame(const Matrix& frame, const int waitKeyValue = -1); + + /** + * Analogous to the previous displayFrame, but first it horizontally concatenates all the frames + */ + void displayFrame(const std::vector& frames, const int waitKeyValue = -1); + + private: + const std::string mWindowName; + Point mWindowedSize; + FullScreenMode mFullScreenMode; + }; +} + +#endif // OPENPOSE_GUI_FRAMES_DISPLAY_HPP diff --git a/usr/local/include/openpose/gui/gui.hpp b/usr/local/include/openpose/gui/gui.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2f3aa050fb87a98ed94e09479bc84e786f56f347 --- /dev/null +++ b/usr/local/include/openpose/gui/gui.hpp @@ -0,0 +1,53 @@ +#ifndef OPENPOSE_GUI_GUI_HPP +#define OPENPOSE_GUI_GUI_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API Gui + { + public: + Gui(const Point& outputSize, const bool fullScreen, + const std::shared_ptr>& isRunningSharedPtr, + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr = nullptr, + const std::vector>& poseExtractorNets = {}, + const std::vector>& faceExtractorNets = {}, + const std::vector>& handExtractorNets = {}, + const std::vector>& renderers = {}, + const DisplayMode displayMode = DisplayMode::Display2D); + + virtual ~Gui(); + + virtual void initializationOnThread(); + + void setImage(const Matrix& cvMatOutput); + + void setImage(const std::vector& cvMatOutputs); + + virtual void update(); + + protected: + std::shared_ptr> spIsRunning; + DisplayMode mDisplayMode; + DisplayMode mDisplayModeOriginal; + + private: + // Frames display + FrameDisplayer mFrameDisplayer; + // Other variables + std::vector> mPoseExtractorNets; + std::vector> mFaceExtractorNets; + std::vector> mHandExtractorNets; + std::vector> mRenderers; + std::shared_ptr, std::atomic>> spVideoSeek; + }; +} + +#endif // OPENPOSE_GUI_GUI_HPP diff --git a/usr/local/include/openpose/gui/gui3D.hpp b/usr/local/include/openpose/gui/gui3D.hpp new file mode 100644 index 0000000000000000000000000000000000000000..61a2c4b4130c9633641e1aa1a09894adb6f28a85 --- /dev/null +++ b/usr/local/include/openpose/gui/gui3D.hpp @@ -0,0 +1,42 @@ +#ifndef OPENPOSE_GUI_GUI_3D_HPP +#define OPENPOSE_GUI_GUI_3D_HPP + +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API Gui3D : public Gui + { + public: + Gui3D(const Point& outputSize, const bool fullScreen, + const std::shared_ptr>& isRunningSharedPtr, + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr = nullptr, + const std::vector>& poseExtractorNets = {}, + const std::vector>& faceExtractorNets = {}, + const std::vector>& handExtractorNets = {}, + const std::vector>& renderers = {}, + const PoseModel poseModel = PoseModel::BODY_25, + const DisplayMode displayMode = DisplayMode::DisplayAll, + const bool copyGlToCvMat = false); + + virtual ~Gui3D(); + + virtual void initializationOnThread(); + + void setKeypoints(const Array& poseKeypoints3D, const Array& faceKeypoints3D, + const Array& leftHandKeypoints3D, const Array& rightHandKeypoints3D); + + virtual void update(); + + virtual Matrix readCvMat(); + + private: + const bool mCopyGlToCvMat; + }; +} + +#endif // OPENPOSE_GUI_GUI_3D_HPP diff --git a/usr/local/include/openpose/gui/guiAdam.hpp b/usr/local/include/openpose/gui/guiAdam.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0fce51efc3e1bb0f2f030fbd9fbb52feca6c6ca1 --- /dev/null +++ b/usr/local/include/openpose/gui/guiAdam.hpp @@ -0,0 +1,56 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_GUI_GUI_ADAM_HPP +#define OPENPOSE_GUI_GUI_ADAM_HPP + +#ifdef USE_3D_ADAM_MODEL + #include +#endif +#include +#include +#include + +namespace op +{ + // This worker will do 3-D rendering + class OP_API GuiAdam : public Gui + { + public: + GuiAdam(const Point& outputSize, const bool fullScreen, + const std::shared_ptr>& isRunningSharedPtr, + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr = nullptr, + const std::vector>& poseExtractorNets = {}, + const std::vector>& faceExtractorNets = {}, + const std::vector>& handExtractorNets = {}, + const std::vector>& renderers = {}, + const DisplayMode displayMode = DisplayMode::DisplayAll, + const std::shared_ptr& totalModel = nullptr, + const std::string& adamRenderedVideoPath = ""); + + virtual ~GuiAdam(); + + virtual void initializationOnThread(); + + void generateMesh(const Array& poseKeypoints3D, const Array& faceKeypoints3D, + const std::array, 2>& handKeypoints3D, + const double* const adamPosePtr, + const double* const adamTranslationPtr, + const double* const vtVecPtr, const int vtVecRows, + const double* const j0VecPtr, const int j0VecRows, + const double* const adamFaceCoeffsExpPtr); + + virtual void update(); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplGuiAdam; + std::shared_ptr spImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(GuiAdam); + }; +} + +#endif // OPENPOSE_GUI_GUI_ADAM_HPP +#endif diff --git a/usr/local/include/openpose/gui/guiInfoAdder.hpp b/usr/local/include/openpose/gui/guiInfoAdder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f03e80fa517030fc4bbc0ebdb9106f2d9889c100 --- /dev/null +++ b/usr/local/include/openpose/gui/guiInfoAdder.hpp @@ -0,0 +1,35 @@ +#ifndef OPENPOSE_GUI_ADD_GUI_INFO_HPP +#define OPENPOSE_GUI_ADD_GUI_INFO_HPP + +#include +#include + +namespace op +{ + class OP_API GuiInfoAdder + { + public: + GuiInfoAdder(const int numberGpus, const bool guiEnabled = false); + + virtual ~GuiInfoAdder(); + + void addInfo(Matrix& outputData, const int numberPeople, const unsigned long long id, + const std::string& elementRenderedName, const unsigned long long frameNumber, + const Array& poseIds = Array{}, + const Array& poseKeypoints = Array{}); + + private: + // Const variables + const int mNumberGpus; + const bool mGuiEnabled; + // Other variables + std::queue mFpsQueue; + double mFps; + unsigned int mFpsCounter; + std::string mLastElementRenderedName; + int mLastElementRenderedCounter; + unsigned long long mLastId; + }; +} + +#endif // OPENPOSE_GUI_ADD_GUI_INFO_HPP diff --git a/usr/local/include/openpose/gui/headers.hpp b/usr/local/include/openpose/gui/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..257889c487de2f531904c117726cb933df039a21 --- /dev/null +++ b/usr/local/include/openpose/gui/headers.hpp @@ -0,0 +1,16 @@ +#ifndef OPENPOSE_GUI_HEADERS_HPP +#define OPENPOSE_GUI_HEADERS_HPP + +// gui module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_GUI_HEADERS_HPP diff --git a/usr/local/include/openpose/gui/wGui.hpp b/usr/local/include/openpose/gui/wGui.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c847cc7ffad923b508f2007f133440ccea3ce58 --- /dev/null +++ b/usr/local/include/openpose/gui/wGui.hpp @@ -0,0 +1,103 @@ +#ifndef OPENPOSE_GUI_W_GUI_HPP +#define OPENPOSE_GUI_W_GUI_HPP + +#include +#include +#include + +namespace op +{ + template + class WGui : public WorkerConsumer + { + public: + explicit WGui(const std::shared_ptr& gui); + + virtual ~WGui(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spGui; + + DELETE_COPY(WGui); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WGui::WGui(const std::shared_ptr& gui) : + spGui{gui} + { + } + + template + WGui::~WGui() + { + } + + template + void WGui::initializationOnThread() + { + try + { + spGui->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WGui::workConsumer(const TDatums& tDatums) + { + try + { + // tDatums might be empty but we still wanna update the GUI + if (tDatums != nullptr) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Update cvMat + if (!tDatums->empty()) + { + std::vector cvOutputDatas; + for (auto& tDatumPtr : *tDatums) + cvOutputDatas.emplace_back(tDatumPtr->cvOutputData); + spGui->setImage(cvOutputDatas); + } + // Refresh/update GUI + spGui->update(); + // Profiling speed + if (!tDatums->empty()) + { + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + } + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WGui); +} + +#endif // OPENPOSE_GUI_W_GUI_HPP diff --git a/usr/local/include/openpose/gui/wGui3D.hpp b/usr/local/include/openpose/gui/wGui3D.hpp new file mode 100644 index 0000000000000000000000000000000000000000..654579ae47404e9dbb793ad69e1d827866e8d8fd --- /dev/null +++ b/usr/local/include/openpose/gui/wGui3D.hpp @@ -0,0 +1,116 @@ +#ifndef OPENPOSE_GUI_W_GUI_3D_HPP +#define OPENPOSE_GUI_W_GUI_3D_HPP + +#include +#include +#include + +namespace op +{ + // This worker will do 3-D rendering + template + class WGui3D : public WorkerConsumer + { + public: + explicit WGui3D(const std::shared_ptr& gui3D); + + virtual ~WGui3D(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spGui3D; + + DELETE_COPY(WGui3D); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WGui3D::WGui3D(const std::shared_ptr& gui3D) : + spGui3D{gui3D} + { + } + + template + WGui3D::~WGui3D() + { + } + + template + void WGui3D::initializationOnThread() + { + try + { + spGui3D->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WGui3D::workConsumer(const TDatums& tDatums) + { + try + { + // tDatums might be empty but we still wanna update the GUI + if (tDatums != nullptr) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Update cvMat & keypoints + if (!tDatums->empty()) + { + // Update cvMat + std::vector cvOutputDatas; + for (auto& tDatumPtr : *tDatums) + cvOutputDatas.emplace_back(tDatumPtr->cvOutputData); + spGui3D->setImage(cvOutputDatas); + // Update keypoints + auto& tDatumPtr = (*tDatums)[0]; + spGui3D->setKeypoints( + tDatumPtr->poseKeypoints3D, tDatumPtr->faceKeypoints3D, tDatumPtr->handKeypoints3D[0], + tDatumPtr->handKeypoints3D[1]); + } + // Refresh/update GUI + spGui3D->update(); + // Read OpenCV mat equivalent + if (!tDatums->empty()) + { + auto& tDatumPtr = (*tDatums)[0]; + tDatumPtr->cvOutputData3D = spGui3D->readCvMat(); + } + // Profiling speed + if (!tDatums->empty()) + { + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + } + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WGui3D); +} + +#endif // OPENPOSE_GUI_W_GUI_3D_HPP diff --git a/usr/local/include/openpose/gui/wGuiAdam.hpp b/usr/local/include/openpose/gui/wGuiAdam.hpp new file mode 100644 index 0000000000000000000000000000000000000000..507579945fe76d9be390d9150948ac9a2e907155 --- /dev/null +++ b/usr/local/include/openpose/gui/wGuiAdam.hpp @@ -0,0 +1,114 @@ +#ifdef USE_3D_ADAM_MODEL +#ifndef OPENPOSE_GUI_W_GUI_ADAM_HPP +#define OPENPOSE_GUI_W_GUI_ADAM_HPP + +#include +#include +#include + +namespace op +{ + template + class WGuiAdam : public WorkerConsumer + { + public: + explicit WGuiAdam(const std::shared_ptr& guiAdam); + + virtual ~WGuiAdam(); + + void initializationOnThread(); + + void workConsumer(const TDatums& tDatums); + + private: + std::shared_ptr spGuiAdam; + + DELETE_COPY(WGuiAdam); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WGuiAdam::WGuiAdam(const std::shared_ptr& guiAdam) : + spGuiAdam{guiAdam} + { + } + + template + WGuiAdam::~WGuiAdam() + { + } + + template + void WGuiAdam::initializationOnThread() + { + try + { + spGuiAdam->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WGuiAdam::workConsumer(const TDatums& tDatums) + { + try + { + // tDatums might be empty but we still wanna update the GUI + if (tDatums != nullptr) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Update cvMat & keypoints + if (!tDatums->empty()) + { + // Update cvMat + std::vector cvOutputDatas; + for (auto& tDatum : *tDatums) + cvOutputDatas.emplace_back(tDatumPtr->cvOutputData); + spGuiAdam->setImage(cvOutputDatas); + // Update keypoints + const auto& tDatumPtr = (*tDatums)[0]; + if (!tDatumPtr->poseKeypoints3D.empty()) + spGuiAdam->generateMesh( + tDatumPtr->poseKeypoints3D, tDatumPtr->faceKeypoints3D, tDatumPtr->handKeypoints3D, + tDatumPtr->adamPose.data(), tDatumPtr->adamTranslation.data(), tDatumPtr->vtVec.data(), + tDatumPtr->vtVec.rows(), tDatumPtr->j0Vec.data(), tDatumPtr->j0Vec.rows(), + tDatumPtr->adamFaceCoeffsExp.data()); + } + // Refresh/update GUI + spGuiAdam->update(); + // Profiling speed + if (!tDatums->empty()) + { + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + } + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WGuiAdam); +} + +#endif // OPENPOSE_GUI_W_GUI_ADAM_HPP +#endif diff --git a/usr/local/include/openpose/gui/wGuiInfoAdder.hpp b/usr/local/include/openpose/gui/wGuiInfoAdder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f23e25e97e97da8a571c039092129066b875159c --- /dev/null +++ b/usr/local/include/openpose/gui/wGuiInfoAdder.hpp @@ -0,0 +1,89 @@ +#ifndef OPENPOSE_GUI_W_ADD_GUI_INFO_HPP +#define OPENPOSE_GUI_W_ADD_GUI_INFO_HPP + +#include +#include +#include + +namespace op +{ + template + class WGuiInfoAdder : public Worker + { + public: + explicit WGuiInfoAdder(const std::shared_ptr& guiInfoAdder); + + virtual ~WGuiInfoAdder(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spGuiInfoAdder; + + DELETE_COPY(WGuiInfoAdder); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WGuiInfoAdder::WGuiInfoAdder(const std::shared_ptr& guiInfoAdder) : + spGuiInfoAdder{guiInfoAdder} + { + } + + template + WGuiInfoAdder::~WGuiInfoAdder() + { + } + + template + void WGuiInfoAdder::initializationOnThread() + { + } + + template + void WGuiInfoAdder::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Add GUI components to frame + for (auto& tDatumPtr : *tDatums) + spGuiInfoAdder->addInfo( + tDatumPtr->cvOutputData, + std::max(tDatumPtr->poseKeypoints.getSize(0), tDatumPtr->faceKeypoints.getSize(0)), + tDatumPtr->id, tDatumPtr->elementRendered.second, tDatumPtr->frameNumber, + tDatumPtr->poseIds, tDatumPtr->poseKeypoints); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WGuiInfoAdder); +} + +#endif // OPENPOSE_GUI_W_ADD_GUI_INFO_HPP diff --git a/usr/local/include/openpose/hand/handCpuRenderer.hpp b/usr/local/include/openpose/hand/handCpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a5140a0e06a27f25d7a9e26c87f809247b261e4d --- /dev/null +++ b/usr/local/include/openpose/hand/handCpuRenderer.hpp @@ -0,0 +1,25 @@ +#ifndef OPENPOSE_HAND_HAND_CPU_RENDERER_HPP +#define OPENPOSE_HAND_HAND_CPU_RENDERER_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API HandCpuRenderer : public Renderer, public HandRenderer + { + public: + HandCpuRenderer(const float renderThreshold, const float alphaKeypoint = HAND_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = HAND_DEFAULT_ALPHA_HEAT_MAP); + + virtual ~HandCpuRenderer(); + + void renderHandInherited(Array& outputData, const std::array, 2>& handKeypoints); + + DELETE_COPY(HandCpuRenderer); + }; +} + +#endif // OPENPOSE_HAND_HAND_CPU_RENDERER_HPP diff --git a/usr/local/include/openpose/hand/handDetector.hpp b/usr/local/include/openpose/hand/handDetector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e52ba5b24bce8a5f1961b48a533cf7ede0b80471 --- /dev/null +++ b/usr/local/include/openpose/hand/handDetector.hpp @@ -0,0 +1,51 @@ +#ifndef OPENPOSE_HAND_HAND_DETECTOR_HPP +#define OPENPOSE_HAND_HAND_DETECTOR_HPP + +#include +#include +#include + +namespace op +{ + // Note: This class is thread-safe, so several GPUs can be running hands and using `updateTracker`, and updateTracker will keep the latest known + // tracking + class OP_API HandDetector + { + public: + explicit HandDetector(const PoseModel poseModel); + + virtual ~HandDetector(); + + std::vector, 2>> detectHands(const Array& poseKeypoints) const; + + std::vector, 2>> trackHands(const Array& poseKeypoints); + + void updateTracker(const std::array, 2>& handKeypoints, const unsigned long long id); + + private: + enum class PosePart : unsigned int + { + LWrist = 0, + LElbow, + LShoulder, + RWrist, + RElbow, + RShoulder, + Size, + }; + + const std::array mPoseIndexes; + std::vector, (int)PosePart::Size>> mPoseTrack; + std::vector> mHandLeftPrevious; + std::vector> mHandRightPrevious; + unsigned long long mCurrentId; + std::mutex mMutex; + + std::array getPoseKeypoints(const PoseModel poseModel, + const std::array& poseStrings) const; + + DELETE_COPY(HandDetector); + }; +} + +#endif // OPENPOSE_HAND_HAND_DETECTOR_HPP diff --git a/usr/local/include/openpose/hand/handDetectorFromTxt.hpp b/usr/local/include/openpose/hand/handDetectorFromTxt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..abfeb67008d01a6cd5bca31e2d91a004c37369e7 --- /dev/null +++ b/usr/local/include/openpose/hand/handDetectorFromTxt.hpp @@ -0,0 +1,27 @@ +#ifndef OPENPOSE_HAND_HAND_DETECTOR_FROM_TXT_HPP +#define OPENPOSE_HAND_HAND_DETECTOR_FROM_TXT_HPP + +#include +#include + +namespace op +{ + class OP_API HandDetectorFromTxt + { + public: + explicit HandDetectorFromTxt(const std::string& txtDirectoryPath); + + virtual ~HandDetectorFromTxt(); + + std::vector, 2>> detectHands(); + + private: + const std::string mTxtDirectoryPath; + const std::vector mFilePaths; + long long mFrameNameCounter; + + DELETE_COPY(HandDetectorFromTxt); + }; +} + +#endif // OPENPOSE_HAND_HAND_DETECTOR_FROM_TXT_HPP diff --git a/usr/local/include/openpose/hand/handExtractorCaffe.hpp b/usr/local/include/openpose/hand/handExtractorCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc654648b515a92885482dc17ad60c687aa0261d --- /dev/null +++ b/usr/local/include/openpose/hand/handExtractorCaffe.hpp @@ -0,0 +1,70 @@ +#ifndef OPENPOSE_HAND_HAND_EXTRACTOR_CAFFE_HPP +#define OPENPOSE_HAND_HAND_EXTRACTOR_CAFFE_HPP + +#include +#include +#include + +namespace op +{ + /** + * Hand keypoint extractor class for Caffe framework. + */ + class OP_API HandExtractorCaffe : public HandExtractorNet + { + public: + /** + * Constructor of the HandExtractorCaffe class. + * @param netInputSize Size at which the cropped image (where the hand is located) is resized. + * @param netOutputSize Size of the final results. At the moment, it must be equal than netOutputSize. + * @param modelFolder Folder where the models are located. + * @param gpuId The GPU index (0-based) which the deep net will use. + * @param numberScales Number of scales to run. The more scales, the slower it will be but possibly also more + * accurate. + * @param rangeScales The range between the smaller and bigger scale. + */ + HandExtractorCaffe(const Point& netInputSize, const Point& netOutputSize, + const std::string& modelFolder, const int gpuId, + const int numberScales = 1, const float rangeScales = 0.4f, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect, + const bool enableGoogleLogging = true); + + /** + * Virtual destructor of the HandExtractor class. + * Required to allow inheritance. + */ + virtual ~HandExtractorCaffe(); + + /** + * This function must be call before using any other function. It must also be called inside the thread in + * which the functions are going to be used. + */ + void netInitializationOnThread(); + + /** + * This function extracts the hand keypoints for each detected hand in the image. + * @param handRectangles location of the hands in the image. It is a length-variable std::vector, where + * each index corresponds to a different person in the image. Internally the std::vector, a std::array of 2 + * elements: index 0 and 1 for left and right hand respectively. Inside each array element, a + * op::Rectangle (similar to cv::Rect for floating values) with the position of that hand (or 0,0,0,0 if + * some hand is missing, e.g., if a specific person has only half of the body inside the image). + * @param inputData Original image in Mat format and BGR format. + */ + void forwardPass(const std::vector, 2>> handRectangles, const Matrix& inputData); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplHandExtractorCaffe; + std::unique_ptr upImpl; + + Array getHeatMapsFromLastPass() const; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(HandExtractorCaffe); + }; +} + +#endif // OPENPOSE_HAND_HAND_EXTRACTOR_CAFFE_HPP diff --git a/usr/local/include/openpose/hand/handExtractorNet.hpp b/usr/local/include/openpose/hand/handExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7687d4077c826e786a2e4bab30b80a20b4a62492 --- /dev/null +++ b/usr/local/include/openpose/hand/handExtractorNet.hpp @@ -0,0 +1,92 @@ +#ifndef OPENPOSE_HAND_HAND_EXTRACTOR_HPP +#define OPENPOSE_HAND_HAND_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + /** + * Hand keypoint extractor class. + */ + class OP_API HandExtractorNet + { + public: + /** + * Constructor of the HandExtractorNet class. + * @param netInputSize Size at which the cropped image (where the hand is located) is resized. + * @param netOutputSize Size of the final results. At the moment, it must be equal than netOutputSize. + * @param numberScales Number of scales to run. The more scales, the slower it will be but possibly also more + * accurate. + * @param rangeScales The range between the smaller and bigger scale. + */ + explicit HandExtractorNet(const Point& netInputSize, const Point& netOutputSize, + const int numberScales = 1, const float rangeScales = 0.4f, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect); + + /** + * Virtual destructor of the HandExtractorNet class. + * Required to allow inheritance. + */ + virtual ~HandExtractorNet(); + + /** + * This function must be call before using any other function. It must also be called inside the thread in + * which the functions are going to be used. + */ + void initializationOnThread(); + + /** + * This function extracts the hand keypoints for each detected hand in the image. + * @param handRectangles location of the hands in the image. It is a length-variable std::vector, where + * each index corresponds to a different person in the image. Internally the std::vector, a std::array of 2 + * elements: index 0 and 1 for left and right hand respectively. Inside each array element, a + * op::Rectangle (similar to cv::Rect for floating values) with the position of that hand (or 0,0,0,0 if + * some hand is missing, e.g., if a specific person has only half of the body inside the image). + * @param cvInputData Original image in Mat format and BGR format. + */ + virtual void forwardPass(const std::vector, 2>> handRectangles, + const Matrix& cvInputData) = 0; + + std::array, 2> getHeatMaps() const; + + /** + * This function returns the hand keypoins. VERY IMPORTANT: use getHandKeypoints().clone() if the keypoints are + * going to be edited in a different thread. + * @return A std::array with all the left hand keypoints (index 0) and all the right ones (index 1). Each + * Array follows the pose structure, i.e., the first dimension corresponds to all the people in the + * image, the second to each specific keypoint, and the third one to (x, y, score). + */ + std::array, 2> getHandKeypoints() const; + + bool getEnabled() const; + + void setEnabled(const bool enabled); + + protected: + const std::pair mMultiScaleNumberAndRange; + const Point mNetOutputSize; + Array mHandImageCrop; + std::array, 2> mHandKeypoints; + // HeatMaps parameters + const ScaleMode mHeatMapScaleMode; + const std::vector mHeatMapTypes; + std::array, 2> mHeatMaps; + // Temporarily disable it + std::atomic mEnabled; + + virtual void netInitializationOnThread() = 0; + + private: + // Init with thread + std::thread::id mThreadId; + + void checkThread() const; + + DELETE_COPY(HandExtractorNet); + }; +} + +#endif // OPENPOSE_HAND_HAND_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/hand/handGpuRenderer.hpp b/usr/local/include/openpose/hand/handGpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..47e59b08aa7fb8cd257a1f85df141f0387b4e259 --- /dev/null +++ b/usr/local/include/openpose/hand/handGpuRenderer.hpp @@ -0,0 +1,34 @@ +#ifndef OPENPOSE_HAND_HAND_GPU_RENDERER_HPP +#define OPENPOSE_HAND_HAND_GPU_RENDERER_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API HandGpuRenderer : public GpuRenderer, public HandRenderer + { + public: + HandGpuRenderer(const float renderThreshold, + const float alphaKeypoint = HAND_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = HAND_DEFAULT_ALPHA_HEAT_MAP); + + virtual ~HandGpuRenderer(); + + void initializationOnThread(); + + void renderHandInherited(Array& outputData, const std::array, 2>& handKeypoints); + + private: + float* pGpuHand; // GPU aux memory + float* pMaxPtr; // GPU aux memory + float* pMinPtr; // GPU aux memory + float* pScalePtr; // GPU aux memory + + DELETE_COPY(HandGpuRenderer); + }; +} + +#endif // OPENPOSE_HAND_HAND_GPU_RENDERER_HPP diff --git a/usr/local/include/openpose/hand/handParameters.hpp b/usr/local/include/openpose/hand/handParameters.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a131be94df6f1df36f42e3acc4bdc31d33ccb3b4 --- /dev/null +++ b/usr/local/include/openpose/hand/handParameters.hpp @@ -0,0 +1,52 @@ +#ifndef OPENPOSE_HAND_HAND_PARAMETERS_HPP +#define OPENPOSE_HAND_HAND_PARAMETERS_HPP + +#include +#include + +namespace op +{ + const auto HAND_MAX_HANDS = 2*POSE_MAX_PEOPLE; + + const auto HAND_NUMBER_PARTS = 21u; + #define HAND_PAIRS_RENDER_GPU \ + 0,1, 1,2, 2,3, 3,4, 0,5, 5,6, 6,7, 7,8, 0,9, 9,10, 10,11, 11,12, 0,13, 13,14, 14,15, 15,16, 0,17, 17,18, 18,19, 19,20 + #define HAND_SCALES_RENDER_GPU 1 + const std::vector HAND_PAIRS_RENDER {HAND_PAIRS_RENDER_GPU}; + #define HAND_COLORS_RENDER_GPU \ + 100.f, 100.f, 100.f, \ + 100.f, 0.f, 0.f, \ + 150.f, 0.f, 0.f, \ + 200.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 100.f, 100.f, 0.f, \ + 150.f, 150.f, 0.f, \ + 200.f, 200.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 0.f, 100.f, 50.f, \ + 0.f, 150.f, 75.f, \ + 0.f, 200.f, 100.f, \ + 0.f, 255.f, 125.f, \ + 0.f, 50.f, 100.f, \ + 0.f, 75.f, 150.f, \ + 0.f, 100.f, 200.f, \ + 0.f, 125.f, 255.f, \ + 100.f, 0.f, 100.f, \ + 150.f, 0.f, 150.f, \ + 200.f, 0.f, 200.f, \ + 255.f, 0.f, 255.f + const std::vector HAND_COLORS_RENDER{HAND_COLORS_RENDER_GPU}; + const std::vector HAND_SCALES_RENDER{HAND_SCALES_RENDER_GPU}; + + + // Constant parameters + const auto HAND_CCN_DECREASE_FACTOR = 8.f; + const std::string HAND_PROTOTXT{"hand/pose_deploy.prototxt"}; + const std::string HAND_TRAINED_MODEL{"hand/pose_iter_102000.caffemodel"}; + + // Rendering parameters + const auto HAND_DEFAULT_ALPHA_KEYPOINT = POSE_DEFAULT_ALPHA_KEYPOINT; + const auto HAND_DEFAULT_ALPHA_HEAT_MAP = POSE_DEFAULT_ALPHA_HEAT_MAP; +} + +#endif // OPENPOSE_HAND_HAND_PARAMETERS_HPP diff --git a/usr/local/include/openpose/hand/handRenderer.hpp b/usr/local/include/openpose/hand/handRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..db009bd0205c6736c5db696620857c3ed72bdc63 --- /dev/null +++ b/usr/local/include/openpose/hand/handRenderer.hpp @@ -0,0 +1,24 @@ +#ifndef OPENPOSE_HAND_HAND_RENDERER_HPP +#define OPENPOSE_HAND_HAND_RENDERER_HPP + +#include + +namespace op +{ + class OP_API HandRenderer + { + public: + virtual ~HandRenderer(){}; + + virtual void initializationOnThread(){}; + + void renderHand(Array& outputData, const std::array, 2>& handKeypoints, + const float scaleInputToOutput); + + private: + virtual void renderHandInherited(Array& outputData, + const std::array, 2>& handKeypoints) = 0; + }; +} + +#endif // OPENPOSE_HAND_HAND_RENDERER_HPP diff --git a/usr/local/include/openpose/hand/headers.hpp b/usr/local/include/openpose/hand/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f33b4b441d08461a074482cde280f54545d24452 --- /dev/null +++ b/usr/local/include/openpose/hand/headers.hpp @@ -0,0 +1,21 @@ +#ifndef OPENPOSE_HAND_HEADERS_HPP +#define OPENPOSE_HAND_HEADERS_HPP + +// hand module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_HAND_HEADERS_HPP diff --git a/usr/local/include/openpose/hand/renderHand.hpp b/usr/local/include/openpose/hand/renderHand.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ec2acbe9733ecdb9aba3250cb3c04cad93ce2a7a --- /dev/null +++ b/usr/local/include/openpose/hand/renderHand.hpp @@ -0,0 +1,18 @@ +#ifndef OPENPOSE_HAND_GPU_HAND_RENDER_HPP +#define OPENPOSE_HAND_GPU_HAND_RENDER_HPP + +#include +#include + +namespace op +{ + OP_API void renderHandKeypointsCpu( + Array& frameArray, const std::array, 2>& handKeypoints, const float renderThreshold); + + void renderHandKeypointsGpu( + float* framePtr, float* maxPtr, float* minPtr, float* scalePtr, const Point& frameSize, + const float* const handsPtr, const int numberHands, const float renderThreshold, + const float alphaColorToAdd = HAND_DEFAULT_ALPHA_KEYPOINT); +} + +#endif // OPENPOSE_HAND_GPU_HAND_RENDER_HPP diff --git a/usr/local/include/openpose/hand/wHandDetector.hpp b/usr/local/include/openpose/hand/wHandDetector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b6facb8bfc6cb3009a0342aad19f22fc2eefc33 --- /dev/null +++ b/usr/local/include/openpose/hand/wHandDetector.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_HAND_W_HAND_DETECTOR_HPP +#define OPENPOSE_HAND_W_HAND_DETECTOR_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandDetector : public Worker + { + public: + explicit WHandDetector(const std::shared_ptr& handDetector); + + virtual ~WHandDetector(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandDetector; + + DELETE_COPY(WHandDetector); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandDetector::WHandDetector(const std::shared_ptr& handDetector) : + spHandDetector{handDetector} + { + } + + template + WHandDetector::~WHandDetector() + { + } + + template + void WHandDetector::initializationOnThread() + { + } + + template + void WHandDetector::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people hand + for (auto& tDatumPtr : *tDatums) + tDatumPtr->handRectangles = spHandDetector->detectHands(tDatumPtr->poseKeypoints); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandDetector); +} + +#endif // OPENPOSE_HAND_W_HAND_DETECTOR_HPP diff --git a/usr/local/include/openpose/hand/wHandDetectorFromTxt.hpp b/usr/local/include/openpose/hand/wHandDetectorFromTxt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c77c7b8fff408c76b49d739f127637e87d8519b1 --- /dev/null +++ b/usr/local/include/openpose/hand/wHandDetectorFromTxt.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_HAND_W_HAND_DETECTOR_FROM_JSON_HPP +#define OPENPOSE_HAND_W_HAND_DETECTOR_FROM_JSON_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandDetectorFromTxt : public Worker + { + public: + explicit WHandDetectorFromTxt(const std::shared_ptr& handDetectorFromTxt); + + virtual ~WHandDetectorFromTxt(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandDetectorFromTxt; + + DELETE_COPY(WHandDetectorFromTxt); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandDetectorFromTxt::WHandDetectorFromTxt(const std::shared_ptr& handDetectorFromTxt) : + spHandDetectorFromTxt{handDetectorFromTxt} + { + } + + template + WHandDetectorFromTxt::~WHandDetectorFromTxt() + { + } + + template + void WHandDetectorFromTxt::initializationOnThread() + { + } + + template + void WHandDetectorFromTxt::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people hand + for (auto& tDatumPtr : *tDatums) + tDatumPtr->handRectangles = spHandDetectorFromTxt->detectHands(); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandDetectorFromTxt); +} + +#endif // OPENPOSE_HAND_W_HAND_DETECTOR_FROM_JSON_HPP diff --git a/usr/local/include/openpose/hand/wHandDetectorTracking.hpp b/usr/local/include/openpose/hand/wHandDetectorTracking.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8272f2690f35b9bb28f766005568284a14646990 --- /dev/null +++ b/usr/local/include/openpose/hand/wHandDetectorTracking.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_HAND_W_HAND_DETECTOR_TRACKING_HPP +#define OPENPOSE_HAND_W_HAND_DETECTOR_TRACKING_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandDetectorTracking : public Worker + { + public: + explicit WHandDetectorTracking(const std::shared_ptr& handDetector); + + virtual ~WHandDetectorTracking(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandDetector; + + DELETE_COPY(WHandDetectorTracking); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandDetectorTracking::WHandDetectorTracking(const std::shared_ptr& handDetector) : + spHandDetector{handDetector} + { + } + + template + WHandDetectorTracking::~WHandDetectorTracking() + { + } + + template + void WHandDetectorTracking::initializationOnThread() + { + } + + template + void WHandDetectorTracking::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people hand + for (auto& tDatumPtr : *tDatums) + tDatumPtr->handRectangles = spHandDetector->trackHands(tDatumPtr->poseKeypoints); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandDetectorTracking); +} + +#endif // OPENPOSE_HAND_W_HAND_DETECTOR_TRACKING_HPP diff --git a/usr/local/include/openpose/hand/wHandDetectorUpdate.hpp b/usr/local/include/openpose/hand/wHandDetectorUpdate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..510733e345fadfc245186690ebd792a6979265f3 --- /dev/null +++ b/usr/local/include/openpose/hand/wHandDetectorUpdate.hpp @@ -0,0 +1,85 @@ +#ifndef OPENPOSE_HAND_W_HAND_DETECTOR_UPDATE_HPP +#define OPENPOSE_HAND_W_HAND_DETECTOR_UPDATE_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandDetectorUpdate : public Worker + { + public: + explicit WHandDetectorUpdate(const std::shared_ptr& handDetector); + + virtual ~WHandDetectorUpdate(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandDetector; + + DELETE_COPY(WHandDetectorUpdate); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandDetectorUpdate::WHandDetectorUpdate(const std::shared_ptr& handDetector) : + spHandDetector{handDetector} + { + } + + template + WHandDetectorUpdate::~WHandDetectorUpdate() + { + } + + template + void WHandDetectorUpdate::initializationOnThread() + { + } + + template + void WHandDetectorUpdate::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Detect people hand + for (auto& tDatumPtr : *tDatums) + spHandDetector->updateTracker(tDatumPtr->handKeypoints, tDatumPtr->id); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandDetectorUpdate); +} + +#endif // OPENPOSE_HAND_W_HAND_DETECTOR_UPDATE_HPP diff --git a/usr/local/include/openpose/hand/wHandExtractorNet.hpp b/usr/local/include/openpose/hand/wHandExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e29bcb4addbd929906dedb41c724c3390f326723 --- /dev/null +++ b/usr/local/include/openpose/hand/wHandExtractorNet.hpp @@ -0,0 +1,93 @@ +#ifndef OPENPOSE_HAND_W_HAND_EXTRACTOR_NET_HPP +#define OPENPOSE_HAND_W_HAND_EXTRACTOR_NET_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandExtractorNet : public Worker + { + public: + explicit WHandExtractorNet(const std::shared_ptr& handExtractorNet); + + virtual ~WHandExtractorNet(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandExtractorNet; + + DELETE_COPY(WHandExtractorNet); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandExtractorNet::WHandExtractorNet(const std::shared_ptr& handExtractorNet) : + spHandExtractorNet{handExtractorNet} + { + } + + template + WHandExtractorNet::~WHandExtractorNet() + { + } + + template + void WHandExtractorNet::initializationOnThread() + { + spHandExtractorNet->initializationOnThread(); + } + + template + void WHandExtractorNet::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Extract people hands + for (auto& tDatumPtr : *tDatums) + { + spHandExtractorNet->forwardPass(tDatumPtr->handRectangles, tDatumPtr->cvInputData); + for (auto hand = 0 ; hand < 2 ; hand++) + { + tDatumPtr->handHeatMaps[hand] = spHandExtractorNet->getHeatMaps()[hand].clone(); + tDatumPtr->handKeypoints[hand] = spHandExtractorNet->getHandKeypoints()[hand].clone(); + } + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandExtractorNet); +} + +#endif // OPENPOSE_HAND_W_HAND_EXTRACTOR_NET_HPP diff --git a/usr/local/include/openpose/hand/wHandRenderer.hpp b/usr/local/include/openpose/hand/wHandRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b9aebd918c6da2929d5e45cc3eb481a2cb90b5ca --- /dev/null +++ b/usr/local/include/openpose/hand/wHandRenderer.hpp @@ -0,0 +1,87 @@ +#ifndef OPENPOSE_HAND_W_HAND_RENDERER_HPP +#define OPENPOSE_HAND_W_HAND_RENDERER_HPP + +#include +#include +#include + +namespace op +{ + template + class WHandRenderer : public Worker + { + public: + explicit WHandRenderer(const std::shared_ptr& handRenderer); + + virtual ~WHandRenderer(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spHandRenderer; + + DELETE_COPY(WHandRenderer); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WHandRenderer::WHandRenderer(const std::shared_ptr& handRenderer) : + spHandRenderer{handRenderer} + { + } + + template + WHandRenderer::~WHandRenderer() + { + } + + template + void WHandRenderer::initializationOnThread() + { + spHandRenderer->initializationOnThread(); + } + + template + void WHandRenderer::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Render people hands + for (auto& tDatumPtr : *tDatums) + spHandRenderer->renderHand( + tDatumPtr->outputData, tDatumPtr->handKeypoints, (float)tDatumPtr->scaleInputToOutput); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WHandRenderer); +} + +#endif // OPENPOSE_HAND_W_HAND_RENDERER_HPP diff --git a/usr/local/include/openpose/headers.hpp b/usr/local/include/openpose/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ebc682ac0568602639891e844d66478902bccfa4 --- /dev/null +++ b/usr/local/include/openpose/headers.hpp @@ -0,0 +1,49 @@ +#ifndef OPENPOSE_HEADERS_HPP +#define OPENPOSE_HEADERS_HPP + +// 3d module +#include + +// calibration module +#include + +// core module +#include + +// face module +#include + +// filestream module +#include + +// gui module +#include + +// hand module +#include + +// net module +#include + +// pose module +#include + +// producer module +#include + +// threading module +#include + +// tracking module +#include + +// unity module +#include + +// utilities module +#include + +// wrapper module +#include + +#endif // OPENPOSE_HEADERS_HPP diff --git a/usr/local/include/openpose/net/bodyPartConnectorBase.hpp b/usr/local/include/openpose/net/bodyPartConnectorBase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d609d921f45a9901c53527bb9f20a5bcd349daee --- /dev/null +++ b/usr/local/include/openpose/net/bodyPartConnectorBase.hpp @@ -0,0 +1,69 @@ +#ifndef OPENPOSE_POSE_BODY_PARTS_CONNECTOR_HPP +#define OPENPOSE_POSE_BODY_PARTS_CONNECTOR_HPP + +#include +#include + +namespace op +{ + template + void connectBodyPartsCpu( + Array& poseKeypoints, Array& poseScores, const T* const heatMapPtr, const T* const peaksPtr, + const PoseModel poseModel, const Point& heatMapSize, const int maxPeaks, const T interMinAboveThreshold, + const T interThreshold, const int minSubsetCnt, const T minSubsetScore, const T defaultNmsThreshold, + const T scaleFactor = 1.f, const bool maximizePositives = false); + + // Windows: Cuda functions do not include OP_API + template + void connectBodyPartsGpu( + Array& poseKeypoints, Array& poseScores, const T* const heatMapGpuPtr, const T* const peaksPtr, + const PoseModel poseModel, const Point& heatMapSize, const int maxPeaks, const T interMinAboveThreshold, + const T interThreshold, const int minSubsetCnt, const T minSubsetScore, const T defaultNmsThreshold, + const T scaleFactor, const bool maximizePositives, Array pairScoresCpu, T* pairScoresGpuPtr, + const unsigned int* const bodyPartPairsGpuPtr, const unsigned int* const mapIdxGpuPtr, + const T* const peaksGpuPtr); + + template + void connectBodyPartsOcl( + Array& poseKeypoints, Array& poseScores, const T* const heatMapGpuPtr, const T* const peaksPtr, + const PoseModel poseModel, const Point& heatMapSize, const int maxPeaks, const T interMinAboveThreshold, + const T interThreshold, const int minSubsetCnt, const T minSubsetScore, const T defaultNmsThreshold, + const T scaleFactor = 1.f, const bool maximizePositives = false, + Array pairScoresCpu = Array{}, T* pairScoresGpuPtr = nullptr, + const unsigned int* const bodyPartPairsGpuPtr = nullptr, const unsigned int* const mapIdxGpuPtr = nullptr, + const T* const peaksGpuPtr = nullptr, const int gpuID = 0); + + // Private functions used by the 2 above functions + template + std::vector, T>> createPeopleVector( + const T* const heatMapPtr, const T* const peaksPtr, const PoseModel poseModel, const Point& heatMapSize, + const int maxPeaks, const T interThreshold, const T interMinAboveThreshold, + const std::vector& bodyPartPairs, const unsigned int numberBodyParts, + const unsigned int numberBodyPartPairs, const T defaultNmsThreshold, + const Array& precomputedPAFs = Array()); + + template + void removePeopleBelowThresholdsAndFillFaces( + std::vector& validSubsetIndexes, int& numberPeople, + std::vector, T>>& subsets, const unsigned int numberBodyParts, + const int minSubsetCnt, const T minSubsetScore, const bool maximizePositives, const T* const peaksPtr); + + template + void peopleVectorToPeopleArray( + Array& poseKeypoints, Array& poseScores, const T scaleFactor, + const std::vector, T>>& subsets, const std::vector& validSubsetIndexes, + const T* const peaksPtr, const int numberPeople, const unsigned int numberBodyParts, + const unsigned int numberBodyPartPairs); + + template + std::vector> pafPtrIntoVector( + const Array& pairScores, const T* const peaksPtr, const int maxPeaks, + const std::vector& bodyPartPairs, const unsigned int numberBodyPartPairs); + + template + std::vector, T>> pafVectorIntoPeopleVector( + const std::vector>& pairScores, const T* const peaksPtr, const int maxPeaks, + const std::vector& bodyPartPairs, const unsigned int numberBodyParts); +} + +#endif // OPENPOSE_POSE_BODY_PARTS_CONNECTOR_HPP diff --git a/usr/local/include/openpose/net/bodyPartConnectorCaffe.hpp b/usr/local/include/openpose/net/bodyPartConnectorCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac1d5d9f1b3c32d18df8888109fb29c60582c2d9 --- /dev/null +++ b/usr/local/include/openpose/net/bodyPartConnectorCaffe.hpp @@ -0,0 +1,81 @@ +#ifndef OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP +#define OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP + +#include +#include + +namespace op +{ + // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep + // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the + // Caffe code. + template + class BodyPartConnectorCaffe + { + public: + explicit BodyPartConnectorCaffe(); + + virtual ~BodyPartConnectorCaffe(); + + virtual void Reshape(const std::vector*>& bottom, const int gpuID = 0); + + virtual inline const char* type() const { return "BodyPartConnector"; } + + void setPoseModel(const PoseModel poseModel); + + void setMaximizePositives(const bool maximizePositives); + + void setDefaultNmsThreshold(const T defaultNmsThreshold); + + void setInterMinAboveThreshold(const T interMinAboveThreshold); + + void setInterThreshold(const T interThreshold); + + void setMinSubsetCnt(const int minSubsetCnt); + + void setMinSubsetScore(const T minSubsetScore); + + void setScaleNetToOutput(const T scaleNetToOutput); + + virtual void Forward(const std::vector*>& bottom, Array& poseKeypoints, + Array& poseScores); + + virtual void Forward_cpu(const std::vector*>& bottom, Array& poseKeypoints, + Array& poseScores); + + virtual void Forward_gpu(const std::vector*>& bottom, Array& poseKeypoints, + Array& poseScores); + + virtual void Forward_ocl(const std::vector*>& bottom, Array& poseKeypoints, + Array& poseScores); + + virtual void Backward_cpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + virtual void Backward_gpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + private: + PoseModel mPoseModel; + bool mMaximizePositives; + T mDefaultNmsThreshold; + T mInterMinAboveThreshold; + T mInterThreshold; + int mMinSubsetCnt; + T mMinSubsetScore; + T mScaleNetToOutput; + std::array mHeatMapsSize; + std::array mPeaksSize; + std::array mTopSize; + // GPU auxiliary + unsigned int* pBodyPartPairsGpuPtr; + unsigned int* pMapIdxGpuPtr; + Array mFinalOutputCpu; + T* pFinalOutputGpuPtr; + int mGpuID; + + DELETE_COPY(BodyPartConnectorCaffe); + }; +} + +#endif // OPENPOSE_POSE_BODY_PART_CONNECTOR_CAFFE_HPP diff --git a/usr/local/include/openpose/net/headers.hpp b/usr/local/include/openpose/net/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..997c26a1338ef0d2e78a6eda2718f482698ced3f --- /dev/null +++ b/usr/local/include/openpose/net/headers.hpp @@ -0,0 +1,17 @@ +#ifndef OPENPOSE_NET_HEADERS_HPP +#define OPENPOSE_NET_HEADERS_HPP + +// net module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_NET_HEADERS_HPP diff --git a/usr/local/include/openpose/net/maximumBase.hpp b/usr/local/include/openpose/net/maximumBase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8732e1de0876439a483e41fcc5a0560b67857e5a --- /dev/null +++ b/usr/local/include/openpose/net/maximumBase.hpp @@ -0,0 +1,18 @@ +#ifndef OPENPOSE_NET_MAXIMUM_BASE_HPP +#define OPENPOSE_NET_MAXIMUM_BASE_HPP + +#include + +namespace op +{ + template + void maximumCpu(T* targetPtr, const T* const sourcePtr, const std::array& targetSize, + const std::array& sourceSize); + + // Windows: Cuda functions do not include OP_API + template + void maximumGpu(T* targetPtr, const T* const sourcePtr, const std::array& targetSize, + const std::array& sourceSize); +} + +#endif // OPENPOSE_NET_MAXIMUM_BASE_HPP diff --git a/usr/local/include/openpose/net/maximumCaffe.hpp b/usr/local/include/openpose/net/maximumCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8ecfcc4b0cc511dc49aad46da8562d62bc747956 --- /dev/null +++ b/usr/local/include/openpose/net/maximumCaffe.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_NET_MAXIMUM_CAFFE_HPP +#define OPENPOSE_NET_MAXIMUM_CAFFE_HPP + +#include + +namespace op +{ + // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep + // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the + // Caffe code. + template + class MaximumCaffe + { + public: + explicit MaximumCaffe(); + + virtual ~MaximumCaffe(); + + virtual void LayerSetUp(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Reshape(const std::vector*>& bottom, const std::vector*>& top); + + virtual inline const char* type() const { return "Maximum"; } + + virtual void Forward(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_cpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_gpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Backward_cpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + virtual void Backward_gpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + private: + std::array mBottomSize; + std::array mTopSize; + }; +} + +#endif // OPENPOSE_NET_MAXIMUM_CAFFE_HPP diff --git a/usr/local/include/openpose/net/net.hpp b/usr/local/include/openpose/net/net.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5e44aaed07a8349a33aff3243b113f0e0db2df0c --- /dev/null +++ b/usr/local/include/openpose/net/net.hpp @@ -0,0 +1,21 @@ +#ifndef OPENPOSE_NET_NET_HPP +#define OPENPOSE_NET_NET_HPP + +#include + +namespace op +{ + class OP_API Net + { + public: + virtual ~Net(){} + + virtual void initializationOnThread() = 0; + + virtual void forwardPass(const Array& inputData) const = 0; + + virtual std::shared_ptr> getOutputBlobArray() const = 0; + }; +} + +#endif // OPENPOSE_NET_NET_HPP diff --git a/usr/local/include/openpose/net/netCaffe.hpp b/usr/local/include/openpose/net/netCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ffe131e8766bb4c86f94be99dba2ef268801352b --- /dev/null +++ b/usr/local/include/openpose/net/netCaffe.hpp @@ -0,0 +1,35 @@ +#ifndef OPENPOSE_NET_NET_CAFFE_HPP +#define OPENPOSE_NET_NET_CAFFE_HPP + +#include +#include + +namespace op +{ + class OP_API NetCaffe : public Net + { + public: + NetCaffe(const std::string& caffeProto, const std::string& caffeTrainedModel, const int gpuId = 0, + const bool enableGoogleLogging = true, const std::string& lastBlobName = "net_output"); + + virtual ~NetCaffe(); + + void initializationOnThread(); + + void forwardPass(const Array& inputNetData) const; + + std::shared_ptr> getOutputBlobArray() const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplNetCaffe; + std::unique_ptr upImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(NetCaffe); + }; +} + +#endif // OPENPOSE_NET_NET_CAFFE_HPP diff --git a/usr/local/include/openpose/net/netOpenCv.hpp b/usr/local/include/openpose/net/netOpenCv.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3a767a7c9a5bd9cab95b6ceede07fa71d53021a4 --- /dev/null +++ b/usr/local/include/openpose/net/netOpenCv.hpp @@ -0,0 +1,34 @@ +#ifndef OPENPOSE_NET_NET_OPEN_CV_HPP +#define OPENPOSE_NET_NET_OPEN_CV_HPP + +#include +#include + +namespace op +{ + class OP_API NetOpenCv : public Net + { + public: + NetOpenCv(const std::string& caffeProto, const std::string& caffeTrainedModel, const int gpuId = 0); + + virtual ~NetOpenCv(); + + void initializationOnThread(); + + void forwardPass(const Array& inputNetData) const; + + std::shared_ptr> getOutputBlobArray() const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplNetOpenCv; + std::unique_ptr upImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(NetOpenCv); + }; +} + +#endif // OPENPOSE_NET_NET_OPEN_CV_HPP diff --git a/usr/local/include/openpose/net/nmsBase.hpp b/usr/local/include/openpose/net/nmsBase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dd1b7b28647070d2d866df67cf8cc6be1903d1e4 --- /dev/null +++ b/usr/local/include/openpose/net/nmsBase.hpp @@ -0,0 +1,26 @@ +#ifndef OPENPOSE_NET_NMS_BASE_HPP +#define OPENPOSE_NET_NMS_BASE_HPP + +#include + +namespace op +{ + template + void nmsCpu( + T* targetPtr, int* kernelPtr, const T* const sourcePtr, const T threshold, const std::array& targetSize, + const std::array& sourceSize, const Point& offset); + + // Windows: Cuda functions do not include OP_API + template + void nmsGpu( + T* targetPtr, int* kernelPtr, const T* const sourcePtr, const T threshold, const std::array& targetSize, + const std::array& sourceSize, const Point& offset); + + // Windows: OpenCL functions do not include OP_API + template + void nmsOcl( + T* targetPtr, uint8_t* kernelGpuPtr, uint8_t* kernelCpuPtr, const T* const sourcePtr, const T threshold, const std::array& targetSize, + const std::array& sourceSize, const Point& offset, const int gpuID = 0); +} + +#endif // OPENPOSE_NET_NMS_BASE_HPP diff --git a/usr/local/include/openpose/net/nmsCaffe.hpp b/usr/local/include/openpose/net/nmsCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f91eb85e1499c9bd74fc746eefd8afc0936efe0d --- /dev/null +++ b/usr/local/include/openpose/net/nmsCaffe.hpp @@ -0,0 +1,61 @@ +#ifndef OPENPOSE_NET_NMS_CAFFE_HPP +#define OPENPOSE_NET_NMS_CAFFE_HPP + +#include + +namespace op +{ + // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep + // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the + // Caffe code. + template + class NmsCaffe + { + public: + explicit NmsCaffe(); + + virtual ~NmsCaffe(); + + virtual void LayerSetUp(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Reshape(const std::vector*>& bottom, const std::vector*>& top, + const int maxPeaks, const int outputChannels = -1, const int gpuID = 0); + + virtual inline const char* type() const { return "Nms"; } + + void setThreshold(const T threshold); + + // Empirically gives better results (copied from Matlab original code) + void setOffset(const Point& offset); + + virtual void Forward(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_cpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_gpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_ocl(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Backward_cpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + virtual void Backward_gpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + private: + T mThreshold; + Point mOffset; + int mGpuID; + + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplNmsCaffe; + std::unique_ptr upImpl; + + // PIMP requires DELETE_COPY & destructor, or extra code + // http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html + DELETE_COPY(NmsCaffe); + }; +} + +#endif // OPENPOSE_NET_NMS_CAFFE_HPP diff --git a/usr/local/include/openpose/net/resizeAndMergeBase.hpp b/usr/local/include/openpose/net/resizeAndMergeBase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4c0f8cc05d5e41037fac95b86c250a86030a82ff --- /dev/null +++ b/usr/local/include/openpose/net/resizeAndMergeBase.hpp @@ -0,0 +1,37 @@ +#ifndef OPENPOSE_NET_RESIZE_AND_MERGE_BASE_HPP +#define OPENPOSE_NET_RESIZE_AND_MERGE_BASE_HPP + +#include + +namespace op +{ + template + void resizeAndMergeCpu( + T* targetPtr, const std::vector& sourcePtrs, const std::array& targetSize, + const std::vector>& sourceSizes, const std::vector& scaleInputToNetInputs = {1.f}); + + // Windows: Cuda functions do not include OP_API + template + void resizeAndMergeGpu( + T* targetPtr, const std::vector& sourcePtrs, const std::array& targetSize, + const std::vector>& sourceSizes, const std::vector& scaleInputToNetInputs = {1.f}); + + // Windows: OpenCL functions do not include OP_API + template + void resizeAndMergeOcl( + T* targetPtr, const std::vector& sourcePtrs, std::vector& sourceTempPtrs, + const std::array& targetSize, const std::vector>& sourceSizes, + const std::vector& scaleInputToNetInputs = {1.f}, const int gpuID = 0); + + // Functions for cvMatToOpInput/cvMatToOpOutput + template + void resizeAndPadRbgGpu( + T* targetPtr, const T* const srcPtr, const int sourceWidth, const int sourceHeight, + const int targetWidth, const int targetHeight, const T scaleFactor); + + template + void resizeAndPadRbgGpu( + T* targetPtr, const unsigned char* const srcPtr, const int sourceWidth, const int sourceHeight, + const int targetWidth, const int targetHeight, const T scaleFactor); +} +#endif // OPENPOSE_NET_RESIZE_AND_MERGE_BASE_HPP diff --git a/usr/local/include/openpose/net/resizeAndMergeCaffe.hpp b/usr/local/include/openpose/net/resizeAndMergeCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b28b94a99d2ec6515b9dbf3b31f71cc390bae4e4 --- /dev/null +++ b/usr/local/include/openpose/net/resizeAndMergeCaffe.hpp @@ -0,0 +1,54 @@ +#ifndef OPENPOSE_NET_RESIZE_AND_MERGE_CAFFE_HPP +#define OPENPOSE_NET_RESIZE_AND_MERGE_CAFFE_HPP + +#include + +namespace op +{ + // It mostly follows the Caffe::layer implementation, so Caffe users can easily use it. However, in order to keep + // the compatibility with any generic Caffe version, we keep this 'layer' inside our library rather than in the + // Caffe code. + template + class ResizeAndMergeCaffe + { + public: + explicit ResizeAndMergeCaffe(); + + virtual ~ResizeAndMergeCaffe(); + + virtual void LayerSetUp(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Reshape(const std::vector*>& bottom, const std::vector*>& top, + const T netFactor, const T scaleFactor, const bool mergeFirstDimension = true, + const int gpuID = 0); + + virtual inline const char* type() const { return "ResizeAndMerge"; } + + void setScaleRatios(const std::vector& scaleRatios); + + virtual void Forward(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_cpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_gpu(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Forward_ocl(const std::vector*>& bottom, const std::vector*>& top); + + virtual void Backward_cpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + virtual void Backward_gpu(const std::vector*>& top, const std::vector& propagate_down, + const std::vector*>& bottom); + + private: + std::vector mTempGPUData; + std::vector mScaleRatios; + std::vector> mBottomSizes; + std::array mTopSize; + int mGpuID; + + DELETE_COPY(ResizeAndMergeCaffe); + }; +} + +#endif // OPENPOSE_NET_RESIZE_AND_MERGE_CAFFE_HPP diff --git a/usr/local/include/openpose/pose/enumClasses.hpp b/usr/local/include/openpose/pose/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c5880de229151861dc52a8aba96584162d4a953c --- /dev/null +++ b/usr/local/include/openpose/pose/enumClasses.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_POSE_ENUM_CLASSES_HPP +#define OPENPOSE_POSE_ENUM_CLASSES_HPP + +namespace op +{ + /** + * An enum class in which all the possible type of pose estimation models are included. + */ + enum class PoseModel : unsigned char + { + /** + * COCO + 6 foot keypoints + neck + lower abs model, with 25+1 components (see poseParameters.hpp for details). + */ + BODY_25 = 0, + COCO_18, /**< COCO model + neck, with 18+1 components (see poseParameters.hpp for details). */ + MPI_15, /**< MPI model, with 15+1 components (see poseParameters.hpp for details). */ + MPI_15_4, /**< Variation of the MPI model, reduced number of CNN stages to 4: faster but less accurate.*/ + BODY_19, /**< Experimental. Do not use. */ + BODY_19_X2, /**< Experimental. Do not use. */ + BODY_19N, /**< Experimental. Do not use. */ + BODY_25E, /**< Experimental. Do not use. */ + CAR_12, /**< Experimental. Do not use. */ + BODY_25D, /**< Experimental. Do not use. */ + BODY_23, /**< Experimental. Do not use. */ + CAR_22, /**< Experimental. Do not use. */ + BODY_19E, /**< Experimental. Do not use. */ + BODY_25B, /**< Experimental. Do not use. */ + BODY_135, /**< Experimental. Do not use. */ + Size, + }; + + enum class PoseProperty : unsigned char + { + NMSThreshold = 0, + ConnectInterMinAboveThreshold, + ConnectInterThreshold, + ConnectMinSubsetCnt, + ConnectMinSubsetScore, + Size, + }; +} + +#endif // OPENPOSE_POSE_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/pose/headers.hpp b/usr/local/include/openpose/pose/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9d788ec666d8666ad091fb9dab159c62b034ccc3 --- /dev/null +++ b/usr/local/include/openpose/pose/headers.hpp @@ -0,0 +1,19 @@ +#ifndef OPENPOSE_POSE_HEADERS_HPP +#define OPENPOSE_POSE_HEADERS_HPP + +// pose module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_POSE_HEADERS_HPP diff --git a/usr/local/include/openpose/pose/poseCpuRenderer.hpp b/usr/local/include/openpose/pose/poseCpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4197b0bd45d37cc313788f3519dbed4b6542f7d0 --- /dev/null +++ b/usr/local/include/openpose/pose/poseCpuRenderer.hpp @@ -0,0 +1,31 @@ +#ifndef OPENPOSE_POSE_POSE_CPU_RENDERER_HPP +#define OPENPOSE_POSE_POSE_CPU_RENDERER_HPP + +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API PoseCpuRenderer : public Renderer, public PoseRenderer + { + public: + PoseCpuRenderer( + const PoseModel poseModel, const float renderThreshold, const bool blendOriginalFrame = true, + const float alphaKeypoint = POSE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEAT_MAP, const unsigned int elementToRender = 0u); + + virtual ~PoseCpuRenderer(); + + std::pair renderPose( + Array& outputData, const Array& poseKeypoints, const float scaleInputToOutput, + const float scaleNetToOutput = -1.f); + + private: + DELETE_COPY(PoseCpuRenderer); + }; +} + +#endif // OPENPOSE_POSE_POSE_CPU_RENDERER_HPP diff --git a/usr/local/include/openpose/pose/poseExtractor.hpp b/usr/local/include/openpose/pose/poseExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4692ed79e46ac57e3f746a55c65e67b35587f76 --- /dev/null +++ b/usr/local/include/openpose/pose/poseExtractor.hpp @@ -0,0 +1,78 @@ +#ifndef OPENPOSE_POSE_POSE_EXTRACTOR_HPP +#define OPENPOSE_POSE_POSE_EXTRACTOR_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API PoseExtractor + { + public: + PoseExtractor(const std::shared_ptr& poseExtractorNet, + const std::shared_ptr& keepTopNPeople = nullptr, + const std::shared_ptr& personIdExtractor = nullptr, + const std::shared_ptr>>& personTracker = {}, + const int numberPeopleMax = -1, const int tracking = -1); + + virtual ~PoseExtractor(); + + void initializationOnThread(); + + void forwardPass(const std::vector>& inputNetData, + const Point& inputDataSize, + const std::vector& scaleRatios, + const Array& poseNetOutput = Array{}, + const long long frameId = -1ll); + + // PoseExtractorNet functions + Array getHeatMapsCopy() const; + + std::vector>> getCandidatesCopy() const; + + Array getPoseKeypoints() const; + + Array getPoseScores() const; + + float getScaleNetToOutput() const; + + // KeepTopNPeople functions + void keepTopPeople(Array& poseKeypoints, const Array& poseScores) const; + + // PersonIdExtractor functions + // Not thread-safe + Array extractIds(const Array& poseKeypoints, const Matrix& cvMatInput, + const unsigned long long imageIndex = 0ull); + + // Same than extractIds but thread-safe + Array extractIdsLockThread(const Array& poseKeypoints, const Matrix& cvMatInput, + const unsigned long long imageIndex, + const long long frameId); + + // PersonTracker functions + void track(Array& poseKeypoints, Array& poseIds, + const Matrix& cvMatInput, const unsigned long long imageViewIndex = 0ull); + + void trackLockThread(Array& poseKeypoints, Array& poseIds, + const Matrix& cvMatInput, + const unsigned long long imageViewIndex, + const long long frameId); + + private: + const int mNumberPeopleMax; + const int mTracking; + const std::shared_ptr spPoseExtractorNet; + const std::shared_ptr spKeepTopNPeople; + const std::shared_ptr spPersonIdExtractor; + const std::shared_ptr>> spPersonTrackers; + + DELETE_COPY(PoseExtractor); + }; +} + +#endif // OPENPOSE_POSE_POSE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/pose/poseExtractorCaffe.hpp b/usr/local/include/openpose/pose/poseExtractorCaffe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a956fab9bf45e3f6107d4c4f422eadd4a6991611 --- /dev/null +++ b/usr/local/include/openpose/pose/poseExtractorCaffe.hpp @@ -0,0 +1,83 @@ +#ifndef OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP +#define OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API PoseExtractorCaffe : public PoseExtractorNet + { + public: + PoseExtractorCaffe( + const PoseModel poseModel, const std::string& modelFolder, const int gpuId, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect, + const bool addPartCandidates = false, const bool maximizePositives = false, + const std::string& protoTxtPath = "", const std::string& caffeModelPath = "", + const float upsamplingRatio = 0.f, const bool enableNet = true, + const bool enableGoogleLogging = true); + + virtual ~PoseExtractorCaffe(); + + virtual void netInitializationOnThread(); + + /** + * @param poseNetOutput If it is not empty, OpenPose will not run its internal body pose estimation network + * and will instead use this data as the substitute of its network. The size of this element must match the + * size of the output of its internal network, or it will lead to core dumped (segmentation) errors. You can + * modify the pose estimation flags to match the dimension of both elements (e.g., `--net_resolution`, + * `--scale_number`, etc.). + */ + virtual void forwardPass( + const std::vector>& inputNetData, const Point& inputDataSize, + const std::vector& scaleInputToNetInputs = {1.f}, + const Array& poseNetOutput = Array{}); + + const float* getCandidatesCpuConstPtr() const; + + const float* getCandidatesGpuConstPtr() const; + + const float* getHeatMapCpuConstPtr() const; + + const float* getHeatMapGpuConstPtr() const; + + std::vector getHeatMapSize() const; + + const float* getPoseGpuConstPtr() const; + + private: + // Used when increasing spNets + const PoseModel mPoseModel; + const int mGpuId; + const std::string mModelFolder; + const std::string mProtoTxtPath; + const std::string mCaffeModelPath; + const float mUpsamplingRatio; + const bool mEnableNet; + const bool mEnableGoogleLogging; + // General parameters + std::vector> spNets; + std::shared_ptr> spResizeAndMergeCaffe; + std::shared_ptr> spNmsCaffe; + std::shared_ptr> spBodyPartConnectorCaffe; + std::shared_ptr> spMaximumCaffe; + std::vector> mNetInput4DSizes; + // Init with thread + std::vector>> spCaffeNetOutputBlobs; + std::shared_ptr> spHeatMapsBlob; + std::shared_ptr> spPeaksBlob; + std::shared_ptr> spMaximumPeaksBlob; + + DELETE_COPY(PoseExtractorCaffe); + }; +} + +#endif // OPENPOSE_POSE_POSE_EXTRACTOR_CAFFE_HPP diff --git a/usr/local/include/openpose/pose/poseExtractorNet.hpp b/usr/local/include/openpose/pose/poseExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0891e0548a1ca82b158d2e7a1e27171795956bcb --- /dev/null +++ b/usr/local/include/openpose/pose/poseExtractorNet.hpp @@ -0,0 +1,80 @@ +#ifndef OPENPOSE_POSE_POSE_EXTRACTOR_NET_HPP +#define OPENPOSE_POSE_POSE_EXTRACTOR_NET_HPP + +#include +#include +#include +#include + +namespace op +{ + class OP_API PoseExtractorNet + { + public: + PoseExtractorNet(const PoseModel poseModel, + const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::ZeroToOneFixedAspect, + const bool addPartCandidates = false, + const bool maximizePositives = false); + + virtual ~PoseExtractorNet(); + + void initializationOnThread(); + + virtual void forwardPass( + const std::vector>& inputNetData, const Point& inputDataSize, + const std::vector& scaleRatios = {1.f}, const Array& poseNetOutput = Array{}) = 0; + + virtual const float* getCandidatesCpuConstPtr() const = 0; + + virtual const float* getCandidatesGpuConstPtr() const = 0; + + virtual const float* getHeatMapCpuConstPtr() const = 0; + + virtual const float* getHeatMapGpuConstPtr() const = 0; + + virtual std::vector getHeatMapSize() const = 0; + + Array getHeatMapsCopy() const; + + std::vector>> getCandidatesCopy() const; + + virtual const float* getPoseGpuConstPtr() const = 0; + + Array getPoseKeypoints() const; + + Array getPoseScores() const; + + float getScaleNetToOutput() const; + + double get(const PoseProperty property) const; + + void set(const PoseProperty property, const double value); + + void increase(const PoseProperty property, const double value); + + void clear(); + + protected: + const PoseModel mPoseModel; + Point mNetOutputSize; + Array mPoseKeypoints; + Array mPoseScores; + float mScaleNetToOutput; + + void checkThread() const; + + virtual void netInitializationOnThread() = 0; + + private: + const std::vector mHeatMapTypes; + const ScaleMode mHeatMapScaleMode; + const bool mAddPartCandidates; + std::array, (int)PoseProperty::Size> mProperties; + std::thread::id mThreadId; + + DELETE_COPY(PoseExtractorNet); + }; +} + +#endif // OPENPOSE_POSE_POSE_EXTRACTOR_NET_HPP diff --git a/usr/local/include/openpose/pose/poseGpuRenderer.hpp b/usr/local/include/openpose/pose/poseGpuRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bd792648944eba03364e65fecddfbf35871d9795 --- /dev/null +++ b/usr/local/include/openpose/pose/poseGpuRenderer.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_POSE_POSE_GPU_RENDERER_HPP +#define OPENPOSE_POSE_POSE_GPU_RENDERER_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + class OP_API PoseGpuRenderer : public GpuRenderer, public PoseRenderer + { + public: + PoseGpuRenderer( + const PoseModel poseModel, const std::shared_ptr& poseExtractorNet, + const float renderThreshold, const bool blendOriginalFrame = true, + const float alphaKeypoint = POSE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEAT_MAP, const unsigned int elementToRender = 0u); + + virtual ~PoseGpuRenderer(); + + void initializationOnThread(); + + std::pair renderPose(Array& outputData, const Array& poseKeypoints, + const float scaleInputToOutput, + const float scaleNetToOutput = -1.f); + + private: + const std::shared_ptr spPoseExtractorNet; + // Init with thread + float* pGpuPose; // GPU aux memory + float* pMaxPtr; // GPU aux memory + float* pMinPtr; // GPU aux memory + float* pScalePtr; // GPU aux memory + + DELETE_COPY(PoseGpuRenderer); + }; +} + +#endif // OPENPOSE_POSE_POSE_GPU_RENDERER_HPP diff --git a/usr/local/include/openpose/pose/poseParameters.hpp b/usr/local/include/openpose/pose/poseParameters.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e4213d7e453e4263f367fc1d60d8c7e90fb51302 --- /dev/null +++ b/usr/local/include/openpose/pose/poseParameters.hpp @@ -0,0 +1,37 @@ +#ifndef OPENPOSE_POSE_POSE_PARAMETERS_HPP +#define OPENPOSE_POSE_POSE_PARAMETERS_HPP + +#include +#include +#include + +namespace op +{ + // Constant Global Parameters + // For OpenCL-NMS in Ubuntu, (POSE_MAX_PEOPLE+1)*3(x,y,score) must be divisible by 32. Easy fix: + // POSE_MAX_PEOPLE = 32n - 1 + // For OpenCL-NMS in Windows, it must be by 64, so 64n - 1 + const auto POSE_MAX_PEOPLE = 127u; + + // Model functions + OP_API const std::map& getPoseBodyPartMapping(const PoseModel poseModel); + OP_API const std::string& getPoseProtoTxt(const PoseModel poseModel); + OP_API const std::string& getPoseTrainedModel(const PoseModel poseModel); + OP_API unsigned int getPoseNumberBodyParts(const PoseModel poseModel); + OP_API const std::vector& getPosePartPairs(const PoseModel poseModel); + OP_API const std::vector& getPoseMapIndex(const PoseModel poseModel); + OP_API unsigned int getPoseMaxPeaks(); + OP_API float getPoseNetDecreaseFactor(const PoseModel poseModel); + OP_API unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string); + OP_API unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector& strings); + + // Default NSM and body connector parameters + OP_API float getPoseDefaultNmsThreshold(const PoseModel poseModel, const bool maximizePositives = false); + OP_API float getPoseDefaultConnectInterMinAboveThreshold(const bool maximizePositives = false); + OP_API float getPoseDefaultConnectInterThreshold(const PoseModel poseModel, const bool maximizePositives = false); + OP_API unsigned int getPoseDefaultMinSubsetCnt(const bool maximizePositives = false); + OP_API float getPoseDefaultConnectMinSubsetScore(const bool maximizePositives = false); + OP_API bool addBkgChannel(const PoseModel poseModel); +} + +#endif // OPENPOSE_POSE_POSE_PARAMETERS_HPP diff --git a/usr/local/include/openpose/pose/poseParametersRender.hpp b/usr/local/include/openpose/pose/poseParametersRender.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ddd61e7fbe08a6b88f2cd15504e2d1ba5d0e4104 --- /dev/null +++ b/usr/local/include/openpose/pose/poseParametersRender.hpp @@ -0,0 +1,425 @@ +#ifndef OPENPOSE_POSE_POSE_PARAMETERS_RENDER_HPP +#define OPENPOSE_POSE_POSE_PARAMETERS_RENDER_HPP + +#include +#include + +namespace op +{ + // Rendering parameters + const auto POSE_DEFAULT_ALPHA_KEYPOINT = 0.6f; + const auto POSE_DEFAULT_ALPHA_HEAT_MAP = 0.7f; + + // Model-Dependent Parameters + // CUDA-code Model-Dependent Parameters must be defined with #define + // BODY_25 + #define POSE_BODY_25_PAIRS_RENDER_GPU \ + 1,8, 1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 8,9, 9,10, 10,11, 8,12, 12,13, 13,14, 1,0, 0,15, 15,17, 0,16, 16,18, 14,19,19,20,14,21, 11,22,22,23,11,24 + #define POSE_BODY_25_SCALES_RENDER_GPU 1 + #define POSE_BODY_25_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 170.f, 255.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 85.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f + // COCO + #define POSE_COCO_PAIRS_RENDER_GPU \ + 1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17 + #define POSE_COCO_SCALES_RENDER_GPU 1 + #define POSE_COCO_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 170.f, 255.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 85.f, 0.f, 255.f + // MPI + // MPI colors chosen such that they are closed to COCO colors + #define POSE_MPI_PAIRS_RENDER_GPU \ + 0,1, 1,2, 2,3, 3,4, 1,5, 5,6, 6,7, 1,14, 14,8, 8,9, 9,10, 14,11, 11,12, 12,13 + #define POSE_MPI_SCALES_RENDER_GPU 1 + #define POSE_MPI_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 170.f, 255.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 43.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 0.f, 255.f + // BODY_19 + #define POSE_BODY_19_PAIRS_RENDER_GPU \ + 1,8, 1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 8,9, 9,10, 10,11, 8,12, 12,13, 13,14, 1,0, 0,15, 15,17, 0,16, 16,18 + #define POSE_BODY_19_SCALES_RENDER_GPU 1 + #define POSE_BODY_19_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 170.f, 255.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 85.f, 0.f, 255.f + // BODY_23 + #define POSE_BODY_23_PAIRS_RENDER_GPU \ + 1,7, 4,10, 0,1, 0,4, 1,2, 2,3, 4,5, 5,6, 7,8, 8,9, 10,11, 11,12, 0,13, 13,15, 0,14, 14,16, 12,17,17,18,12,19, 9,20,20,21,9,22 + #define POSE_BODY_23_SCALES_RENDER_GPU 1 + #define POSE_BODY_23_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 170.f, 255.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 85.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f + // BODY_25B + #define POSE_BODY_25B_PAIRS_RENDER_GPU \ + 0,1, 0,2, 1,3, 2,4, 5,7, 6,8, 7,9, 8,10, 5,11, 6,12, 11,13, 12,14, 13,15, 14,16, \ + 15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,17, \ + 6,17, 17,18, 11,12 + #define POSE_BODY_25B_SCALES_RENDER_GPU 1 + #define POSE_BODY_25B_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 85.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 170.f, 255.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f + // BODY_135 + // Hand color selection + // http://www.perbang.dk/rgbgradient/ + // 1. Main color + // - Each finger of the right hand: 11 steps from FF0000 to FF0001 and pick last 5 from HSV gradient. + // - Each finger of the left hand: 21 steps from FF0000 to FF0001, choosing 4 among first 6 (HSV grad.), + // and then green. + // Note: Choosing first 5 from 11 steps was giving 2 very close greens + // 2. Gradient color from wrist to finger tips + // - Inside each finger: 5 steps from main color to 000000, and selecting first 4 from RGB gradient. + // Note: Used HSV gradient for red finger. + const auto H135 = 25; + const auto F135 = H135 + 40; + // 15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,17, + // 6,17, 17,18, 11,12, + #define POSE_BODY_135_PAIRS_RENDER_GPU \ + 0,1, 0,2, 1,3, 2,4, 5,7, 6,8, 7,9, 8,10, 5,11, 6,12, 11,13, 12,14, 13,15, 14,16, \ + 15,19, 19,20, 15,21, 16,22, 22,23, 16,24, 5,6, 17,18, 11,12, \ + \ + 9,H135+0, H135+0,H135+1, H135+1,H135+2, H135+2,H135+3, 9,H135+4, H135+4,H135+5, H135+5,H135+6, H135+6,H135+7, \ + 9,H135+8, H135+8,H135+9, H135+9,H135+10, H135+10,H135+11, 9,H135+12, H135+12,H135+13, H135+13,H135+14, H135+14,H135+15, \ + 9,H135+16, H135+16,H135+17, H135+17,H135+18, H135+18,H135+19, \ + \ + 10,H135+20, H135+20,H135+21, H135+21,H135+22, H135+22,H135+23, 10,H135+24, H135+24,H135+25, H135+25,H135+26, H135+26,H135+27, \ + 10,H135+28, H135+28,H135+29, H135+29,H135+30, H135+30,H135+31, 10,H135+32, H135+32,H135+33, H135+33,H135+34, H135+34,H135+35, \ + 10,H135+36, H135+36,H135+37, H135+37,H135+38, H135+38,H135+39, \ + \ + F135+0,F135+1, F135+1,F135+2, F135+2,F135+3, F135+3,F135+4, F135+4,F135+5, F135+5,F135+6, F135+6,F135+7, F135+7,F135+8, F135+8,F135+9, F135+9,F135+10, F135+10,F135+11, F135+11,F135+12, F135+12,F135+13, F135+13,F135+14, F135+14,F135+15, F135+15,F135+16, F135+17,F135+18, F135+18,F135+19, F135+19,F135+20, \ + F135+20,F135+21, F135+22,F135+23, F135+23,F135+24, F135+24,F135+25, F135+25,F135+26, F135+27,F135+28, F135+28,F135+29, F135+29,F135+30, F135+31,F135+32, F135+32,F135+33, F135+33,F135+34, F135+34,F135+35, F135+36,F135+37, F135+37,F135+38, F135+38,F135+39, F135+39,F135+40, F135+40,F135+41, \ + F135+41,F135+36, F135+42,F135+43, F135+43,F135+44, F135+44,F135+45, F135+45,F135+46, F135+46,F135+47, F135+47,F135+42, F135+48,F135+49, F135+49,F135+50, F135+50,F135+51, F135+51,F135+52, F135+52,F135+53, F135+53,F135+54, F135+54,F135+55, F135+55,F135+56, F135+56,F135+57, F135+57,F135+58, \ + F135+58,F135+59, F135+59,F135+48, F135+60,F135+61, F135+61,F135+62, F135+62,F135+63, F135+63,F135+64, F135+64,F135+65, F135+65,F135+66, F135+66,F135+67, F135+67,F135+60 + // Disabled really noisy values + #define POSE_BODY_135_SCALES_RENDER_GPU \ + 1.f,1.f,1.f,1.f,1.f, 1.f,1.f,1.f,1.f,1.f, 1.f,1.f,1.f,1.f,1.f, 1.f,1.f, \ + 0.00f,0.00f, \ + 1.f,1.f,1.f,1.f,1.f,1.f, \ + 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, \ + 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, 0.60f,0.60f,0.60f,0.60f,0.60f, \ + 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, \ + 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, \ + 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f, \ + 0.45f,0.45f,0.45f,0.45f,0.45f, 0.45f,0.45f,0.45f,0.45f,0.45f + // First 0.45f row: + // 0.00f,0.00f,0.00f,0.00f,0.00f, 0.00f,0.00f,0.00f,0.00f,0.00f, 0.00f,0.00f,0.00f,0.00f,0.00f, 0.00f,0.00f,0.45f,0.45f,0.45f, + #define POSE_BODY_135_COLORS_RENDER_GPU \ + 255.f, 0.f, 85.f, \ + 170.f, 0.f, 255.f, \ + 255.f, 0.f, 170.f, \ + 85.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 170.f, 255.f, 0.f, \ + 255.f, 85.f, 0.f, \ + 85.f, 255.f, 0.f, \ + 255.f, 170.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 0.f, 170.f, 255.f, \ + 0.f, 255.f, 85.f, \ + 0.f, 85.f, 255.f, \ + 0.f, 255.f, 170.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 255.f, 255.f, \ + \ + 255.f, 0.f, 0.f, \ + 191.f, 47.f, 47.f, \ + 127.f, 63.f, 63.f, \ + 63.f, 47.f, 47.f, \ + 255.f, 76.f, 0.f, \ + 191.f, 57.f, 0.f, \ + 127.f, 38.f, 0.f, \ + 63.f, 19.f, 0.f, \ + 255.f, 152.f, 0.f, \ + 191.f, 114.f, 0.f, \ + 127.f, 76.f, 0.f, \ + 63.f, 38.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 191.f, 191.f, 0.f, \ + 127.f, 127.f, 0.f, \ + 63.f, 63.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 0.f, 191.f, 0.f, \ + 0.f, 127.f, 0.f, \ + 0.f, 63.f, 0.f, \ + \ + 255.f, 0.f, 153.f, \ + 191.f, 0.f, 114.f, \ + 127.f, 0.f, 76.f, \ + 63.f, 0.f, 38.f, \ + 203.f, 0.f, 255.f, \ + 152.f, 0.f, 191.f, \ + 101.f, 0.f, 127.f, \ + 50.f, 0.f, 63.f, \ + 50.f, 0.f, 255.f, \ + 37.f, 0.f, 191.f, \ + 25.f, 0.f, 127.f, \ + 12.f, 0.f, 63.f, \ + 0.f, 102.f, 255.f, \ + 0.f, 76.f, 191.f, \ + 0.f, 51.f, 127.f, \ + 0.f, 25.f, 63.f, \ + 0.f, 255.f, 255.f, \ + 0.f, 191.f, 191.f, \ + 0.f, 127.f, 127.f, \ + 0.f, 63.f, 63.f, \ + \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f, \ + 255.f, 255.f, 255.f + + // CAR_12 + #define POSE_CAR_12_PAIRS_RENDER_GPU \ + 4,5, 4,6, 4,0, 0,2, 4,8, 8,10, 5,7, 5,1, 1,3, 5,9, 9,11, 0,1, 8,9, 2,3, 6,7, 10,11, 6,2,7,3, 6,10,7,11 + // 4,5, 4,6, 4,0, 0,2, 4,8, 8,10, 5,7, 5,1, 1,3, 5,9, 9,11 + #define POSE_CAR_12_SCALES_RENDER_GPU 0.5 + #define POSE_CAR_12_COLORS_RENDER_GPU \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + 255.f, 255.f, 0.f, \ + 255.f, 255.f, 0.f, \ + \ + 255.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 75.f, 75.f, \ + 255.f, 75.f, 75.f, \ + \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f, \ + 255.f, 0.f, 255.f + + // CAR_22 + #define POSE_CAR_22_PAIRS_RENDER_GPU \ + 0,1,1,3,3,2,2,0, 6,7,7,16,16,17,17,6, 12,13,13,14,14,15,15,12, 6,8,7,8,6,9,7,9,6,4,7,5, 12,11,13,10, \ + 16,18,17,18,16,19,17,19, 6,21,7,20 + #define POSE_CAR_22_SCALES_RENDER_GPU 0.625 + #define POSE_CAR_22_COLORS_RENDER_GPU \ + 255.f, 128.f, 128.f, \ + 255.f, 0.f, 0.f, \ + 64.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + \ + 0.f, 0.f, 64.f, \ + 128.f, 128.f, 255.f, \ + \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + \ + 64.f, 0.f, 0.f, \ + 255.f, 128.f, 128.f, \ + 255.f, 0.f, 0.f, \ + 255.f, 0.f, 0.f, \ + \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 255.f, \ + \ + 0.f, 255.f, 0.f, \ + 0.f, 255.f, 0.f, \ + \ + 0.f, 0.f, 255.f, \ + 0.f, 0.f, 64.f + + // Rendering functions + OP_API const std::vector& getPoseScales(const PoseModel poseModel); + OP_API const std::vector& getPoseColors(const PoseModel poseModel); + OP_API const std::vector& getPoseBodyPartPairsRender(const PoseModel poseModel); + OP_API unsigned int getNumberElementsToRender(const PoseModel poseModel); +} + +#endif // OPENPOSE_POSE_POSE_PARAMETERS_RENDER_HPP diff --git a/usr/local/include/openpose/pose/poseRenderer.hpp b/usr/local/include/openpose/pose/poseRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..83fe90707be5fc17cb9cd3749f589ca23f85f398 --- /dev/null +++ b/usr/local/include/openpose/pose/poseRenderer.hpp @@ -0,0 +1,33 @@ +#ifndef OPENPOSE_POSE_POSE_RENDERER_HPP +#define OPENPOSE_POSE_POSE_RENDERER_HPP + +#include +#include +#include + +namespace op +{ + class OP_API PoseRenderer + { + public: + PoseRenderer(const PoseModel poseModel); + + virtual ~PoseRenderer(); + + virtual void initializationOnThread(){}; + + virtual std::pair renderPose( + Array& outputData, const Array& poseKeypoints, const float scaleInputToOutput, + const float scaleNetToOutput = -1.f) = 0; + + protected: + const PoseModel mPoseModel; + const std::map mPartIndexToName; + + private: + + DELETE_COPY(PoseRenderer); + }; +} + +#endif // OPENPOSE_POSE_POSE_RENDERER_HPP diff --git a/usr/local/include/openpose/pose/renderPose.hpp b/usr/local/include/openpose/pose/renderPose.hpp new file mode 100644 index 0000000000000000000000000000000000000000..41da3e680c07532ce22fbf4b01632c798ec27fc8 --- /dev/null +++ b/usr/local/include/openpose/pose/renderPose.hpp @@ -0,0 +1,45 @@ +#ifndef OPENPOSE_POSE_RENDER_POSE_HPP +#define OPENPOSE_POSE_RENDER_POSE_HPP + +#include +#include +#include + +namespace op +{ + OP_API void renderPoseKeypointsCpu( + Array& frameArray, const Array& poseKeypoints, const PoseModel poseModel, + const float renderThreshold, const bool blendOriginalFrame = true); + + void renderPoseKeypointsGpu( + float* framePtr, float* maxPtr, float* minPtr, float* scalePtr, const PoseModel poseModel, + const int numberPeople, const Point& frameSize, const float* const posePtr, + const float renderThreshold, const bool googlyEyes = false, const bool blendOriginalFrame = true, + const float alphaBlending = POSE_DEFAULT_ALPHA_KEYPOINT); + + void renderPoseHeatMapGpu( + float* frame, const Point& frameSize, const float* const heatMapPtr, const Point& heatMapSize, + const float scaleToKeepRatio, const unsigned int part, + const float alphaBlending = POSE_DEFAULT_ALPHA_HEAT_MAP); + + void renderPoseHeatMapsGpu( + float* frame, const PoseModel poseModel, const Point& frameSize, const float* const heatMapPtr, + const Point& heatMapSize, const float scaleToKeepRatio, + const float alphaBlending = POSE_DEFAULT_ALPHA_HEAT_MAP); + + void renderPosePAFGpu( + float* framePtr, const PoseModel poseModel, const Point& frameSize, const float* const heatMapPtr, + const Point& heatMapSize, const float scaleToKeepRatio, const int part, + const float alphaBlending = POSE_DEFAULT_ALPHA_HEAT_MAP); + + void renderPosePAFsGpu( + float* framePtr, const PoseModel poseModel, const Point& frameSize, const float* const heatMapPtr, + const Point& heatMapSize, const float scaleToKeepRatio, + const float alphaBlending = POSE_DEFAULT_ALPHA_HEAT_MAP); + + void renderPoseDistanceGpu( + float* framePtr, const Point& frameSize, const float* const heatMapPtr, const Point& heatMapSize, + const float scaleToKeepRatio, const unsigned int part, const float alphaBlending = POSE_DEFAULT_ALPHA_HEAT_MAP); +} + +#endif // OPENPOSE_POSE_RENDER_POSE_HPP diff --git a/usr/local/include/openpose/pose/wPoseExtractor.hpp b/usr/local/include/openpose/pose/wPoseExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b1980a6889dce8641ba7ff8b87ae227b3d16e6e --- /dev/null +++ b/usr/local/include/openpose/pose/wPoseExtractor.hpp @@ -0,0 +1,114 @@ +#ifndef OPENPOSE_POSE_W_POSE_EXTRACTOR_HPP +#define OPENPOSE_POSE_W_POSE_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + template + class WPoseExtractor : public Worker + { + public: + explicit WPoseExtractor(const std::shared_ptr& poseExtractorSharedPtr); + + virtual ~WPoseExtractor(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spPoseExtractor; + + DELETE_COPY(WPoseExtractor); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPoseExtractor::WPoseExtractor(const std::shared_ptr& poseExtractorSharedPtr) : + spPoseExtractor{poseExtractorSharedPtr} + { + } + + template + WPoseExtractor::~WPoseExtractor() + { + } + + template + void WPoseExtractor::initializationOnThread() + { + try + { + spPoseExtractor->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WPoseExtractor::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Extract people pose + for (auto i = 0u ; i < tDatums->size() ; i++) + // for (auto& tDatum : *tDatums) + { + auto& tDatumPtr = (*tDatums)[i]; + // OpenPose net forward pass + spPoseExtractor->forwardPass( + tDatumPtr->inputNetData, Point{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}, + tDatumPtr->scaleInputToNetInputs, tDatumPtr->poseNetOutput, tDatumPtr->id); + // OpenPose keypoint detector + tDatumPtr->poseCandidates = spPoseExtractor->getCandidatesCopy(); + tDatumPtr->poseHeatMaps = spPoseExtractor->getHeatMapsCopy(); + tDatumPtr->poseKeypoints = spPoseExtractor->getPoseKeypoints().clone(); + tDatumPtr->poseScores = spPoseExtractor->getPoseScores().clone(); + tDatumPtr->scaleNetToOutput = spPoseExtractor->getScaleNetToOutput(); + // Keep desired top N people + spPoseExtractor->keepTopPeople(tDatumPtr->poseKeypoints, tDatumPtr->poseScores); + // ID extractor (experimental) + tDatumPtr->poseIds = spPoseExtractor->extractIdsLockThread( + tDatumPtr->poseKeypoints, tDatumPtr->cvInputData, i, tDatumPtr->id); + // Tracking (experimental) + spPoseExtractor->trackLockThread( + tDatumPtr->poseKeypoints, tDatumPtr->poseIds, tDatumPtr->cvInputData, i, tDatumPtr->id); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPoseExtractor); +} + +#endif // OPENPOSE_POSE_W_POSE_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/pose/wPoseExtractorNet.hpp b/usr/local/include/openpose/pose/wPoseExtractorNet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..868300894607a2a0aee3a61d494866370287ee96 --- /dev/null +++ b/usr/local/include/openpose/pose/wPoseExtractorNet.hpp @@ -0,0 +1,102 @@ +#ifndef OPENPOSE_POSE_W_POSE_EXTRACTOR_NET_HPP +#define OPENPOSE_POSE_W_POSE_EXTRACTOR_NET_HPP + +#include +#include +#include + +namespace op +{ + template + class WPoseExtractorNet : public Worker + { + public: + explicit WPoseExtractorNet(const std::shared_ptr& poseExtractorSharedPtr); + + virtual ~WPoseExtractorNet(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spPoseExtractorNet; + + DELETE_COPY(WPoseExtractorNet); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPoseExtractorNet::WPoseExtractorNet(const std::shared_ptr& poseExtractorSharedPtr) : + spPoseExtractorNet{poseExtractorSharedPtr} + { + } + + template + WPoseExtractorNet::~WPoseExtractorNet() + { + } + + template + void WPoseExtractorNet::initializationOnThread() + { + try + { + spPoseExtractorNet->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WPoseExtractorNet::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Extract people pose + for (auto& tDatumPtr : *tDatums) + { + spPoseExtractorNet->forwardPass( + tDatumPtr->inputNetData, Point{tDatumPtr->cvInputData.cols(), tDatumPtr->cvInputData.rows()}, + tDatumPtr->scaleInputToNetInputs, tDatumPtr->poseNetOutput); + tDatumPtr->poseCandidates = spPoseExtractorNet->getCandidatesCopy(); + tDatumPtr->poseHeatMaps = spPoseExtractorNet->getHeatMapsCopy(); + tDatumPtr->poseKeypoints = spPoseExtractorNet->getPoseKeypoints().clone(); + tDatumPtr->poseScores = spPoseExtractorNet->getPoseScores().clone(); + tDatumPtr->scaleNetToOutput = spPoseExtractorNet->getScaleNetToOutput(); + } + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPoseExtractorNet); +} + +#endif // OPENPOSE_POSE_W_POSE_EXTRACTOR_NET_HPP diff --git a/usr/local/include/openpose/pose/wPoseRenderer.hpp b/usr/local/include/openpose/pose/wPoseRenderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c706b416c596023e7faa04c9bcdd4aa9f9ee3ba4 --- /dev/null +++ b/usr/local/include/openpose/pose/wPoseRenderer.hpp @@ -0,0 +1,95 @@ +#ifndef OPENPOSE_POSE_W_POSE_RENDERER_HPP +#define OPENPOSE_POSE_W_POSE_RENDERER_HPP + +#include +#include +#include + +namespace op +{ + template + class WPoseRenderer : public Worker + { + public: + explicit WPoseRenderer(const std::shared_ptr& poseRendererSharedPtr); + + virtual ~WPoseRenderer(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spPoseRenderer; + + DELETE_COPY(WPoseRenderer); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPoseRenderer::WPoseRenderer(const std::shared_ptr& poseRendererSharedPtr) : + spPoseRenderer{poseRendererSharedPtr} + { + } + + template + WPoseRenderer::~WPoseRenderer() + { + } + + template + void WPoseRenderer::initializationOnThread() + { + try + { + spPoseRenderer->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WPoseRenderer::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Render people pose + for (auto& tDatumPtr : *tDatums) + tDatumPtr->elementRendered = spPoseRenderer->renderPose( + tDatumPtr->outputData, tDatumPtr->poseKeypoints, (float)tDatumPtr->scaleInputToOutput, + (float)tDatumPtr->scaleNetToOutput); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPoseRenderer); +} + +#endif // OPENPOSE_POSE_W_POSE_RENDERER_HPP diff --git a/usr/local/include/openpose/producer/datumProducer.hpp b/usr/local/include/openpose/producer/datumProducer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..062c65f3eaf71914b2d9c59fd6391416523bedd2 --- /dev/null +++ b/usr/local/include/openpose/producer/datumProducer.hpp @@ -0,0 +1,193 @@ +#ifndef OPENPOSE_PRODUCER_DATUM_PRODUCER_HPP +#define OPENPOSE_PRODUCER_DATUM_PRODUCER_HPP + +#include +#include // std::numeric_limits +#include +#include +#include +#include + +namespace op +{ + template + class DatumProducer + { + public: + explicit DatumProducer( + const std::shared_ptr& producerSharedPtr, + const unsigned long long frameFirst = 0, const unsigned long long frameStep = 1, + const unsigned long long frameLast = std::numeric_limits::max(), + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr = nullptr); + + virtual ~DatumProducer(); + + std::pair>>> checkIfRunningAndGetDatum(); + + private: + const unsigned long long mNumberFramesToProcess; + std::shared_ptr spProducer; + unsigned long long mGlobalCounter; + unsigned long long mFrameStep; + unsigned int mNumberConsecutiveEmptyFrames; + std::shared_ptr, std::atomic>> spVideoSeek; + + void checkIfTooManyConsecutiveEmptyFrames( + unsigned int& numberConsecutiveEmptyFrames, const bool emptyFrame) const; + + DELETE_COPY(DatumProducer); + }; +} + + + + + +// Implementation +#include +#include +namespace op +{ + // Auxiliary functions for DatumProducer in order to 1) Reduce compiling time and 2) Remove OpenCV deps. + OP_API void datumProducerConstructor( + const std::shared_ptr& producerSharedPtr, const unsigned long long frameFirst, + const unsigned long long frameStep, const unsigned long long frameLast); + OP_API void datumProducerConstructorTooManyConsecutiveEmptyFrames( + unsigned int& numberConsecutiveEmptyFrames, const bool emptyFrame); + OP_API bool datumProducerConstructorRunningAndGetDatumIsDatumProducerRunning( + const std::shared_ptr& producerSharedPtr, const unsigned long long numberFramesToProcess, + const unsigned long long globalCounter); + OP_API void datumProducerConstructorRunningAndGetDatumApplyPlayerControls( + const std::shared_ptr& producerSharedPtr, + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr); + OP_API unsigned long long datumProducerConstructorRunningAndGetNextFrameNumber( + const std::shared_ptr& producerSharedPtr); + OP_API void datumProducerConstructorRunningAndGetDatumFrameIntegrity(Matrix& matrix); + + template + DatumProducer::DatumProducer( + const std::shared_ptr& producerSharedPtr, + const unsigned long long frameFirst, const unsigned long long frameStep, + const unsigned long long frameLast, + const std::shared_ptr, std::atomic>>& videoSeekSharedPtr) : + mNumberFramesToProcess{(frameLast != std::numeric_limits::max() + ? frameLast - frameFirst : frameLast)}, + spProducer{producerSharedPtr}, + mGlobalCounter{0ll}, + mFrameStep{frameStep}, + mNumberConsecutiveEmptyFrames{0u}, + spVideoSeek{videoSeekSharedPtr} + { + try + { + datumProducerConstructor(producerSharedPtr, frameFirst, frameStep, frameLast); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + DatumProducer::~DatumProducer() + { + } + + template + std::pair>>> DatumProducer::checkIfRunningAndGetDatum() + { + try + { + // If producer released -> it sends an empty Matrix + a datumProducerRunning signal + const bool datumProducerRunning = datumProducerConstructorRunningAndGetDatumIsDatumProducerRunning( + spProducer, mNumberFramesToProcess, mGlobalCounter); + // If device is open + auto datums = std::make_shared>>(); + if (datumProducerRunning) + { + // Fast forward/backward - Seek to specific frame index desired + datumProducerConstructorRunningAndGetDatumApplyPlayerControls(spProducer, spVideoSeek); + // Get Matrix vector + std::string nextFrameName = spProducer->getNextFrameName(); + const unsigned long long nextFrameNumber = datumProducerConstructorRunningAndGetNextFrameNumber( + spProducer); + const std::vector matrices = spProducer->getFrames(); + // Check frames are not empty + checkIfTooManyConsecutiveEmptyFrames( + mNumberConsecutiveEmptyFrames, matrices.empty() || matrices[0].empty()); + if (!matrices.empty()) + { + // Get camera parameters + const std::vector cameraMatrices = spProducer->getCameraMatrices(); + const std::vector cameraExtrinsics = spProducer->getCameraExtrinsics(); + const std::vector cameraIntrinsics = spProducer->getCameraIntrinsics(); + // Resize datum + datums->resize(matrices.size()); + // Datum cannot be assigned before resize() + auto& datumPtr = (*datums)[0]; + datumPtr = std::make_shared(); + // Filling first element + std::swap(datumPtr->name, nextFrameName); + datumPtr->frameNumber = nextFrameNumber; + datumPtr->cvInputData = matrices[0]; + datumProducerConstructorRunningAndGetDatumFrameIntegrity(datumPtr->cvInputData); + if (!cameraMatrices.empty()) + { + datumPtr->cameraMatrix = cameraMatrices[0]; + datumPtr->cameraExtrinsics = cameraExtrinsics[0]; + datumPtr->cameraIntrinsics = cameraIntrinsics[0]; + } + // Initially, cvOutputData = cvInputData. No performance hit (both cv::Mat share raw memory) + datumPtr->cvOutputData = datumPtr->cvInputData; + // Resize if it's stereo-system + if (datums->size() > 1) + { + // Stereo-system: Assign all Matrices + for (auto i = 1u ; i < datums->size() ; i++) + { + auto& datumIPtr = (*datums)[i]; + datumIPtr = std::make_shared(); + datumIPtr->name = datumPtr->name; + datumIPtr->frameNumber = datumPtr->frameNumber; + datumIPtr->cvInputData = matrices[i]; + datumProducerConstructorRunningAndGetDatumFrameIntegrity(datumPtr->cvInputData); + datumIPtr->cvOutputData = datumIPtr->cvInputData; + if (cameraMatrices.size() > i) + { + datumIPtr->cameraMatrix = cameraMatrices[i]; + datumIPtr->cameraExtrinsics = cameraExtrinsics[i]; + datumIPtr->cameraIntrinsics = cameraIntrinsics[i]; + } + } + } + // Check producer is running + if ((*datums)[0]->cvInputData.empty()) + datums = nullptr; + // Increase counter if successful image + if (datums != nullptr) + mGlobalCounter += mFrameStep; + } + } + // Return result + return std::make_pair(datumProducerRunning, datums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return std::make_pair(false, std::make_shared>>()); + } + } + + template + void DatumProducer::checkIfTooManyConsecutiveEmptyFrames( + unsigned int& numberConsecutiveEmptyFrames, const bool emptyFrame) const + { + datumProducerConstructorTooManyConsecutiveEmptyFrames( + numberConsecutiveEmptyFrames, emptyFrame); + } + + extern template class DatumProducer; +} + + +#endif // OPENPOSE_PRODUCER_DATUM_PRODUCER_HPP diff --git a/usr/local/include/openpose/producer/enumClasses.hpp b/usr/local/include/openpose/producer/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2bb4d7e9e644e4677b5de4653f3f4e1629fa9d33 --- /dev/null +++ b/usr/local/include/openpose/producer/enumClasses.hpp @@ -0,0 +1,48 @@ +#ifndef OPENPOSE_PRODUCER_ENUM_CLASSES_HPP +#define OPENPOSE_PRODUCER_ENUM_CLASSES_HPP + +namespace op +{ + enum class ProducerFpsMode : bool + { + /** The frames will be extracted at the original source fps (frames might be skipped or repeated). */ + OriginalFps, + /** The frames will be extracted when the software retrieves them (frames will not be skipped or repeated). */ + RetrievalFps, + }; + + enum class ProducerProperty : unsigned char + { + AutoRepeat = 0, + Flip, + Rotation, + FrameStep, + NumberViews, + Size, + }; + + /** + * Type of producers + * An enum class in which all the possible type of Producer are included. In order to add a new Producer, + * include its name in this enum and add a new 'else if' statement inside ProducerFactory::createProducer(). + */ + enum class ProducerType : unsigned char + { + /** Stereo FLIR (Point-Grey) camera reader. Based on Spinnaker SDK. */ + FlirCamera, + /** An image directory reader. It is able to read images on a folder with a interface similar to the OpenCV + * cv::VideoCapture. + */ + ImageDirectory, + /** An IP camera frames extractor, extending the functionality of cv::VideoCapture. */ + IPCamera, + /** A video frames extractor, extending the functionality of cv::VideoCapture. */ + Video, + /** A webcam frames extractor, extending the functionality of cv::VideoCapture. */ + Webcam, + /** No type defined. Default state when no specific Producer has been picked yet. */ + None, + }; +} + +#endif // OPENPOSE_PRODUCER_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/producer/flirReader.hpp b/usr/local/include/openpose/producer/flirReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0470089527fd775093e6e86cda16465e4229ac97 --- /dev/null +++ b/usr/local/include/openpose/producer/flirReader.hpp @@ -0,0 +1,55 @@ +#ifndef OPENPOSE_PRODUCER_FLIR_READER_HPP +#define OPENPOSE_PRODUCER_FLIR_READER_HPP + +#include +#include +#include + +namespace op +{ + /** + * FlirReader is an abstract class to extract frames from a FLIR stereo-camera system. Its interface imitates the + * cv::VideoCapture class, so it can be used quite similarly to the cv::VideoCapture class. Thus, + * it is quite similar to VideoReader and WebcamReader. + */ + class OP_API FlirReader : public Producer + { + public: + /** + * Constructor of FlirReader. It opens all the available FLIR cameras + */ + explicit FlirReader(const std::string& cameraParametersPath, const Point& cameraResolution, + const bool undistortImage = true, const int cameraIndex = -1); + + virtual ~FlirReader(); + + std::vector getCameraMatrices(); + + std::vector getCameraExtrinsics(); + + std::vector getCameraIntrinsics(); + + std::string getNextFrameName(); + + bool isOpened() const; + + void release(); + + double get(const int capProperty); + + void set(const int capProperty, const double value); + + private: + SpinnakerWrapper mSpinnakerWrapper; + Point mResolution; + unsigned long long mFrameNameCounter; + + Matrix getRawFrame(); + + std::vector getRawFrames(); + + DELETE_COPY(FlirReader); + }; +} + +#endif // OPENPOSE_PRODUCER_FLIR_READER_HPP diff --git a/usr/local/include/openpose/producer/headers.hpp b/usr/local/include/openpose/producer/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..55e84af84d798c899f8a884a8f0473aaedd162f5 --- /dev/null +++ b/usr/local/include/openpose/producer/headers.hpp @@ -0,0 +1,17 @@ +#ifndef OPENPOSE_PRODUCER_HEADERS_HPP +#define OPENPOSE_PRODUCER_HEADERS_HPP + +// producer module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_PRODUCER_HEADERS_HPP diff --git a/usr/local/include/openpose/producer/imageDirectoryReader.hpp b/usr/local/include/openpose/producer/imageDirectoryReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3a832687796692793f3dd62386a07def92b3b96d --- /dev/null +++ b/usr/local/include/openpose/producer/imageDirectoryReader.hpp @@ -0,0 +1,62 @@ +#ifndef OPENPOSE_PRODUCER_IMAGE_DIRECTORY_READER_HPP +#define OPENPOSE_PRODUCER_IMAGE_DIRECTORY_READER_HPP + +#include +#include + +namespace op +{ + /** + * ImageDirectoryReader is an abstract class to extract frames from a image directory. Its interface imitates the + * cv::VideoCapture class, so it can be used quite similarly to the cv::VideoCapture class. Thus, + * it is quite similar to VideoReader and WebcamReader. + */ + class OP_API ImageDirectoryReader : public Producer + { + public: + /** + * Constructor of ImageDirectoryReader. It sets the image directory path from which the images will be loaded + * and generates a std::vector with the list of images on that directory. + * @param imageDirectoryPath const std::string parameter with the folder path containing the images. + * @param cameraParameterPath const std::string parameter with the folder path containing the camera + * parameters (only required if imageDirectorystereo > 1). + * @param numberViews const int parameter with the number of images per iteration (>1 would represent + * stereo processing). + */ + explicit ImageDirectoryReader( + const std::string& imageDirectoryPath, const std::string& cameraParameterPath = "", + const bool undistortImage = false, const int numberViews = -1); + + virtual ~ImageDirectoryReader(); + + std::string getNextFrameName(); + + inline bool isOpened() const + { + return (mFrameNameCounter >= 0); + } + + inline void release() + { + mFrameNameCounter = {-1ll}; + } + + double get(const int capProperty); + + void set(const int capProperty, const double value); + + private: + const std::string mImageDirectoryPath; + const std::vector mFilePaths; + Point mResolution; + long long mFrameNameCounter; + + Matrix getRawFrame(); + + std::vector getRawFrames(); + + DELETE_COPY(ImageDirectoryReader); + }; +} + +#endif // OPENPOSE_PRODUCER_IMAGE_DIRECTORY_READER_HPP diff --git a/usr/local/include/openpose/producer/ipCameraReader.hpp b/usr/local/include/openpose/producer/ipCameraReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..47bd890b3afcdbb6068deff2e778d9a3e2edf914 --- /dev/null +++ b/usr/local/include/openpose/producer/ipCameraReader.hpp @@ -0,0 +1,52 @@ +#ifndef OPENPOSE_PRODUCER_IP_CAMERA_READER_HPP +#define OPENPOSE_PRODUCER_IP_CAMERA_READER_HPP + +#include +#include + +namespace op +{ + /** + * IpCameraReader is a wrapper of the cv::VideoCapture class for IP camera streaming. + */ + class OP_API IpCameraReader : public VideoCaptureReader + { + public: + /** + * Constructor of IpCameraReader. It opens the IP camera as a wrapper of cv::VideoCapture. + * @param cameraPath const std::string parameter with the full camera IP link. + */ + explicit IpCameraReader(const std::string& cameraPath, const std::string& cameraParameterPath = "", + const bool undistortImage = false); + + virtual ~IpCameraReader(); + + std::string getNextFrameName(); + + inline bool isOpened() const + { + return VideoCaptureReader::isOpened(); + } + + inline double get(const int capProperty) + { + return VideoCaptureReader::get(capProperty); + } + + inline void set(const int capProperty, const double value) + { + VideoCaptureReader::set(capProperty, value); + } + + private: + const std::string mPathName; + + Matrix getRawFrame(); + + std::vector getRawFrames(); + + DELETE_COPY(IpCameraReader); + }; +} + +#endif // OPENPOSE_PRODUCER_IP_CAMERA_READER_HPP diff --git a/usr/local/include/openpose/producer/producer.hpp b/usr/local/include/openpose/producer/producer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c00d43bfb3843ab90e2c351ab2115a1fa0520cdb --- /dev/null +++ b/usr/local/include/openpose/producer/producer.hpp @@ -0,0 +1,189 @@ +#ifndef OPENPOSE_PRODUCER_PRODUCER_HPP +#define OPENPOSE_PRODUCER_PRODUCER_HPP + +#include +#include +#include + +namespace op +{ + /** + * Producer is an abstract class to extract frames from a source (image directory, video file, + * webcam stream, etc.). It has the basic and common functions (e.g., getFrame, release & isOpened). + */ + class OP_API Producer + { + public: + /** + * Constructor of Producer. + */ + explicit Producer(const ProducerType type, const std::string& cameraParameterPath, const bool undistortImage, + const int mNumberViews); + + /** + * Destructor of Producer. It is virtual so that any children class can implement + * its own destructor. + */ + virtual ~Producer(); + + /** + * Main function of Producer, it retrieves and returns a new frame from the frames producer. + * @return Mat with the new frame. + */ + Matrix getFrame(); + + /** + * Analogous to getFrame, but it could return > 1 frame. + * @return std::vector with the new frame(s). + */ + std::vector getFrames(); + + /** + * It retrieves and returns the camera matrixes from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera matrices. + */ + virtual std::vector getCameraMatrices(); + + /** + * It retrieves and returns the camera extrinsic parameters from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera extrinsic parameters. + */ + virtual std::vector getCameraExtrinsics(); + + /** + * It retrieves and returns the camera intrinsic parameters from the frames producer. + * Virtual class because FlirReader implements their own. + * @return std::vector with the camera intrinsic parameters. + */ + virtual std::vector getCameraIntrinsics(); + + /** + * This function returns a unique frame name (e.g., the frame number for video, the + * frame counter for webcam, the image name for image directory reader, etc.). + * @return std::string with an unique frame name. + */ + virtual std::string getNextFrameName() = 0; + + /** + * This function sets whether the producer must keep the original fps frame rate or extract the frames as quick + * as possible. + * @param fpsMode ProducerFpsMode parameter specifying the new value. + */ + void setProducerFpsMode(const ProducerFpsMode fpsMode); + + /** + * This function returns the type of producer (video, webcam, ...). + * @return ProducerType with the kind of producer. + */ + inline ProducerType getType() + { + return mType; + } + + /** + * This function returns whether the Producer instance is still opened and able + * to retrieve more frames. + * @return bool indicating whether the Producer is opened. + */ + virtual bool isOpened() const = 0; + + /** + * This function releases and closes the Producer. After it is called, no more frames + * can be retrieved from Producer::getFrames. + */ + virtual void release() = 0; + + /** + * This function is a wrapper of cv::VideoCapture::get. It allows getting different properties + * of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the + * available properties. + * @param capProperty int indicating the property to be modified. + * @return double returning the property value. + */ + virtual double get(const int capProperty) = 0; + + /** + * This function is a wrapper of cv::VideoCapture::set. It allows setting different properties + * of the Producer (fps, width, height, etc.). See the OpenCV documentation for all the + * available properties. + * @param capProperty int indicating the property to be modified. + * @param value double indicating the new value to be assigned. + */ + virtual void set(const int capProperty, const double value) = 0; + + /** + * Extra attributes that VideoCapture::get/set do not contain. + * @param property ProducerProperty indicating the property to be modified. + */ + double get(const ProducerProperty property); + + /** + * Extra attributes that VideoCapture::get/set do not contain. + * @param property ProducerProperty indicating the property to be modified. + * @param value double indicating the new value to be assigned. + */ + void set(const ProducerProperty property, const double value); + + protected: + /** + * Protected function which checks that the frames keeps their integry (some OpenCV versions + * might return corrupted frames within a video or webcam with a size different to the + * standard resolution). If the frame is corrupted, it is set to an empty Mat. + * @param frame Mat with the frame matrix to be checked and modified. + */ + void checkFrameIntegrity(Matrix& frame); + + /** + * Protected function which checks that the frame producer has ended. If so, if resets + * or releases the producer according to mRepeatWhenFinished. + */ + void ifEndedResetOrRelease(); + + /** + * Protected function which forces the producer to get frames at the rate of get(CV_CAP_PROP_FPS). + */ + void keepDesiredFrameRate(); + + /** + * Function to be defined by its children class. It retrieves and returns a new frame from the frames producer. + * @return Mat with the new frame. + */ + virtual Matrix getRawFrame() = 0; + + /** + * Function to be defined by its children class. It retrieves and returns a new frame from the frames producer. + * It is equivalent to getRawFrame when more than 1 image can be returned. + * @return std::vector with the new frames. + */ + virtual std::vector getRawFrames() = 0; + + private: + const ProducerType mType; + ProducerFpsMode mProducerFpsMode; + std::array mProperties; + unsigned int mNumberEmptyFrames; + // For ProducerFpsMode::OriginalFps + bool mTrackingFps; + unsigned long long mFirstFrameTrackingFps; + unsigned long long mNumberFramesTrackingFps; + unsigned int mNumberSetPositionTrackingFps; + std::chrono::high_resolution_clock::time_point mClockTrackingFps; + // Camera parameters + CameraParameterReader mCameraParameterReader; + + DELETE_COPY(Producer); + }; + + /** + * This function returns the desired producer given the input parameters. + */ + OP_API std::shared_ptr createProducer( + const ProducerType producerType = ProducerType::None, const std::string& producerString = "", + const Point& cameraResolution = Point{-1,-1}, + const std::string& cameraParameterPath = "models/cameraParameters/", const bool undistortImage = true, + const int numberViews = -1); +} + +#endif // OPENPOSE_PRODUCER_PRODUCER_HPP diff --git a/usr/local/include/openpose/producer/spinnakerWrapper.hpp b/usr/local/include/openpose/producer/spinnakerWrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..09fd09d857824f57f2c4108f7ab44ff9bc506c67 --- /dev/null +++ b/usr/local/include/openpose/producer/spinnakerWrapper.hpp @@ -0,0 +1,52 @@ +#ifndef OPENPOSE_PRODUCER_SPINNAKER_WRAPPER_HPP +#define OPENPOSE_PRODUCER_SPINNAKER_WRAPPER_HPP + +#include + +namespace op +{ + /** + * SpinnakerWrapper is a subclass of SpinnakerWrapper. It decouples the final interface (meant to imitates + * cv::VideoCapture) from the Spinnaker SDK wrapper. + */ + class OP_API SpinnakerWrapper + { + public: + /** + * Constructor of SpinnakerWrapper. It opens all the available FLIR cameras + * cameraIndex = -1 means that all cameras are taken + */ + explicit SpinnakerWrapper(const std::string& cameraParameterPath, const Point& cameraResolution, + const bool undistortImage, const int cameraIndex = -1); + + virtual ~SpinnakerWrapper(); + + std::vector getRawFrames(); + + /** + * Note: The camera parameters are only read if undistortImage is true. This should be changed to add a + * new bool flag in the constructor, e.g., readCameraParameters + */ + std::vector getCameraMatrices() const; + + std::vector getCameraExtrinsics() const; + + std::vector getCameraIntrinsics() const; + + Point getResolution() const; + + bool isOpened() const; + + void release(); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplSpinnakerWrapper; + std::shared_ptr upImpl; + + DELETE_COPY(SpinnakerWrapper); + }; +} + +#endif // OPENPOSE_PRODUCER_SPINNAKER_WRAPPER_HPP diff --git a/usr/local/include/openpose/producer/videoCaptureReader.hpp b/usr/local/include/openpose/producer/videoCaptureReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d503d3594bea48cdc324cb79694f379ac95ca271 --- /dev/null +++ b/usr/local/include/openpose/producer/videoCaptureReader.hpp @@ -0,0 +1,66 @@ +#ifndef OPENPOSE_PRODUCER_VIDEO_CAPTURE_READER_HPP +#define OPENPOSE_PRODUCER_VIDEO_CAPTURE_READER_HPP + +#include +#include + +namespace op +{ + /** + * VideoCaptureReader is an abstract class to extract frames from a cv::VideoCapture source (video file, + * webcam stream, etc.). It has the basic and common functions of the cv::VideoCapture class (e.g., get, set, etc.). + */ + class OP_API VideoCaptureReader : public Producer + { + public: + /** + * This constructor of VideoCaptureReader wraps cv::VideoCapture(const int). + * @param index const int indicating the cv::VideoCapture constructor int argument, in the range [0, 9]. + */ + explicit VideoCaptureReader(const int index, const bool throwExceptionIfNoOpened, + const std::string& cameraParameterPath, const bool undistortImage, + const int numberViews); + + /** + * This constructor of VideoCaptureReader wraps cv::VideoCapture(const std::string). + * @param path const std::string indicating the cv::VideoCapture constructor string argument. + * @param producerType const std::string indicating whether the frame source is an IP camera or video. + */ + explicit VideoCaptureReader(const std::string& path, const ProducerType producerType, + const std::string& cameraParameterPath, const bool undistortImage, + const int numberViews); + + /** + * Destructor of VideoCaptureReader. It releases the cv::VideoCapture member. It is virtual so that + * any children class can implement its own destructor. + */ + virtual ~VideoCaptureReader(); + + virtual std::string getNextFrameName() = 0; + + virtual bool isOpened() const; + + void release(); + + virtual double get(const int capProperty) = 0; + + virtual void set(const int capProperty, const double value) = 0; + + protected: + virtual Matrix getRawFrame() = 0; + + virtual std::vector getRawFrames() = 0; + + void resetWebcam(const int index, const bool throwExceptionIfNoOpened); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplVideoCaptureReader; + std::unique_ptr upImpl; + + DELETE_COPY(VideoCaptureReader); + }; +} + +#endif // OPENPOSE_PRODUCER_VIDEO_CAPTURE_READER_HPP diff --git a/usr/local/include/openpose/producer/videoReader.hpp b/usr/local/include/openpose/producer/videoReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1132d056690c671b57d8e17781efe8c77d7d6df3 --- /dev/null +++ b/usr/local/include/openpose/producer/videoReader.hpp @@ -0,0 +1,53 @@ +#ifndef OPENPOSE_PRODUCER_VIDEO_READER_HPP +#define OPENPOSE_PRODUCER_VIDEO_READER_HPP + +#include +#include + +namespace op +{ + /** + * VideoReader is a wrapper of the cv::VideoCapture class for video. It allows controlling a video (e.g., extracting + * frames, setting resolution & fps, etc). + */ + class OP_API VideoReader : public VideoCaptureReader + { + public: + /** + * Constructor of VideoReader. It opens the video as a wrapper of cv::VideoCapture. It includes a flag to + * indicate whether the video should be repeated once it is completely read. + * @param videoPath const std::string parameter with the full video path location. + * @param cameraParameterPath const std::string parameter with the folder path containing the camera + * parameters (only required if imageDirectorystereo > 1). + * @param numberViews const int parameter with the number of images per iteration (>1 would represent + * stereo processing). + */ + explicit VideoReader( + const std::string& videoPath, const std::string& cameraParameterPath = "", + const bool undistortImage = false, const int numberViews = -1); + + virtual ~VideoReader(); + + std::string getNextFrameName(); + + inline bool isOpened() const + { + return VideoCaptureReader::isOpened(); + } + + double get(const int capProperty); + + void set(const int capProperty, const double value); + + private: + const std::string mPathName; + + Matrix getRawFrame(); + + std::vector getRawFrames(); + + DELETE_COPY(VideoReader); + }; +} + +#endif // OPENPOSE_PRODUCER_VIDEO_READER_HPP diff --git a/usr/local/include/openpose/producer/wDatumProducer.hpp b/usr/local/include/openpose/producer/wDatumProducer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1bb08dc1ba2f1b0062b9136a59f3819c5758db51 --- /dev/null +++ b/usr/local/include/openpose/producer/wDatumProducer.hpp @@ -0,0 +1,118 @@ +#ifndef OPENPOSE_PRODUCER_W_DATUM_PRODUCER_HPP +#define OPENPOSE_PRODUCER_W_DATUM_PRODUCER_HPP + +#include // std::numeric_limits +#include // std::queue +#include +#include +#include + +namespace op +{ + template + class WDatumProducer : public WorkerProducer>>> + { + public: + explicit WDatumProducer(const std::shared_ptr>& datumProducer); + + virtual ~WDatumProducer(); + + void initializationOnThread(); + + std::shared_ptr>> workProducer(); + + private: + std::shared_ptr> spDatumProducer; + std::queue>>> mQueuedElements; + + DELETE_COPY(WDatumProducer); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WDatumProducer::WDatumProducer( + const std::shared_ptr>& datumProducer) : + spDatumProducer{datumProducer} + { + } + + template + WDatumProducer::~WDatumProducer() + { + } + + + template + void WDatumProducer::initializationOnThread() + { + } + + template + std::shared_ptr>> WDatumProducer::workProducer() + { + try + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Create and fill final shared pointer + std::shared_ptr>> tDatums; + // Producer + if (mQueuedElements.empty()) + { + bool isRunning; + std::tie(isRunning, tDatums) = spDatumProducer->checkIfRunningAndGetDatum(); + // Stop Worker if producer finished + if (!isRunning) + this->stop(); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + // Equivalent to WQueueSplitter + // Queued elements - Multiple views --> Split views into different shared pointers + if (tDatums != nullptr && tDatums->size() > 1) + { + // Add tDatums to mQueuedElements + for (auto i = 0u ; i < tDatums->size() ; i++) + { + auto& tDatumPtr = (*tDatums)[i]; + tDatumPtr->subId = i; + tDatumPtr->subIdMax = tDatums->size()-1; + mQueuedElements.emplace( + std::make_shared>>( + std::vector>{tDatumPtr})); + } + } + // Queued elements - Multiple views --> Return oldest view + if (!mQueuedElements.empty()) + { + tDatums = mQueuedElements.front(); + mQueuedElements.pop(); + } + // Return result + return tDatums; + } + catch (const std::exception& e) + { + this->stop(); + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return nullptr; + } + } + + extern template class WDatumProducer; +} + +#endif // OPENPOSE_PRODUCER_W_DATUM_PRODUCER_HPP diff --git a/usr/local/include/openpose/producer/webcamReader.hpp b/usr/local/include/openpose/producer/webcamReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..04b6f2c27494db161fb28f405874533906df9adb --- /dev/null +++ b/usr/local/include/openpose/producer/webcamReader.hpp @@ -0,0 +1,67 @@ +#ifndef OPENPOSE_PRODUCER_WEBCAM_READER_HPP +#define OPENPOSE_PRODUCER_WEBCAM_READER_HPP + +#include +#include +#include +#include + +namespace op +{ + /** + * WebcamReader is a wrapper of the cv::VideoCapture class for webcam. It allows controlling a video (extracting + * frames, setting resolution & fps, seeking to a particular frame, etc). + */ + class OP_API WebcamReader : public VideoCaptureReader + { + public: + /** + * Constructor of WebcamReader. It opens the webcam as a wrapper of cv::VideoCapture. It includes an argument + * to indicate the desired resolution. + * @param webcamIndex const int indicating the camera source (see the OpenCV documentation about + * cv::VideoCapture for more details), in the range [0, 9]. + * @param webcamResolution const Point parameter which specifies the desired camera resolution. + * @param throwExceptionIfNoOpened Bool parameter which specifies whether to throw an exception if the camera + * cannot be opened. + */ + explicit WebcamReader(const int webcamIndex = 0, const Point& webcamResolution = Point{}, + const bool throwExceptionIfNoOpened = true, const std::string& cameraParameterPath = "", + const bool undistortImage = false); + + virtual ~WebcamReader(); + + std::string getNextFrameName(); + + bool isOpened() const; + + double get(const int capProperty); + + void set(const int capProperty, const double value); + + private: + const int mIndex; + const bool mWebcamStarted; + long long mFrameNameCounter; + bool mThreadOpened; + Matrix mBuffer; + std::mutex mBufferMutex; + std::atomic mCloseThread; + std::thread mThread; + // Detect camera unplugged + double mLastNorm; + std::atomic mDisconnectedCounter; + Point mResolution; + + Matrix getRawFrame(); + + std::vector getRawFrames(); + + void bufferingThread(); + + bool reset(); + + DELETE_COPY(WebcamReader); + }; +} + +#endif // OPENPOSE_PRODUCER_WEBCAM_READER_HPP diff --git a/usr/local/include/openpose/thread/enumClasses.hpp b/usr/local/include/openpose/thread/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d648b5c3b5dc2a2c5f775d0e3e06e5cac019b08 --- /dev/null +++ b/usr/local/include/openpose/thread/enumClasses.hpp @@ -0,0 +1,27 @@ +#ifndef OPENPOSE_THREAD_ENUM_CLASSES_HPP +#define OPENPOSE_THREAD_ENUM_CLASSES_HPP + +namespace op +{ + /** + * ThreadManager synchronization mode. + */ + enum class ThreadManagerMode : unsigned char + { + /** + * First and last queues of ThreadManager will be given to the user, so he must push elements to the first queue and retrieve + * them from the last one after being processed. + * Recommended for prototyping environments (easier to test but more error-prone and potentially slower in performance). + */ + Asynchronous, + AsynchronousIn, /**< Similar to Asynchronous, but only the input (first) queue is given to the user. */ + AsynchronousOut, /**< Similar to Asynchronous, but only the output (last) queue is given to the user. */ + /** + * Everything will run inside the ThreadManager. + * Recommended for production environments (more difficult to set up but faster in performance and less error-prone). + */ + Synchronous, + }; +} + +#endif // OPENPOSE_THREAD_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/thread/headers.hpp b/usr/local/include/openpose/thread/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1afcad9eda6ebbb777046d63ec413ec360f28a1c --- /dev/null +++ b/usr/local/include/openpose/thread/headers.hpp @@ -0,0 +1,24 @@ +#ifndef OPENPOSE_THREAD_HEADERS_HPP +#define OPENPOSE_THREAD_HEADERS_HPP + +// thread module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_THREAD_HEADERS_HPP diff --git a/usr/local/include/openpose/thread/priorityQueue.hpp b/usr/local/include/openpose/thread/priorityQueue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bac8caf9e6ed4aa90b052bb0c6b7decd24b1a097 --- /dev/null +++ b/usr/local/include/openpose/thread/priorityQueue.hpp @@ -0,0 +1,88 @@ +#ifndef OPENPOSE_THREAD_PRIORITY_QUEUE_HPP +#define OPENPOSE_THREAD_PRIORITY_QUEUE_HPP + +#include // std::priority_queue +#include +#include + +namespace op +{ + template, std::greater>> + class PriorityQueue : public QueueBase + { + public: + explicit PriorityQueue(const long long maxSize = 256); + + virtual ~PriorityQueue(); + + TDatums front() const; + + private: + bool pop(TDatums& tDatums); + + DELETE_COPY(PriorityQueue); + }; +} + + + + + +// Implementation +#include // std::is_same +namespace op +{ + template + PriorityQueue::PriorityQueue(const long long maxSize) : + QueueBase{maxSize} + { + // Check TDatums = underlying value type of TQueue + typedef typename TQueue::value_type underlyingValueType; + static_assert(std::is_same::value, + "Error: The type of the queue must be the same as the type of the container"); + } + + template + PriorityQueue::~PriorityQueue() + { + } + + template + TDatums PriorityQueue::front() const + { + try + { + const std::lock_guard lock{this->mMutex}; + return this->mTQueue.top(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return TDatums{}; + } + } + + template + bool PriorityQueue::pop(TDatums& tDatums) + { + try + { + if (this->mPopIsStopped || this->mTQueue.empty()) + return false; + + tDatums = {std::move(this->mTQueue.top())}; + this->mTQueue.pop(); + this->mConditionVariable.notify_one(); + return true; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(PriorityQueue); +} + +#endif // OPENPOSE_THREAD_PRIORITY_QUEUE_HPP diff --git a/usr/local/include/openpose/thread/queue.hpp b/usr/local/include/openpose/thread/queue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b34a9469107d769d58d6af35781e75892837495 --- /dev/null +++ b/usr/local/include/openpose/thread/queue.hpp @@ -0,0 +1,88 @@ +#ifndef OPENPOSE_THREAD_QUEUE_HPP +#define OPENPOSE_THREAD_QUEUE_HPP + +#include // std::queue +#include +#include + +namespace op +{ + template> + class Queue : public QueueBase + { + public: + explicit Queue(const long long maxSize); + + virtual ~Queue(); + + TDatums front() const; + + private: + bool pop(TDatums& tDatums); + + DELETE_COPY(Queue); + }; +} + + + + + +// Implementation +#include // std::is_same +namespace op +{ + template + Queue::Queue(const long long maxSize) : + QueueBase{maxSize} + { + // Check TDatums = underlying value type of TQueue + typedef typename TQueue::value_type underlyingValueType; + static_assert(std::is_same::value, + "Error: The type of the queue must be the same as the type of the container"); + } + + template + Queue::~Queue() + { + } + + template + TDatums Queue::front() const + { + try + { + const std::lock_guard lock{this->mMutex}; + return this->mTQueue.front(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return TDatums{}; + } + } + + template + bool Queue::pop(TDatums& tDatums) + { + try + { + if (this->mPopIsStopped || this->mTQueue.empty()) + return false; + + tDatums = {std::move(this->mTQueue.front())}; + this->mTQueue.pop(); + this->mConditionVariable.notify_one(); + return true; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(Queue); +} + +#endif // OPENPOSE_THREAD_QUEUE_HPP diff --git a/usr/local/include/openpose/thread/queueBase.hpp b/usr/local/include/openpose/thread/queueBase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7d0221a106f7464a2edd6394c0640e300693a762 --- /dev/null +++ b/usr/local/include/openpose/thread/queueBase.hpp @@ -0,0 +1,524 @@ +#ifndef OPENPOSE_THREAD_QUEUE_BASE_HPP +#define OPENPOSE_THREAD_QUEUE_BASE_HPP + +#include +#include +#include // std::queue & std::priority_queue +#include + +namespace op +{ + template + class QueueBase + { + public: + explicit QueueBase(const long long maxSize = -1); + + virtual ~QueueBase(); + + bool forceEmplace(TDatums& tDatums); + + bool tryEmplace(TDatums& tDatums); + + bool waitAndEmplace(TDatums& tDatums); + + bool forcePush(const TDatums& tDatums); + + bool tryPush(const TDatums& tDatums); + + bool waitAndPush(const TDatums& tDatums); + + bool tryPop(TDatums& tDatums); + + bool tryPop(); + + bool waitAndPop(TDatums& tDatums); + + bool waitAndPop(); + + bool empty() const; + + void stop(); + + void stopPusher(); + + void addPopper(); + + void addPusher(); + + bool isRunning() const; + + bool isFull() const; + + size_t size() const; + + void clear(); + + virtual TDatums front() const = 0; + + protected: + mutable std::mutex mMutex; + long long mPoppers; + long long mPushers; + long long mMaxPoppersPushers; + bool mPopIsStopped; + bool mPushIsStopped; + std::condition_variable mConditionVariable; + TQueue mTQueue; + + virtual bool pop(TDatums& tDatums) = 0; + + unsigned long long getMaxSize() const; + + private: + const long long mMaxSize; + + bool emplace(TDatums& tDatums); + + bool push(const TDatums& tDatums); + + bool pop(); + + void updateMaxPoppersPushers(); + + DELETE_COPY(QueueBase); + }; +} + + + + + +// Implementation +#include +#include +namespace op +{ + template + QueueBase::QueueBase(const long long maxSize) : + mPoppers{0ll}, + mPushers{0ll}, + mPopIsStopped{false}, + mPushIsStopped{false}, + mMaxSize{maxSize} + { + } + + // Virtual destructor + template + QueueBase::~QueueBase() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + stop(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool QueueBase::forceEmplace(TDatums& tDatums) + { + try + { + const std::lock_guard lock{mMutex}; + if (mTQueue.size() >= getMaxSize()) + mTQueue.pop(); + return emplace(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::tryEmplace(TDatums& tDatums) + { + try + { + const std::lock_guard lock{mMutex}; + if (mTQueue.size() >= getMaxSize()) + return false; + return emplace(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::waitAndEmplace(TDatums& tDatums) + { + try + { + std::unique_lock lock{mMutex}; + mConditionVariable.wait(lock, [this]{return mTQueue.size() < getMaxSize() || mPushIsStopped; }); + return emplace(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::forcePush(const TDatums& tDatums) + { + try + { + const std::lock_guard lock{mMutex}; + if (mTQueue.size() >= getMaxSize()) + mTQueue.pop(); + return push(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::tryPush(const TDatums& tDatums) + { + try + { + const std::lock_guard lock{mMutex}; + if (mTQueue.size() >= getMaxSize()) + return false; + return push(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::waitAndPush(const TDatums& tDatums) + { + try + { + std::unique_lock lock{mMutex}; + mConditionVariable.wait(lock, [this]{return mTQueue.size() < getMaxSize() || mPushIsStopped; }); + return push(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::tryPop(TDatums& tDatums) + { + try + { + const std::lock_guard lock{mMutex}; + return pop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::tryPop() + { + try + { + const std::lock_guard lock{mMutex}; + return pop(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::waitAndPop(TDatums& tDatums) + { + try + { + std::unique_lock lock{mMutex}; + mConditionVariable.wait(lock, [this]{return !mTQueue.empty() || mPopIsStopped; }); + return pop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::waitAndPop() + { + try + { + std::unique_lock lock{mMutex}; + mConditionVariable.wait(lock, [this]{return !mTQueue.empty() || mPopIsStopped; }); + return pop(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::empty() const + { + try + { + const std::lock_guard lock{mMutex}; + return mTQueue.empty(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + void QueueBase::stop() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const std::lock_guard lock{mMutex}; + mPopIsStopped = {true}; + mPushIsStopped = {true}; + while (!mTQueue.empty()) + mTQueue.pop(); + mConditionVariable.notify_all(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void QueueBase::stopPusher() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const std::lock_guard lock{mMutex}; + mPushers--; + if (mPushers == 0) + { + mPushIsStopped = {true}; + if (mTQueue.empty()) + mPopIsStopped = {true}; + mConditionVariable.notify_all(); + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void QueueBase::addPopper() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const std::lock_guard lock{mMutex}; + mPoppers++; + updateMaxPoppersPushers(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void QueueBase::addPusher() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const std::lock_guard lock{mMutex}; + mPushers++; + updateMaxPoppersPushers(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool QueueBase::isRunning() const + { + try + { + const std::lock_guard lock{mMutex}; + return !(mPushIsStopped && (mPopIsStopped || mTQueue.empty())); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return true; + } + } + + template + bool QueueBase::isFull() const + { + try + { + // No mutex required because the size() and getMaxSize() are already thread-safe + return size() == getMaxSize(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + size_t QueueBase::size() const + { + try + { + const std::lock_guard lock{mMutex}; + return mTQueue.size(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return 0; + } + } + + template + void QueueBase::clear() + { + try + { + const std::lock_guard lock{mMutex}; + while (!mTQueue.empty()) + mTQueue.pop(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + unsigned long long QueueBase::getMaxSize() const + { + try + { + return (mMaxSize > 0 ? mMaxSize : fastMax(1ll, mMaxPoppersPushers)); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::emplace(TDatums& tDatums) + { + try + { + if (mPushIsStopped) + return false; + + mTQueue.emplace(tDatums); + mConditionVariable.notify_all(); + return true; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::push(const TDatums& tDatums) + { + try + { + if (mPushIsStopped) + return false; + + mTQueue.push(tDatums); + mConditionVariable.notify_all(); + return true; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool QueueBase::pop() + { + try + { + if (mPopIsStopped || mTQueue.empty()) + return false; + + mTQueue.pop(); + mConditionVariable.notify_all(); + return true; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + void QueueBase::updateMaxPoppersPushers() + { + try + { + mMaxPoppersPushers = fastMax(mPoppers, mPushers); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + extern template class QueueBase>; + extern template class QueueBase< + BASE_DATUMS_SH, + std::priority_queue, + std::greater>>; +} + +#endif // OPENPOSE_THREAD_QUEUE_BASE_HPP diff --git a/usr/local/include/openpose/thread/subThread.hpp b/usr/local/include/openpose/thread/subThread.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3e35989cd108744900432dd0fc7281b2ff19d698 --- /dev/null +++ b/usr/local/include/openpose/thread/subThread.hpp @@ -0,0 +1,157 @@ +#ifndef OPENPOSE_THREAD_SUB_THREAD_HPP +#define OPENPOSE_THREAD_SUB_THREAD_HPP + +#include +#include + +namespace op +{ + template>> + class SubThread + { + public: + explicit SubThread(const std::vector& tWorkers); + + // Destructor + virtual ~SubThread(); + + void initializationOnThread(); + + virtual bool work() = 0; + + protected: + inline size_t getTWorkersSize() const + { + return mTWorkers.size(); + } + + bool workTWorkers(TDatums& tDatums, const bool inputIsRunning); + + private: + std::vector mTWorkers; + + DELETE_COPY(SubThread); + }; +} + + + + + +// Implementation +namespace op +{ + template + SubThread::SubThread(const std::vector& tWorkers) : + mTWorkers{tWorkers} + { + } + + template + SubThread::~SubThread() + { + } + + template + bool SubThread::workTWorkers(TDatums& tDatums, const bool inputIsRunning) + { + try + { + // If !inputIsRunning -> try to close TWorkers + if (!inputIsRunning) + { + for (auto& tWorkers : mTWorkers) + { + tWorkers->tryStop(); + if (tWorkers->isRunning()) + break; + } + } + + // If (at least) last TWorker still working -> make TWorkers work + if ((*mTWorkers.crbegin())->isRunning()) + { + // Iterate over all workers and check whether some of them stopped + auto allRunning = true; + auto lastOneStopped = false; + for (auto& worker : mTWorkers) + { + if (lastOneStopped) + worker->tryStop(); + + if (!worker->checkAndWork(tDatums)) + { + allRunning = false; + lastOneStopped = true; + } + else + lastOneStopped = false; + } + + if (allRunning) + return true; + else + { + // If last one still running -> try to stop workers + // If last one stopped -> return false + auto lastRunning = (*mTWorkers.crbegin())->isRunning(); + if (lastRunning) + { + // Check last one that stopped + auto lastIndexNotRunning = 0ull; + for (auto i = mTWorkers.size() - 1 ; i > 0 ; i--) + { + if (!mTWorkers[i]->checkAndWork(tDatums)) + { + lastIndexNotRunning = i; + break; + } + } + + // Stop workers before last index stopped + for (auto i = 0ull; i < lastIndexNotRunning ; i++) + mTWorkers[i]->stop(); + + // Try stopping workers after last index stopped + lastRunning = false; + for (auto i = lastIndexNotRunning+1; i < mTWorkers.size() ; i++) + { + mTWorkers[i]->tryStop(); + if (mTWorkers[i]->isRunning()) + { + lastRunning = true; + break; + } + } + } + return lastRunning; + } + } + else + return false; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + void SubThread::initializationOnThread() + { + try + { + for (auto& tWorker : mTWorkers) + tWorker->initializationOnThreadNoException(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(SubThread); +} + +#endif // OPENPOSE_THREAD_SUB_THREAD_HPP diff --git a/usr/local/include/openpose/thread/subThreadNoQueue.hpp b/usr/local/include/openpose/thread/subThreadNoQueue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1331e26bc297949447950cd0252969ad42170b1a --- /dev/null +++ b/usr/local/include/openpose/thread/subThreadNoQueue.hpp @@ -0,0 +1,60 @@ +#ifndef OPENPOSE_THREAD_THREAD_NO_QUEUE_HPP +#define OPENPOSE_THREAD_THREAD_NO_QUEUE_HPP + +#include +#include +#include + +namespace op +{ + template>> + class SubThreadNoQueue : public SubThread + { + public: + explicit SubThreadNoQueue(const std::vector& tWorkers); + + virtual ~SubThreadNoQueue(); + + bool work(); + + DELETE_COPY(SubThreadNoQueue); + }; +} + + + + + +// Implementation +namespace op +{ + template + SubThreadNoQueue::SubThreadNoQueue(const std::vector& tWorkers) : + SubThread{tWorkers} + { + } + + template + SubThreadNoQueue::~SubThreadNoQueue() + { + } + + template + bool SubThreadNoQueue::work() + { + try + { + TDatums tDatums; + return this->workTWorkers(tDatums, true); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(SubThreadNoQueue); +} + +#endif // OPENPOSE_THREAD_THREAD_NO_QUEUE_HPP diff --git a/usr/local/include/openpose/thread/subThreadQueueIn.hpp b/usr/local/include/openpose/thread/subThreadQueueIn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d6ecd9108c7177ef3b319a31dd199f3ad30cdc84 --- /dev/null +++ b/usr/local/include/openpose/thread/subThreadQueueIn.hpp @@ -0,0 +1,80 @@ +#ifndef OPENPOSE_THREAD_THREAD_QUEUE_IN_HPP +#define OPENPOSE_THREAD_THREAD_QUEUE_IN_HPP + +#include +#include +#include +#include + +namespace op +{ + template>, typename TQueue = Queue> + class SubThreadQueueIn : public SubThread + { + public: + SubThreadQueueIn(const std::vector& tWorkers, const std::shared_ptr& tQueueIn); + + virtual ~SubThreadQueueIn(); + + bool work(); + + private: + std::shared_ptr spTQueueIn; + + DELETE_COPY(SubThreadQueueIn); + }; +} + + + + + +// Implementation +namespace op +{ + template + SubThreadQueueIn::SubThreadQueueIn(const std::vector& tWorkers, + const std::shared_ptr& tQueueIn) : + SubThread{tWorkers}, + spTQueueIn{tQueueIn} + { + // spTQueueIn->addPopper(); + } + + template + SubThreadQueueIn::~SubThreadQueueIn() + { + } + + template + bool SubThreadQueueIn::work() + { + try + { + // Pop TDatums + if (spTQueueIn->empty()) + std::this_thread::sleep_for(std::chrono::microseconds{100}); + TDatums tDatums; + bool queueIsRunning = spTQueueIn->tryPop(tDatums); + // Check queue not empty + if (!queueIsRunning) + queueIsRunning = spTQueueIn->isRunning(); + // Process TDatums + const auto workersAreRunning = this->workTWorkers(tDatums, queueIsRunning); + // Close queue input if all workers closed + if (!workersAreRunning) + spTQueueIn->stop(); + return workersAreRunning; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + spTQueueIn->stop(); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(SubThreadQueueIn); +} + +#endif // OPENPOSE_THREAD_THREAD_QUEUE_IN_HPP diff --git a/usr/local/include/openpose/thread/subThreadQueueInOut.hpp b/usr/local/include/openpose/thread/subThreadQueueInOut.hpp new file mode 100644 index 0000000000000000000000000000000000000000..49e796531096982af0277a8b6751aa7fcc0a158c --- /dev/null +++ b/usr/local/include/openpose/thread/subThreadQueueInOut.hpp @@ -0,0 +1,115 @@ +#ifndef OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP +#define OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP + +#include +#include +#include +#include + +namespace op +{ + template>, typename TQueue = Queue> + class SubThreadQueueInOut : public SubThread + { + public: + SubThreadQueueInOut(const std::vector& tWorkers, const std::shared_ptr& tQueueIn, + const std::shared_ptr& tQueueOut); + + virtual ~SubThreadQueueInOut(); + + bool work(); + + private: + std::shared_ptr spTQueueIn; + std::shared_ptr spTQueueOut; + + DELETE_COPY(SubThreadQueueInOut); + }; +} + + + + + +// Implementation +namespace op +{ + template + SubThreadQueueInOut::SubThreadQueueInOut(const std::vector& tWorkers, + const std::shared_ptr& tQueueIn, + const std::shared_ptr& tQueueOut) : + SubThread{tWorkers}, + spTQueueIn{tQueueIn}, + spTQueueOut{tQueueOut} + { + // spTQueueIn->addPopper(); + spTQueueOut->addPusher(); + } + + template + SubThreadQueueInOut::~SubThreadQueueInOut() + { + } + + template + bool SubThreadQueueInOut::work() + { + try + { + // If output queue is closed -> close input queue + if (!spTQueueOut->isRunning()) + { + spTQueueIn->stop(); + return false; + } + // If output queue running -> normal operation + else + { + // Don't work until next queue is not full + // This reduces latency to half + if (!spTQueueOut->isFull()) + { + // Pop TDatums + if (spTQueueIn->empty()) + std::this_thread::sleep_for(std::chrono::microseconds{100}); + TDatums tDatums; + bool workersAreRunning = spTQueueIn->tryPop(tDatums); + // Check queue not stopped + if (!workersAreRunning) + workersAreRunning = spTQueueIn->isRunning(); + // Process TDatums + workersAreRunning = this->workTWorkers(tDatums, workersAreRunning); + // Push/emplace tDatums if successfully processed + if (workersAreRunning) + { + if (tDatums != nullptr) + spTQueueOut->waitAndEmplace(tDatums); + } + // Close both queues otherwise + else + { + spTQueueIn->stop(); + spTQueueOut->stopPusher(); + } + return workersAreRunning; + } + else + { + std::this_thread::sleep_for(std::chrono::microseconds{100}); + return true; + } + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + spTQueueIn->stop(); + spTQueueOut->stop(); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(SubThreadQueueInOut); +} + +#endif // OPENPOSE_THREAD_THREAD_QUEUE_IN_OUT_HPP diff --git a/usr/local/include/openpose/thread/subThreadQueueOut.hpp b/usr/local/include/openpose/thread/subThreadQueueOut.hpp new file mode 100644 index 0000000000000000000000000000000000000000..15181e1434b810fd6d5c44987e9a1d3ef9889a1b --- /dev/null +++ b/usr/local/include/openpose/thread/subThreadQueueOut.hpp @@ -0,0 +1,95 @@ +#ifndef OPENPOSE_THREAD_THREAD_QUEUE_OUT_HPP +#define OPENPOSE_THREAD_THREAD_QUEUE_OUT_HPP + +#include +#include +#include +#include + +namespace op +{ + template>, typename TQueue = Queue> + class SubThreadQueueOut : public SubThread + { + public: + SubThreadQueueOut(const std::vector& tWorkers, const std::shared_ptr& tQueueOut); + + virtual ~SubThreadQueueOut(); + + bool work(); + + private: + std::shared_ptr spTQueueOut; + + DELETE_COPY(SubThreadQueueOut); + }; +} + + + + + +// Implementation +namespace op +{ + template + SubThreadQueueOut::SubThreadQueueOut(const std::vector& tWorkers, + const std::shared_ptr& tQueueOut) : + SubThread{tWorkers}, + spTQueueOut{tQueueOut} + { + spTQueueOut->addPusher(); + } + + template + SubThreadQueueOut::~SubThreadQueueOut() + { + } + + template + bool SubThreadQueueOut::work() + { + try + { + // If output queue is closed -> close input queue + if (!spTQueueOut->isRunning()) + return false; + else + { + // Don't work until next queue is not full + // This reduces latency to half + if (!spTQueueOut->isFull()) + { + // Process TDatums + TDatums tDatums; + const auto workersAreRunning = this->workTWorkers(tDatums, true); + // Push/emplace tDatums if successfully processed + if (workersAreRunning) + { + if (tDatums != nullptr) + spTQueueOut->waitAndEmplace(tDatums); + } + // Close queue otherwise + else + spTQueueOut->stopPusher(); + return workersAreRunning; + } + else + { + std::this_thread::sleep_for(std::chrono::microseconds{100}); + return true; + } + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + spTQueueOut->stop(); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(SubThreadQueueOut); +} + +#endif // OPENPOSE_THREAD_THREAD_QUEUE_OUT_HPP diff --git a/usr/local/include/openpose/thread/thread.hpp b/usr/local/include/openpose/thread/thread.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4a38b0d872f1b6670078c0d2dfa09497417eea3c --- /dev/null +++ b/usr/local/include/openpose/thread/thread.hpp @@ -0,0 +1,237 @@ +#ifndef OPENPOSE_THREAD_THREAD_HPP +#define OPENPOSE_THREAD_THREAD_HPP + +#include +#include +#include +#include + +namespace op +{ + template>> + class Thread + { + public: + explicit Thread(const std::shared_ptr>& isRunningSharedPtr = nullptr); + + // Move constructor + Thread(Thread&& t); + + // Move assignment + Thread& operator=(Thread&& t); + + // Destructor + virtual ~Thread(); + + void add(const std::vector>>& subThreads); + + void add(const std::shared_ptr>& subThread); + + void exec(const std::shared_ptr>& isRunningSharedPtr); + + void startInThread(); + + void stopAndJoin(); + + inline bool isRunning() const + { + return *spIsRunning; + } + + private: + std::shared_ptr> spIsRunning; + std::vector>> mSubThreads; + std::thread mThread; + + void initializationOnThread(); + + void threadFunction(); + + void stop(); + + void join(); + + DELETE_COPY(Thread); + }; +} + + + + + +// Implementation +namespace op +{ + template + Thread::Thread(const std::shared_ptr>& isRunningSharedPtr) : + spIsRunning{(isRunningSharedPtr != nullptr ? isRunningSharedPtr : std::make_shared>(false))} + { + } + + template + Thread::Thread(Thread&& t) : + spIsRunning{std::make_shared>(t.spIsRunning->load())} + { + std::swap(mSubThreads, t.mSubThreads); + std::swap(mThread, t.mThread); + } + + template + Thread& Thread::operator=(Thread&& t) + { + std::swap(mSubThreads, t.mSubThreads); + std::swap(mThread, t.mThread); + spIsRunning = {std::make_shared>(t.spIsRunning->load())}; + return *this; + } + + template + Thread::~Thread() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + stopAndJoin(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + errorDestructor(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::add(const std::vector>>& subThreads) + { + for (const auto& subThread : subThreads) + mSubThreads.emplace_back(subThread); + } + + template + void Thread::add(const std::shared_ptr>& subThread) + { + add(std::vector>>{subThread}); + } + + template + void Thread::exec(const std::shared_ptr>& isRunningSharedPtr) + { + try + { + stopAndJoin(); + spIsRunning = isRunningSharedPtr; + *spIsRunning = true; + threadFunction(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::startInThread() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + stopAndJoin(); + *spIsRunning = true; + mThread = {std::thread{&Thread::threadFunction, this}}; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::stopAndJoin() + { + try + { + stop(); + join(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::initializationOnThread() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + for (auto& subThread : mSubThreads) + subThread->initializationOnThread(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::threadFunction() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + initializationOnThread(); + + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + while (isRunning()) + { + bool allSubThreadsClosed = true; + for (auto& subThread : mSubThreads) + allSubThreadsClosed &= !subThread->work(); + + if (allSubThreadsClosed) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + stop(); + break; + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::stop() + { + try + { + *spIsRunning = false; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void Thread::join() + { + try + { + if (mThread.joinable()) + mThread.join(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(Thread); +} + +#endif // OPENPOSE_THREAD_THREAD_HPP diff --git a/usr/local/include/openpose/thread/threadManager.hpp b/usr/local/include/openpose/thread/threadManager.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8e078d2c7ccfb4506bf2bfa47e2fb69ac418db7 --- /dev/null +++ b/usr/local/include/openpose/thread/threadManager.hpp @@ -0,0 +1,554 @@ +#ifndef OPENPOSE_THREAD_THREAD_MANAGER_HPP +#define OPENPOSE_THREAD_THREAD_MANAGER_HPP + +#include +#include // std::multiset +#include +#include +#include +#include +#include +#include + +namespace op +{ + template>, typename TQueue = Queue> + class ThreadManager + { + public: + // Completely customizable case + explicit ThreadManager(const ThreadManagerMode threadManagerMode = ThreadManagerMode::Synchronous); + + virtual ~ThreadManager(); + + /** + * It sets the maximum number of elements in the queue. + * For maximum speed, set to a very large number, but the trade-off would be: + * - Latency will hugely increase. + * - The program might go out of RAM memory (so the computer might freeze). + * For minimum latency while keeping an optimal speed, set to -1, that will automatically + * detect the ideal number based on how many elements are connected to that queue. + * @param defaultMaxSizeQueues long long element with the maximum number of elements on the queue. + */ + void setDefaultMaxSizeQueues(const long long defaultMaxSizeQueues = -1); + + void add(const unsigned long long threadId, const std::vector& tWorkers, + const unsigned long long queueInId, const unsigned long long queueOutId); + + void add(const unsigned long long threadId, const TWorker& tWorker, const unsigned long long queueInId, + const unsigned long long queueOutId); + + void reset(); + + void exec(); + + void start(); + + void stop(); + + inline std::shared_ptr> getIsRunningSharedPtr() + { + return spIsRunning; + } + + inline bool isRunning() const + { + return *spIsRunning; + } + + bool tryEmplace(TDatums& tDatums); + + bool waitAndEmplace(TDatums& tDatums); + + bool tryPush(const TDatums& tDatums); + + bool waitAndPush(const TDatums& tDatums); + + bool tryPop(TDatums& tDatums); + + bool waitAndPop(TDatums& tDatums); + + private: + const ThreadManagerMode mThreadManagerMode; + std::shared_ptr> spIsRunning; + long long mDefaultMaxSizeQueues; + std::multiset, unsigned long long, unsigned long long>> mThreadWorkerQueues; + std::vector>> mThreads; + std::vector> mTQueues; + + void add(const std::vector, unsigned long long, unsigned long long>>& threadWorkerQueues); + + void add(const std::vector>& threadWorkerQueues); + + void multisetToThreads(); + + void checkAndCreateEmptyThreads(); + + void checkAndCreateQueues(); + + DELETE_COPY(ThreadManager); + }; +} + + + + + +// Implementation +#include // std::pair +#include +#include +#include +#include +#include +#include +namespace op +{ + template + ThreadManager::ThreadManager(const ThreadManagerMode threadManagerMode) : + mThreadManagerMode{threadManagerMode}, + spIsRunning{std::make_shared>(false)}, + mDefaultMaxSizeQueues{-1ll} + { + } + + template + ThreadManager::~ThreadManager() + { + } + + template + void ThreadManager::setDefaultMaxSizeQueues(const long long defaultMaxSizeQueues) + { + try + { + mDefaultMaxSizeQueues = {defaultMaxSizeQueues}; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::add(const unsigned long long threadId, + const std::vector& tWorkers, + const unsigned long long queueInId, + const unsigned long long queueOutId) + { + try + { + add({std::make_tuple(threadId, tWorkers, queueInId, queueOutId)}); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::add(const unsigned long long threadId, + const TWorker& tWorker, + const unsigned long long queueInId, + const unsigned long long queueOutId) + { + try + { + add({std::make_tuple(threadId, std::vector{tWorker}, queueInId, queueOutId)}); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::reset() + { + try + { + mThreadWorkerQueues.clear(); + mThreads.clear(); + mTQueues.clear(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::exec() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Set threads + multisetToThreads(); + if (!mThreads.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Start threads + for (auto i = 0u; i < mThreads.size() - 1; i++) + mThreads.at(i)->startInThread(); + (*mThreads.rbegin())->exec(spIsRunning); + // Stop threads - It will arrive here when the exec() command has finished + stop(); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::start() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Set threads + multisetToThreads(); + // Start threads + for (auto& thread : mThreads) + thread->startInThread(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::stop() + { + try + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + for (auto& tQueue : mTQueues) + tQueue->stop(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + *spIsRunning = false; + for (auto& thread : mThreads) + thread->stopAndJoin(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + checkWorkerErrors(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool ThreadManager::tryEmplace(TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousIn) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return mTQueues[0]->tryEmplace(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool ThreadManager::waitAndEmplace(TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousIn) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return mTQueues[0]->waitAndEmplace(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool ThreadManager::tryPush(const TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousIn) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return mTQueues[0]->tryPush(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool ThreadManager::waitAndPush(const TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousIn) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return mTQueues[0]->waitAndPush(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool ThreadManager::tryPop(TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousOut) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return (*mTQueues.rbegin())->tryPop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool ThreadManager::waitAndPop(TDatums& tDatums) + { + try + { + if (mThreadManagerMode != ThreadManagerMode::Asynchronous + && mThreadManagerMode != ThreadManagerMode::AsynchronousOut) + error("Not available for this ThreadManagerMode.", __LINE__, __FUNCTION__, __FILE__); + if (mTQueues.empty()) + error("ThreadManager already stopped or not started yet.", __LINE__, __FUNCTION__, __FILE__); + return (*mTQueues.rbegin())->waitAndPop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + void ThreadManager::add(const std::vector, + unsigned long long, unsigned long long>>& threadWorkerQueues) + { + try + { + for (const auto& threadWorkerQueue : threadWorkerQueues) + mThreadWorkerQueues.insert(threadWorkerQueue); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::add(const std::vector>& threadWorkerQueues) + { + try + { + for (const auto& threadWorkerQueue : threadWorkerQueues) + add({std::make_tuple(std::get<0>(threadWorkerQueue), + std::vector{std::get<1>(threadWorkerQueue)}, + std::get<2>(threadWorkerQueue), + std::get<3>(threadWorkerQueue))}); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::multisetToThreads() + { + try + { + if (!mThreadWorkerQueues.empty()) + { + // This avoids extra std::cout if errors occur on different threads + setMainThread(); + + // Check threads + checkAndCreateEmptyThreads(); + + // Check and create queues + checkAndCreateQueues(); + + // Data + const auto maxQueueIdSynchronous = mTQueues.size()+1; + + // Set up threads + for (const auto& threadWorkerQueue : mThreadWorkerQueues) + { + auto& thread = mThreads[std::get<0>(threadWorkerQueue)]; + const auto& tWorkers = std::get<1>(threadWorkerQueue); + const auto queueIn = std::get<2>(threadWorkerQueue); + const auto queueOut = std::get<3>(threadWorkerQueue); + std::shared_ptr> subThread; + // If AsynchronousIn -> queue indexes are OK + if (mThreadManagerMode == ThreadManagerMode::Asynchronous + || mThreadManagerMode == ThreadManagerMode::AsynchronousIn) + { + if (mThreadManagerMode == ThreadManagerMode::AsynchronousIn + && queueOut == mTQueues.size()) + subThread = {std::make_shared>( + tWorkers, mTQueues.at(queueIn))}; + else + subThread = {std::make_shared>( + tWorkers, mTQueues.at(queueIn), mTQueues.at(queueOut))}; + } + // If !AsynchronousIn -> queue indexes - 1 + else if (queueOut != maxQueueIdSynchronous + || mThreadManagerMode == ThreadManagerMode::AsynchronousOut) + { + // Queue in + out + if (queueIn != 0) + subThread = {std::make_shared>( + tWorkers, mTQueues.at(queueIn-1), mTQueues.at(queueOut-1))}; + // Case queue out (first TWorker(s)) + else + subThread = {std::make_shared>( + tWorkers, mTQueues.at(queueOut-1))}; + } + // Case queue in (last TWorker(s)) + else if (queueIn != 0) // && queueOut == maxQueueIdSynchronous + subThread = {std::make_shared>( + tWorkers, mTQueues.at(queueIn-1))}; + // Case no queue + else // if (queueIn == 0 && queueOut == maxQueueIdSynchronous) + subThread = {std::make_shared>(tWorkers)}; + thread->add(subThread); + } + } + else + error("Empty, no TWorker(s) added.", __LINE__); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::checkAndCreateEmptyThreads() + { + try + { + // Check all thread ids from 0-maxThreadId are present + const auto maxThreadId = std::get<0>(*mThreadWorkerQueues.crbegin()); + auto previousThreadId = std::get<0>(*mThreadWorkerQueues.cbegin()); + for (const auto& threadWorkerQueue : mThreadWorkerQueues) + { + const auto currentThreadId = std::get<0>(threadWorkerQueue); + if (currentThreadId - previousThreadId > 1) + error("Missing thread id " + std::to_string(currentThreadId) + " of " + + std::to_string(maxThreadId) + ".", __LINE__, __FUNCTION__, __FILE__); + previousThreadId = currentThreadId; + } + + // Create Threads + // #threads = maxThreadId+1 + mThreads.resize(maxThreadId); + for (auto& thread : mThreads) + thread = std::make_shared>(); + mThreads.emplace_back(std::make_shared>(spIsRunning)); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void ThreadManager::checkAndCreateQueues() + { + try + { + if (!mThreadWorkerQueues.empty()) + { + // Get max queue id to get queue size + auto maxQueueId = std::get<3>(*mThreadWorkerQueues.cbegin()); + for (const auto& threadWorkerQueue : mThreadWorkerQueues) + maxQueueId = fastMax( + maxQueueId, fastMax(std::get<2>(threadWorkerQueue), std::get<3>(threadWorkerQueue))); + + // Check each queue id has at least a worker that uses it as input and another one as output. + // Special cases: + std::vector> usedQueueIds(maxQueueId+1, {false, false}); + for (const auto& threadWorkerQueue : mThreadWorkerQueues) + { + usedQueueIds.at(std::get<2>(threadWorkerQueue)).first = true; + usedQueueIds.at(std::get<3>(threadWorkerQueue)).second = true; + } + // Id 0 must only needs a worker using it as input. + usedQueueIds.begin()->second = true; + // Id maxQueueId only needs a worker using it as output. + usedQueueIds.rbegin()->first = true; + // Error if missing queue id + for (auto i = 0ull ; i < usedQueueIds.size() ; i++) + { + if (!usedQueueIds[i].first) + error("Missing queue id " + std::to_string(i) + " (of " + + std::to_string(maxQueueId) + ") as input.", __LINE__, __FUNCTION__, __FILE__); + if (!usedQueueIds[i].second) + error("Missing queue id " + std::to_string(i) + " (of " + + std::to_string(maxQueueId) + ") as output.", __LINE__, __FUNCTION__, __FILE__); + } + + // Create Queues + if (mThreadManagerMode == ThreadManagerMode::Asynchronous) + mTQueues.resize(maxQueueId+1); // First and last one are queues + else if (mThreadManagerMode == ThreadManagerMode::Synchronous) + mTQueues.resize(maxQueueId-1); // First and last one are not actually queues + else if (mThreadManagerMode == ThreadManagerMode::AsynchronousIn + || mThreadManagerMode == ThreadManagerMode::AsynchronousOut) + mTQueues.resize(maxQueueId); // First or last one is queue + else + error("Unknown ThreadManagerMode", __LINE__, __FUNCTION__, __FILE__); + for (auto& tQueue : mTQueues) + tQueue = std::make_shared(mDefaultMaxSizeQueues); + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(ThreadManager); +} + +#endif // OPENPOSE_THREAD_THREAD_MANAGER_HPP diff --git a/usr/local/include/openpose/thread/wFpsMax.hpp b/usr/local/include/openpose/thread/wFpsMax.hpp new file mode 100644 index 0000000000000000000000000000000000000000..41451c2f59731dfc618b4a53e9b02774ccdeef51 --- /dev/null +++ b/usr/local/include/openpose/thread/wFpsMax.hpp @@ -0,0 +1,83 @@ +#ifndef OPENPOSE_THREAD_W_FPS_MAX_HPP +#define OPENPOSE_THREAD_W_FPS_MAX_HPP + +#include +#include +#include +#include + +namespace op +{ + template + class WFpsMax : public Worker + { + public: + explicit WFpsMax(const double fpsMax); + + virtual ~WFpsMax(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + const unsigned long long mNanosecondsToSleep; + + DELETE_COPY(WFpsMax); + }; +} + + + + + +// Implementation +namespace op +{ + template + WFpsMax::WFpsMax(const double fpsMax) : + mNanosecondsToSleep{uLongLongRound(1e9/fpsMax)} + { + } + + template + WFpsMax::~WFpsMax() + { + } + + template + void WFpsMax::initializationOnThread() + { + } + + template + void WFpsMax::work(TDatums& tDatums) + { + try + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // tDatums not used --> Avoid warning + UNUSED(tDatums); + // Sleep the desired time + std::this_thread::sleep_for(std::chrono::nanoseconds{mNanosecondsToSleep}); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WFpsMax); +} + +#endif // OPENPOSE_THREAD_W_FPS_MAX_HPP diff --git a/usr/local/include/openpose/thread/wIdGenerator.hpp b/usr/local/include/openpose/thread/wIdGenerator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0f79a61d8ac4b29f02bb64c11b1c97064f204d10 --- /dev/null +++ b/usr/local/include/openpose/thread/wIdGenerator.hpp @@ -0,0 +1,92 @@ +#ifndef OPENPOSE_THREAD_W_ID_GENERATOR_HPP +#define OPENPOSE_THREAD_W_ID_GENERATOR_HPP + +#include // std::priority_queue +#include +#include +#include + +namespace op +{ + template + class WIdGenerator : public Worker + { + public: + explicit WIdGenerator(); + + virtual ~WIdGenerator(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + unsigned long long mGlobalCounter; + + DELETE_COPY(WIdGenerator); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WIdGenerator::WIdGenerator() : + mGlobalCounter{0ull} + { + } + + template + WIdGenerator::~WIdGenerator() + { + } + + template + void WIdGenerator::initializationOnThread() + { + } + + template + void WIdGenerator::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Add ID + for (auto& tDatumPtr : *tDatums) + // To avoid overwriting ID if e.g., custom input has already filled it + if (tDatumPtr->id == std::numeric_limits::max()) + tDatumPtr->id = mGlobalCounter; + // Increase ID + const auto& tDatumPtr = (*tDatums)[0]; + if (tDatumPtr->subId == tDatumPtr->subIdMax) + mGlobalCounter++; + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WIdGenerator); +} + +#endif // OPENPOSE_THREAD_W_ID_GENERATOR_HPP diff --git a/usr/local/include/openpose/thread/wQueueAssembler.hpp b/usr/local/include/openpose/thread/wQueueAssembler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e0f3f9feb027368d96ef1b570e63f63676a8f34a --- /dev/null +++ b/usr/local/include/openpose/thread/wQueueAssembler.hpp @@ -0,0 +1,112 @@ +#ifndef OPENPOSE_THREAD_W_QUEUE_ASSEMBLER_HPP +#define OPENPOSE_THREAD_W_QUEUE_ASSEMBLER_HPP + +#include // std::queue +#include +#include +#include + +namespace op +{ + // Note: The goal of WQueueAssembler and WQueueSplitter (integrated in wDatumProducer) is to reduce the latency + // of OpenPose. E.g., if 4 cameras in stereo mode, without this, OpenPose would have to process all 4 cameras + // with the same GPU. In this way, this work is parallelized over GPUs (1 view for each). + // Pros: Latency highly recuded, same speed + // Cons: Requires these extra 2 classes and proper threads for them + template + class WQueueAssembler : public Worker> + { + public: + explicit WQueueAssembler(); + + virtual ~WQueueAssembler(); + + void initializationOnThread(); + + void work(std::shared_ptr& tDatums); + + private: + std::shared_ptr mNextTDatums; + + DELETE_COPY(WQueueAssembler); + }; +} + + + + + +// Implementation +namespace op +{ + template + WQueueAssembler::WQueueAssembler() + { + } + + template + WQueueAssembler::~WQueueAssembler() + { + } + + template + void WQueueAssembler::initializationOnThread() + { + } + + template + void WQueueAssembler::work(std::shared_ptr& tDatums) + { + try + { + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Input TDatums -> enqueue it + if (checkNoNullNorEmpty(tDatums)) + { + // Sanity check + if (tDatums->size() > 1) + error("This function assumes that WQueueSplitter (inside WDatumProducer)" + " was applied in the first place, i.e., that there is only 1 element" + " per TDatums (size = " + std::to_string(tDatums->size()) + ").", + __LINE__, __FUNCTION__, __FILE__); + auto tDatumPtr = (*tDatums)[0]; + // Single view --> Return + if (tDatumPtr->subIdMax == 0) + return; + // Multiple view --> Merge views into different TDatums (1st frame) + if (mNextTDatums == nullptr) + mNextTDatums = std::make_shared(); + // Multiple view --> Merge views into different TDatums + mNextTDatums->emplace_back(tDatumPtr); + // Last view - Return frame + if (mNextTDatums->back()->subId == mNextTDatums->back()->subIdMax) + { + tDatums = mNextTDatums; + mNextTDatums = nullptr; + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + // Non-last view - Return nothing + else + tDatums = nullptr; + } + // Sleep if no new tDatums to either pop or push + else + std::this_thread::sleep_for(std::chrono::milliseconds{1}); + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + extern template class WQueueAssembler; +} + +#endif // OPENPOSE_THREAD_W_QUEUE_ASSEMBLER_HPP diff --git a/usr/local/include/openpose/thread/wQueueOrderer.hpp b/usr/local/include/openpose/thread/wQueueOrderer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..115d795eb2e52e4660bd4e9637cff553b21dff66 --- /dev/null +++ b/usr/local/include/openpose/thread/wQueueOrderer.hpp @@ -0,0 +1,178 @@ +#ifndef OPENPOSE_THREAD_W_QUEUE_ORDERER_HPP +#define OPENPOSE_THREAD_W_QUEUE_ORDERER_HPP + +#include // std::priority_queue +#include +#include +#include + +namespace op +{ + template + class WQueueOrderer : public Worker + { + public: + explicit WQueueOrderer(const unsigned int maxBufferSize = 64u); + + virtual ~WQueueOrderer(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + void tryStop(); + + private: + const unsigned int mMaxBufferSize; + bool mStopWhenEmpty; + unsigned long long mNextExpectedId; + unsigned long long mNextExpectedSubId; + std::priority_queue, PointerContainerGreater> mPriorityQueueBuffer; + + DELETE_COPY(WQueueOrderer); + }; +} + + + + + +// Implementation +namespace op +{ + template + WQueueOrderer::WQueueOrderer(const unsigned int maxBufferSize) : + mMaxBufferSize{maxBufferSize}, + mStopWhenEmpty{false}, + mNextExpectedId{0}, + mNextExpectedSubId{0} + { + } + + template + WQueueOrderer::~WQueueOrderer() + { + } + + template + void WQueueOrderer::initializationOnThread() + { + } + + template + void WQueueOrderer::work(TDatums& tDatums) + { + try + { + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + bool profileSpeed = (tDatums != nullptr); + // Input TDatum -> enqueue or return it back + if (checkNoNullNorEmpty(tDatums)) + { + // T* to T + auto& tDatumsNoPtr = *tDatums; + // tDatums is the next expected, update counter + if (tDatumsNoPtr[0]->id == mNextExpectedId && tDatumsNoPtr[0]->subId == mNextExpectedSubId) + { + // If single-view + if (tDatumsNoPtr[0]->subIdMax == 0) + mNextExpectedId++; + // If muilti-view system + else + { + mNextExpectedSubId++; + if (mNextExpectedSubId > tDatumsNoPtr[0]->subIdMax) + { + mNextExpectedSubId = 0; + mNextExpectedId++; + } + } + } + // Else push it to our buffered queue + else + { + // Enqueue current tDatums + mPriorityQueueBuffer.emplace(tDatums); + tDatums = nullptr; + // Else if buffer full -> remove one tDatums + if (mPriorityQueueBuffer.size() > mMaxBufferSize) + { + tDatums = mPriorityQueueBuffer.top(); + mPriorityQueueBuffer.pop(); + } + } + } + // If input TDatum enqueued -> check if previously enqueued next desired frame and pop it + if (!checkNoNullNorEmpty(tDatums)) + { + // Retrieve frame if next is desired frame or if we want to stop this worker + if (!mPriorityQueueBuffer.empty() + && (mStopWhenEmpty || + ((*mPriorityQueueBuffer.top())[0]->id == mNextExpectedId + && (*mPriorityQueueBuffer.top())[0]->subId == mNextExpectedSubId))) + { + tDatums = { mPriorityQueueBuffer.top() }; + mPriorityQueueBuffer.pop(); + } + } + // If TDatum ready to be returned -> updated next expected id + if (checkNoNullNorEmpty(tDatums)) + { + const auto& tDatumsNoPtr = *tDatums; + // If single-view + if (tDatumsNoPtr[0]->subIdMax == 0) + mNextExpectedId = tDatumsNoPtr[0]->id + 1; + // If muilti-view system + else + { + mNextExpectedSubId = tDatumsNoPtr[0]->subId + 1; + if (mNextExpectedSubId > tDatumsNoPtr[0]->subIdMax) + { + mNextExpectedSubId = 0; + mNextExpectedId = tDatumsNoPtr[0]->id + 1; + } + } + } + // Sleep if no new tDatums to either pop or push + if (!checkNoNullNorEmpty(tDatums) && mPriorityQueueBuffer.size() < mMaxBufferSize / 2u) + std::this_thread::sleep_for(std::chrono::milliseconds{1}); + // If TDatum popped and/or pushed + if (profileSpeed || tDatums != nullptr) + { + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WQueueOrderer::tryStop() + { + try + { + // Close if all frames were retrieved from the queue + if (mPriorityQueueBuffer.empty()) + this->stop(); + mStopWhenEmpty = true; + + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WQueueOrderer); +} + +#endif // OPENPOSE_THREAD_W_QUEUE_ORDERER_HPP diff --git a/usr/local/include/openpose/thread/worker.hpp b/usr/local/include/openpose/thread/worker.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a84028431034de9c2764ab0b1eb72915d77ef566 --- /dev/null +++ b/usr/local/include/openpose/thread/worker.hpp @@ -0,0 +1,101 @@ +#ifndef OPENPOSE_THREAD_WORKER_HPP +#define OPENPOSE_THREAD_WORKER_HPP + +#include + +namespace op +{ + template + class Worker + { + public: + Worker(); + + virtual ~Worker(); + + void initializationOnThreadNoException(); + + bool checkAndWork(TDatums& tDatums); + + inline bool isRunning() const + { + return mIsRunning; + } + + inline void stop() + { + mIsRunning = false; + } + + // Virtual in case some function needs special stopping (e.g., buffers might not stop immediately and need a + // few iterations) + inline virtual void tryStop() + { + stop(); + } + + protected: + virtual void initializationOnThread() = 0; + + virtual void work(TDatums& tDatums) = 0; + + private: + bool mIsRunning; + + DELETE_COPY(Worker); + }; +} + + + + + +// Implementation +namespace op +{ + template + Worker::Worker() : + mIsRunning{true} + { + } + + template + Worker::~Worker() + { + } + + template + void Worker::initializationOnThreadNoException() + { + try + { + this->initializationOnThread(); + } + catch (const std::exception& e) + { + this->stop(); + errorWorker(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool Worker::checkAndWork(TDatums& tDatums) + { + try + { + if (mIsRunning) + work(tDatums); + return mIsRunning; + } + catch (const std::exception& e) + { + this->stop(); + errorWorker(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + COMPILE_TEMPLATE_DATUM(Worker); +} + +#endif // OPENPOSE_THREAD_WORKER_HPP diff --git a/usr/local/include/openpose/thread/workerConsumer.hpp b/usr/local/include/openpose/thread/workerConsumer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9d87b1e9154cf4757d2d32cdf23dd9e6f5ec25ee --- /dev/null +++ b/usr/local/include/openpose/thread/workerConsumer.hpp @@ -0,0 +1,51 @@ +#ifndef OPENPOSE_THREAD_WORKER_CONSUMER_HPP +#define OPENPOSE_THREAD_WORKER_CONSUMER_HPP + +#include +#include + +namespace op +{ + template + class WorkerConsumer : public Worker + { + public: + virtual ~WorkerConsumer(); + + void work(TDatums& tDatums); + + protected: + virtual void workConsumer(const TDatums& tDatums) = 0; + }; +} + + + + + +// Implementation +namespace op +{ + template + WorkerConsumer::~WorkerConsumer() + { + } + + template + void WorkerConsumer::work(TDatums& tDatums) + { + try + { + workConsumer(tDatums); + } + catch (const std::exception& e) + { + this->stop(); + errorWorker(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WorkerConsumer); +} + +#endif // OPENPOSE_THREAD_WORKER_CONSUMER_HPP diff --git a/usr/local/include/openpose/thread/workerProducer.hpp b/usr/local/include/openpose/thread/workerProducer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22afca64fed9beca0d3f0e6c69019de8470e9b0f --- /dev/null +++ b/usr/local/include/openpose/thread/workerProducer.hpp @@ -0,0 +1,51 @@ +#ifndef OPENPOSE_THREAD_WORKER_PRODUCER_HPP +#define OPENPOSE_THREAD_WORKER_PRODUCER_HPP + +#include +#include + +namespace op +{ + template + class WorkerProducer : public Worker + { + public: + virtual ~WorkerProducer(); + + void work(TDatums& tDatums); + + protected: + virtual TDatums workProducer() = 0; + }; +} + + + + + +// Implementation +namespace op +{ + template + WorkerProducer::~WorkerProducer() + { + } + + template + void WorkerProducer::work(TDatums& tDatums) + { + try + { + tDatums = std::move(workProducer()); + } + catch (const std::exception& e) + { + this->stop(); + errorWorker(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WorkerProducer); +} + +#endif // OPENPOSE_THREAD_WORKER_PRODUCER_HPP diff --git a/usr/local/include/openpose/tracking/headers.hpp b/usr/local/include/openpose/tracking/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d2daf852c4efadf56d7f439de2a5bcb566f4ba3a --- /dev/null +++ b/usr/local/include/openpose/tracking/headers.hpp @@ -0,0 +1,9 @@ +#ifndef OPENPOSE_TRACKING_HEADERS_HPP +#define OPENPOSE_TRACKING_HEADERS_HPP + +// tracking module +#include +#include +#include + +#endif // OPENPOSE_TRACKING_HEADERS_HPP diff --git a/usr/local/include/openpose/tracking/personIdExtractor.hpp b/usr/local/include/openpose/tracking/personIdExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..78565d559185207c3210036571464abd5684f6af --- /dev/null +++ b/usr/local/include/openpose/tracking/personIdExtractor.hpp @@ -0,0 +1,33 @@ +#ifndef OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP +#define OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP + +#include + +namespace op +{ + class OP_API PersonIdExtractor + { + public: + PersonIdExtractor(const float confidenceThreshold = 0.1f, const float inlierRatioThreshold = 0.5f, + const float distanceThreshold = 30.f, const int numberFramesToDeletePerson = 10); + + virtual ~PersonIdExtractor(); + + Array extractIds(const Array& poseKeypoints, const Matrix& cvMatInput, + const unsigned long long imageViewIndex = 0ull); + + Array extractIdsLockThread(const Array& poseKeypoints, const Matrix& cvMatInput, + const unsigned long long imageViewIndex, + const long long frameId); + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplPersonIdExtractor; + std::shared_ptr spImpl; + + DELETE_COPY(PersonIdExtractor); + }; +} + +#endif // OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/tracking/personTracker.hpp b/usr/local/include/openpose/tracking/personTracker.hpp new file mode 100644 index 0000000000000000000000000000000000000000..339901884b5329ed96f24986ddbe1315c7ffb15c --- /dev/null +++ b/usr/local/include/openpose/tracking/personTracker.hpp @@ -0,0 +1,34 @@ +#ifndef OPENPOSE_OPENPOSE_PRIVATE_TRACKING_PERSON_TRACKER_HPP +#define OPENPOSE_OPENPOSE_PRIVATE_TRACKING_PERSON_TRACKER_HPP + +#include + +namespace op +{ + class OP_API PersonTracker + { + public: + PersonTracker(const bool mergeResults, const int levels = 3, const int patchSize = 31, + const float confidenceThreshold = 0.05f, const bool trackVelocity = false, + const bool scaleVarying = false, const float rescale = 640); + + virtual ~PersonTracker(); + + void track(Array& poseKeypoints, Array& poseIds, const Matrix& cvMatInput); + + void trackLockThread(Array& poseKeypoints, Array& poseIds, const Matrix& cvMatInput, + const long long frameId); + + bool getMergeResults() const; + + private: + // PIMPL idiom + // http://www.cppsamples.com/common-tasks/pimpl.html + struct ImplPersonTracker; + std::shared_ptr spImpl; + + DELETE_COPY(PersonTracker); + }; +} + +#endif // OPENPOSE_OPENPOSE_PRIVATE_TRACKING_PERSON_TRACKER_HPP diff --git a/usr/local/include/openpose/tracking/wPersonIdExtractor.hpp b/usr/local/include/openpose/tracking/wPersonIdExtractor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8f97b2727543858c37434eff53468999cef06401 --- /dev/null +++ b/usr/local/include/openpose/tracking/wPersonIdExtractor.hpp @@ -0,0 +1,86 @@ +#ifndef OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP +#define OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP + +#include +#include +#include + +namespace op +{ + template + class WPersonIdExtractor : public Worker + { + public: + explicit WPersonIdExtractor(const std::shared_ptr& personIdExtractor); + + virtual ~WPersonIdExtractor(); + + void initializationOnThread(); + + void work(TDatums& tDatums); + + private: + std::shared_ptr spPersonIdExtractor; + + DELETE_COPY(WPersonIdExtractor); + }; +} + + + + + +// Implementation +#include +namespace op +{ + template + WPersonIdExtractor::WPersonIdExtractor(const std::shared_ptr& personIdExtractor) : + spPersonIdExtractor{personIdExtractor} + { + } + + template + WPersonIdExtractor::~WPersonIdExtractor() + { + } + + template + void WPersonIdExtractor::initializationOnThread() + { + } + + template + void WPersonIdExtractor::work(TDatums& tDatums) + { + try + { + if (checkNoNullNorEmpty(tDatums)) + { + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Profiling speed + const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // Render people pose + for (auto& tDatumPtr : *tDatums) + tDatumPtr->poseIds = spPersonIdExtractor->extractIds( + tDatumPtr->poseKeypoints, tDatumPtr->cvInputData); + // Profiling speed + Profiler::timerEnd(profilerKey); + Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); + // Debugging log + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + } + } + catch (const std::exception& e) + { + this->stop(); + tDatums = nullptr; + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + COMPILE_TEMPLATE_DATUM(WPersonIdExtractor); +} + +#endif // OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP diff --git a/usr/local/include/openpose/unity/headers.hpp b/usr/local/include/openpose/unity/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..37a37e8a2175f314b7e3b71f2a1151047d93d436 --- /dev/null +++ b/usr/local/include/openpose/unity/headers.hpp @@ -0,0 +1,7 @@ +#ifndef OPENPOSE_UNITY_HEADERS_HPP +#define OPENPOSE_UNITY_HEADERS_HPP + +// unity module +#include + +#endif // OPENPOSE_UNITY_HEADERS_HPP diff --git a/usr/local/include/openpose/unity/unityBinding.hpp b/usr/local/include/openpose/unity/unityBinding.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a09ea815deece390ee0f6b1c003f16777ea66d7 --- /dev/null +++ b/usr/local/include/openpose/unity/unityBinding.hpp @@ -0,0 +1,3 @@ +// Temporarily, all the code is located in +// src/openpose/unity/unityBinding.cpp +// TODO: Move functionality from unityBinding.cpp to this class diff --git a/usr/local/include/openpose/utilities/check.hpp b/usr/local/include/openpose/utilities/check.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5d773263d1ab1ae890697856ea2c475be638f1a7 --- /dev/null +++ b/usr/local/include/openpose/utilities/check.hpp @@ -0,0 +1,79 @@ +#ifndef OPENPOSE_UTILITIES_CHECK_HPP +#define OPENPOSE_UTILITIES_CHECK_HPP + +#include + +namespace op +{ + // CHECK, CHECK_EQ, CHECK_NE, CHECK_LE, CHECK_LT, CHECK_GE, and CHECK_GT + template + void checkBool( + const bool condition, const T& message = "", const int line = -1, const std::string& function = "", + const std::string& file = "") + { + if (!condition) + error("Check failed: " + tToString(message), line, function, file); + } + + template + void checkEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA != conditionB) + error("CheckE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } + + template + void checkNotEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA == conditionB) + error("CheckNE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } + + template + void checkLessOrEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA > conditionB) + error("CheckLE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } + + template + void checkLessThan( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA >= conditionB) + error("CheckLT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } + + template + void checkGreaterOrEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA < conditionB) + error("CheckGE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } + + template + void checkGreaterThan( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") + { + if (conditionA <= conditionB) + error("CheckGT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + + tToString(message), line, function, file); + } +} + +#endif // OPENPOSE_UTILITIES_CHECK_HPP diff --git a/usr/local/include/openpose/utilities/enumClasses.hpp b/usr/local/include/openpose/utilities/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4b724a271ff04736d48745a4e03283611ab82ac7 --- /dev/null +++ b/usr/local/include/openpose/utilities/enumClasses.hpp @@ -0,0 +1,38 @@ +#ifndef OPENPOSE_UTILITIES_ENUM_CLASSES_HPP +#define OPENPOSE_UTILITIES_ENUM_CLASSES_HPP + +namespace op +{ + enum class ErrorMode : unsigned char + { + StdRuntimeError, + FileLogging, + StdCerr, + All, + }; + + enum class LogMode : unsigned char + { + FileLogging, + StdCout, + All, + }; + + enum class Priority : unsigned char + { + None = 0, + Low = 1, + Normal = 2, + High = 3, + Max = 4, + NoOutput = 255, + }; + + enum class Extensions : unsigned char + { + Images, // jpg, png, ... + Size + }; +} + +#endif // OPENPOSE_UTILITIES_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/utilities/errorAndLog.hpp b/usr/local/include/openpose/utilities/errorAndLog.hpp new file mode 100644 index 0000000000000000000000000000000000000000..edfdcfee21c9deb62d921d0169f26a9305d55393 --- /dev/null +++ b/usr/local/include/openpose/utilities/errorAndLog.hpp @@ -0,0 +1,135 @@ +#ifndef OPENPOSE_UTILITIES_ERROR_AND_LOG_HPP +#define OPENPOSE_UTILITIES_ERROR_AND_LOG_HPP + +#include // std::stringstream +#include +#include +#include +#include + +namespace op +{ + OP_API void setMainThread(); + + OP_API std::string getThreadId(); + + OP_API bool getIfInMainThreadOrEmpty(); + + OP_API bool getIfNotInMainThreadOrEmpty(); + + template + std::string tToString(const T& message) + { + // Message -> ostringstream + std::ostringstream oss; + oss << message; + // ostringstream -> std::string + return oss.str(); + } + + /** + * Differences between different kind of errors: + * - error() is a normal error in the code. + * - errorWorker() is an error that occurred on a thread. Therefore, the machine will stop the threads, go back + * to the main thread, and then throw the error. + * - errorDestructor() is an error that occurred on a destructor. Exception on destructors provokes core dumped, + * so we simply output an error message via std::cerr. + */ + + // Error management - How to use: + // error(message, __LINE__, __FUNCTION__, __FILE__); + OP_API void error( + const std::string& message, const int line = -1, const std::string& function = "", + const std::string& file = ""); + + template + inline void error( + const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") + { + error(tToString(message), line, function, file); + } + + // Worker error management + OP_API void checkWorkerErrors(); + + OP_API void errorWorker( + const std::string& message, const int line = -1, const std::string& function = "", + const std::string& file = ""); + + template + inline void errorWorker( + const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") + { + errorWorker(tToString(message), line, function, file); + } + + // Destructor error management + OP_API void errorDestructor( + const std::string& message, const int line = -1, const std::string& function = "", + const std::string& file = ""); + + template + inline void errorDestructor( + const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") + { + errorDestructor(tToString(message), line, function, file); + } + + // Printing info - How to use: + // It will print info if desiredPriority >= sPriorityThreshold + // opLog(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); + OP_API void opLog( + const std::string& message, const Priority priority = Priority::Max, const int line = -1, + const std::string& function = "", const std::string& file = ""); + + template + inline void opLog( + const T& message, const Priority priority = Priority::Max, const int line = -1, + const std::string& function = "", const std::string& file = "") + { + opLog(tToString(message), priority, line, function, file); + } + + // If only desired on debug mode (no computational cost at all on release mode): + // It will print info if desiredPriority >= sPriorityThreshold + // opLogIfDebug(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); + template + inline void opLogIfDebug( + const T& message, const Priority priority = Priority::Max, const int line = -1, + const std::string& function = "", const std::string& file = "") + { + #ifndef NDEBUG + opLog(message, priority, line, function, file); + #else + UNUSED(message); + UNUSED(priority); + UNUSED(line); + UNUSED(function); + UNUSED(file); + #endif + } + + // This class is thread-safe + namespace ConfigureError + { + OP_API std::vector getErrorModes(); + + OP_API void setErrorModes(const std::vector& errorModes); + } + + // This class is not fully thread-safe + namespace ConfigureLog + { + OP_API Priority getPriorityThreshold(); + + OP_API const std::vector& getLogModes(); + + // This function is not thread-safe. It must be run at the beginning + OP_API void setPriorityThreshold(const Priority priorityThreshold); + + // This function is not thread-safe. It must be run at the beginning + OP_API void setLogModes(const std::vector& loggingModes); + } +} + +#endif // OPENPOSE_UTILITIES_ERROR_AND_LOG_HPP diff --git a/usr/local/include/openpose/utilities/fastMath.hpp b/usr/local/include/openpose/utilities/fastMath.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a174f2f324751fb4388471a3ac45b146312adfc2 --- /dev/null +++ b/usr/local/include/openpose/utilities/fastMath.hpp @@ -0,0 +1,91 @@ +#ifndef OPENPOSE_UTILITIES_MATH_HPP +#define OPENPOSE_UTILITIES_MATH_HPP + +namespace op +{ + // Use op::round/max/min for basic types (int, char, long, float, double, etc). Never with classes! + // `std::` alternatives uses 'const T&' instead of 'const T' as argument. + // E.g., std::round is really slow (~300 ms vs ~10 ms when I individually apply it to each element of a whole + // image array + + // VERY IMPORTANT: These fast functions does NOT work for negative integer numbers. + // E.g., positiveIntRound(-180.f) = -179. + + // Round functions + // Signed + template + inline char positiveCharRound(const T a) + { + return char(a+0.5f); + } + + template + inline signed char positiveSCharRound(const T a) + { + return (signed char)(a+0.5f); + } + + template + inline int positiveIntRound(const T a) + { + return int(a+0.5f); + } + + template + inline long positiveLongRound(const T a) + { + return long(a+0.5f); + } + + template + inline long long positiveLongLongRound(const T a) + { + return (long long)(a+0.5f); + } + + // Unsigned + template + inline unsigned char uCharRound(const T a) + { + return (unsigned char)(a+0.5f); + } + + template + inline unsigned int uIntRound(const T a) + { + return (unsigned int)(a+0.5f); + } + + template + inline unsigned long ulongRound(const T a) + { + return (unsigned long)(a+0.5f); + } + + template + inline unsigned long long uLongLongRound(const T a) + { + return (unsigned long long)(a+0.5f); + } + + // Max/min functions + template + inline T fastMax(const T a, const T b) + { + return (a > b ? a : b); + } + + template + inline T fastMin(const T a, const T b) + { + return (a < b ? a : b); + } + + template + inline T fastTruncate(T value, T min = 0, T max = 1) + { + return fastMin(max, fastMax(min, value)); + } +} + +#endif // OPENPOSE_UTILITIES_MATH_HPP diff --git a/usr/local/include/openpose/utilities/fileSystem.hpp b/usr/local/include/openpose/utilities/fileSystem.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d897fb98a8d60dbaac5945db2f09c0136f3f476e --- /dev/null +++ b/usr/local/include/openpose/utilities/fileSystem.hpp @@ -0,0 +1,95 @@ +#ifndef OPENPOSE_UTILITIES_FILE_SYSTEM_HPP +#define OPENPOSE_UTILITIES_FILE_SYSTEM_HPP + +#include + +namespace op +{ + OP_API void makeDirectory(const std::string& directoryPath); + + OP_API bool existDirectory(const std::string& directoryPath); + + OP_API bool existFile(const std::string& filePath); + + /** + * This function makes sure that the directoryPathString is properly formatted. I.e., it + * changes all '\' by '/', and it makes sure that the string finishes with '/'. + * @param directoryPathString std::string with the directory path to be formatted. + * @return std::string with the formatted directory path. + */ + OP_API std::string formatAsDirectory(const std::string& directoryPathString); + + /** + * This function extracts the file name and extension from a full path. + * @param fullPath std::string with the full path. + * @return std::string with the file name with extension. + */ + OP_API std::string getFileNameAndExtension(const std::string& fullPath); + + /** + * This function extracts the file name (without extension) from a full path. + * @param fullPath std::string with the full path. + * @return std::string with the file name without extension. + */ + OP_API std::string getFileNameNoExtension(const std::string& fullPath); + + /** + * This function extracts the extension from a full path. + * E.g., if fullPath is `/media/document.txt`, output will be `txt` + * @param fullPath std::string with the full path. + * @return std::string with the file extension. + */ + OP_API std::string getFileExtension(const std::string& fullPath); + + /** + * This function extracts the full file path without its extension from a full file path. + * @param fullPath std::string with the full path. + * @return std::string with the full file path without extension. + */ + OP_API std::string getFullFilePathNoExtension(const std::string& fullPath); + + /** + * This function extracts the full file path of the folder where it is contained. + * @param fullPath std::string with the full path. + * @return std::string with the full file path of the folder. + */ + OP_API std::string getFileParentFolderPath(const std::string& fullPath); + + /** + * This function extracts all the files in a directory path with the desired + * extensions. If no extensions is specified, then all the file names are returned. + * @param directoryPath std::string with the directory path. + * @param extensions std::vector with the extensions of the desired files. + * @return std::vector with the existing file names. + */ + OP_API std::vector getFilesOnDirectory( + const std::string& directoryPath, const std::vector& extensions = {}); + + /** + * Analogous to getFilesOnDirectory(const std::string& directoryPath, const std::vector& extensions) + * for 1 specific extension. + * @param directoryPath std::string with the directory path. + * @param extension std::string with the extension of the desired files. + * @return std::vector with the existing file names. + */ + OP_API std::vector getFilesOnDirectory( + const std::string& directoryPath, const std::string& extension); + + /** + * This function extracts all the files in a directory path with the desired + * group of extensions (e.g., Extensions::Images). + * @param directoryPath std::string with the directory path. + * @param extensions Extensions with the kind of extensions desired (e.g., Extensions:Images). + * @return std::vector with the existing file names. + */ + OP_API std::vector getFilesOnDirectory( + const std::string& directoryPath, const Extensions extensions); + + OP_API std::string removeSpecialsCharacters(const std::string& stringToVariate); + + OP_API void removeAllOcurrencesOfSubString(std::string& stringToModify, const std::string& substring); + + OP_API void replaceAll(std::string& stringText, const char charToChange, const char charToAdd); +} + +#endif // OPENPOSE_UTILITIES_FILE_SYSTEM_HPP diff --git a/usr/local/include/openpose/utilities/flagsToOpenPose.hpp b/usr/local/include/openpose/utilities/flagsToOpenPose.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8cedea31bff593aefd47e5fdeef8ae54dfd9256f --- /dev/null +++ b/usr/local/include/openpose/utilities/flagsToOpenPose.hpp @@ -0,0 +1,48 @@ +#ifndef OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP +#define OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP + +#include +#include +#include +#include +#include +#include + +namespace op +{ + OP_API PoseMode flagsToPoseMode(const int poseModeInt); + + OP_API PoseModel flagsToPoseModel(const String& poseModeString); + + OP_API ScaleMode flagsToScaleMode(const int keypointScaleMode); + + OP_API ScaleMode flagsToHeatMapScaleMode(const int heatMapScaleMode); + + OP_API Detector flagsToDetector(const int detector); + + // Determine type of frame source + OP_API ProducerType flagsToProducerType( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath, + const int webcamIndex, const bool flirCamera); + + OP_API std::pair flagsToProducer( + const String& imageDirectory, const String& videoPath, const String& ipCameraPath = String(""), + const int webcamIndex = -1, const bool flirCamera = false, const int flirCameraIndex = -1); + + OP_API std::vector flagsToHeatMaps( + const bool heatMapsAddParts = false, const bool heatMapsAddBkg = false, + const bool heatMapsAddPAFs = false); + + OP_API RenderMode flagsToRenderMode( + const int renderFlag, const bool gpuBuggy = false, const int renderPoseFlag = -2); + + OP_API DisplayMode flagsToDisplayMode(const int display, const bool enabled3d); + + /** + * E.g., const Point netInputSize = flagsToPoint(op::String(FLAGS_net_resolution), "-1x368"); + * E.g., const Point resolution = flagsToPoint(resolutionString, "1280x720"); + */ + OP_API Point flagsToPoint(const String& pointString, const String& pointExample); +} + +#endif // OPENPOSE_UTILITIES_FLAGS_TO_OPEN_POSE_HPP diff --git a/usr/local/include/openpose/utilities/headers.hpp b/usr/local/include/openpose/utilities/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..34bdc415a1413f17310f823ca81df35a113a6f92 --- /dev/null +++ b/usr/local/include/openpose/utilities/headers.hpp @@ -0,0 +1,18 @@ +#ifndef OPENPOSE_UTILITIES_HEADERS_HPP +#define OPENPOSE_UTILITIES_HEADERS_HPP + +// utilities module +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_UTILITIES_HEADERS_HPP diff --git a/usr/local/include/openpose/utilities/keypoint.hpp b/usr/local/include/openpose/utilities/keypoint.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de65a730fb32875fae31b18039938e1bcd1fd216 --- /dev/null +++ b/usr/local/include/openpose/utilities/keypoint.hpp @@ -0,0 +1,82 @@ +#ifndef OPENPOSE_UTILITIES_KEYPOINT_HPP +#define OPENPOSE_UTILITIES_KEYPOINT_HPP + +#include + +namespace op +{ + template + T getDistance(const Array& keypoints, const int person, const int elementA, const int elementB); + + template + void averageKeypoints(Array& keypointsA, const Array& keypointsB, const int personA); + + template + void scaleKeypoints(Array& keypoints, const T scale); + + template + void scaleKeypoints2d(Array& keypoints, const T scaleX, const T scaleY); + + template + void scaleKeypoints2d(Array& keypoints, const T scaleX, const T scaleY, const T offsetX, const T offsetY); + + template + void renderKeypointsCpu( + Array& frameArray, const Array& keypoints, const std::vector& pairs, + const std::vector colors, const T thicknessCircleRatio, const T thicknessLineRatioWRTCircle, + const std::vector& poseScales, const T threshold); + + template + Rectangle getKeypointsRectangle( + const Array& keypoints, const int person, const T threshold, const int firstIndex = 0, + const int lastIndex = -1); + + template + T getAverageScore(const Array& keypoints, const int person); + + template + T getKeypointsArea(const Array& keypoints, const int person, const T threshold); + + template + int getBiggestPerson(const Array& keypoints, const T threshold); + + template + int getNonZeroKeypoints(const Array& keypoints, const int person, const T threshold); + + template + T getDistanceAverage(const Array& keypoints, const int personA, const int personB, const T threshold); + + template + T getDistanceAverage( + const Array& keypointsA, const int personA, const Array& keypointsB, const int personB, + const T threshold); + + /** + * Creates and Array with a specific person. + * @param keypoints Array with the original data array to slice. + * @param person indicates the index of the array to extract. + * @param noCopy indicates whether to perform a copy. Copy will never go to undefined behavior, however, if + * noCopy == true, then: + * 1. It is faster, as no data copy is involved, but... + * 2. If the Array keypoints goes out of scope, then the resulting Array will provoke an undefined behavior. + * 3. If the returned Array is modified, the information in the Array keypoints will also be. + * @return Array with the same dimension than keypoints expect the first dimension being 1. E.g., if keypoints + * is {p,k,m}, the resulting Array is {1,k,m}. + */ + template + Array getKeypointsPerson(const Array& keypoints, const int person, const bool noCopy = false); + + template + float getKeypointsRoi(const Array& keypoints, const int personA, const int personB, const T threshold); + + template + float getKeypointsRoi( + const Array& keypointsA, const int personA, const Array& keypointsB, const int personB, + const T threshold); + + template + float getKeypointsRoi( + const Rectangle& rectangleA, const Rectangle& rectangleB); +} + +#endif // OPENPOSE_UTILITIES_KEYPOINT_HPP diff --git a/usr/local/include/openpose/utilities/openCv.hpp b/usr/local/include/openpose/utilities/openCv.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fd8ae9cb02df8e1849be96d34b9861f7179cf8cb --- /dev/null +++ b/usr/local/include/openpose/utilities/openCv.hpp @@ -0,0 +1,72 @@ +#ifndef OPENPOSE_UTILITIES_OPEN_CV_HPP +#define OPENPOSE_UTILITIES_OPEN_CV_HPP + +#include + +namespace op +{ + OP_API void unrollArrayToUCharCvMat(Matrix& matResult, const Array& array); + + OP_API void uCharCvMatToFloatPtr(float* floatPtrImage, const Matrix& matImage, const int normalize); + + OP_API double resizeGetScaleFactor(const Point& initialSize, const Point& targetSize); + + OP_API void keepRoiInside(Rectangle& roi, const int imageWidth, const int imageHeight); + + OP_API void transpose(Matrix& matrix); + + /** + * It performs rotation and flipping over the desired Mat. + * @param cvMat Mat with the frame matrix to be rotated and/or flipped. + * @param rotationAngle How much the cvMat element should be rotated. 0 would mean no rotation. + * @param flipFrame Whether to flip the cvMat element. Set to false to disable it. + */ + OP_API void rotateAndFlipFrame(Matrix& frame, const double rotationAngle, const bool flipFrame = false); + + /** + * Wrapper of CV_CAP_PROP_FRAME_COUNT to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvCapPropFrameCount(); + + /** + * Wrapper of CV_CAP_PROP_FRAME_FPS to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvCapPropFrameFps(); + + /** + * Wrapper of CV_CAP_PROP_FRAME_WIDTH to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvCapPropFrameWidth(); + + /** + * Wrapper of CV_CAP_PROP_FRAME_HEIGHT to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvCapPropFrameHeight(); + + /** + * Wrapper of CV_FOURCC to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvFourcc(const char c1, const char c2, const char c3, const char c4); + + /** + * Wrapper of CV_IMWRITE_JPEG_QUALITY to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvImwriteJpegQuality(); + + /** + * Wrapper of CV_IMWRITE_PNG_COMPRESSION to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvImwritePngCompression(); + + /** + * Wrapper of CV_LOAD_IMAGE_ANYDEPTH to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvLoadImageAnydepth(); + + /** + * Wrapper of CV_LOAD_IMAGE_GRAYSCALE to avoid leaving OpenCV dependencies on headers. + */ + OP_API int getCvLoadImageGrayScale(); +} + +#endif // OPENPOSE_UTILITIES_OPEN_CV_HPP diff --git a/usr/local/include/openpose/utilities/pointerContainer.hpp b/usr/local/include/openpose/utilities/pointerContainer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5e063978b70683b52e29dc4aa4040b133138eba8 --- /dev/null +++ b/usr/local/include/openpose/utilities/pointerContainer.hpp @@ -0,0 +1,43 @@ +#ifndef OPENPOSE_UTILITIES_POINTER_CONTAINER_HPP +#define OPENPOSE_UTILITIES_POINTER_CONTAINER_HPP + +namespace op +{ + template + inline bool checkNoNullNorEmpty(const TPointerContainer& tPointerContainer) + { + return (tPointerContainer != nullptr && tPointerContainer->size() > 0); + } + + template + class PointerContainerGreater + { + public: + bool operator() (const TDatumsSP& a, const TDatumsSP& b) + { + if (!b || b->empty()) + return true; + else if (!a || a->empty()) + return false; + else + return *(*a)[0] > *(*b)[0]; + } + }; + + template + class PointerContainerLess + { + public: + bool operator() (const TDatumsSP& a, const TDatumsSP& b) + { + if (!b || b->empty()) + return false; + else if (!a || a->empty()) + return true; + else + return *(*a)[0] < *(*b)[0]; + } + }; +} + +#endif // OPENPOSE_UTILITIES_POINTER_CONTAINER_HPP diff --git a/usr/local/include/openpose/utilities/profiler.hpp b/usr/local/include/openpose/utilities/profiler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7220137a6a8a01225f9cf050ae975322c8b7dd34 --- /dev/null +++ b/usr/local/include/openpose/utilities/profiler.hpp @@ -0,0 +1,100 @@ +#ifndef OPENPOSE_UTILITIES_PROFILER_HPP +#define OPENPOSE_UTILITIES_PROFILER_HPP + +#include +#include +#include +#include + +namespace op +{ + // The following functions provides basic functions to measure time. Usage example: + // const auto timerInit = getTimerInit(); + // // [Some code in here] + // const auto timeSeconds = getTimeSeconds(timerInit); + // const printTime(timeSeconds, "Function X took ", " seconds."); + OP_API std::chrono::time_point getTimerInit(); + + OP_API double getTimeSeconds(const std::chrono::time_point& timerInit); + + OP_API void printTime( + const std::chrono::time_point& timerInit, const std::string& firstMessage, + const std::string& secondMessage, const Priority priority); + + // The following functions will run REPS times and average the final time in seconds. Usage example: + // const auto REPS = 1000; + // double time = 0.; + // OP_PROFILE_INIT(REPS); + // // [Some code in here] + // OP_PROFILE_END(time, 1e3, REPS); // Time in msec. 1 = sec, 1e3 = msec, 1e6 = usec, 1e9 = nsec, etc. + // opLog("Function X took " + std::to_string(time) + " milliseconds."); + #define OP_PROFILE_INIT(REPS) \ + { \ + const auto timerInit = getTimerInit(); \ + for (auto rep = 0 ; rep < (REPS) ; ++rep) \ + { + #define OP_PROFILE_END(finalTime, factor, REPS) \ + } \ + (finalTime) = (factor)/(float)(REPS)*getTimeSeconds(timerInit); \ + } + + // The following functions will run REPS times, wait for the kernels to finish, and then average the final time + // in seconds. Usage example: + // const auto REPS = 1000; + // double time = 0.; + // OP_CUDA_PROFILE_INIT(REPS); + // // [Some code with CUDA calls in here] + // OP_CUDA_PROFILE_END(time, 1e3, REPS); // Time in msec. 1 = sec, 1e3 = msec, 1e6 = usec, 1e9 = nsec, etc. + // opLog("Function X took " + std::to_string(time) + " milliseconds."); + // Analogous to OP_PROFILE_INIT, but also waits for CUDA kernels to finish their asynchronous operations + // It requires: #include + #define OP_CUDA_PROFILE_INIT(REPS) \ + { \ + cudaDeviceSynchronize(); \ + const auto timerInit = getTimerInit(); \ + for (auto rep = 0 ; rep < (REPS) ; ++rep) \ + { + // Analogous to OP_PROFILE_END, but also waits for CUDA kernels to finish their asynchronous operations + // It requires: #include + #define OP_CUDA_PROFILE_END(finalTime, factor, REPS) \ + } \ + cudaDeviceSynchronize(); \ + (finalTime) = (factor)/(float)(REPS)*getTimeSeconds(timerInit); \ + cudaCheck(__LINE__, __FUNCTION__, __FILE__); \ + } + + // Enable PROFILER_ENABLED on Makefile.config or CMake in order to use this function. Otherwise nothing will be outputted. + // How to use - example: + // For GPU - It can only be applied in the main.cpp file: + // Profiler::profileGpuMemory(__LINE__, __FUNCTION__, __FILE__); + // For time: + // // ... inside continuous loop ... + // const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); + // // functions to do... + // Profiler::timerEnd(profilerKey); + // Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__, NUMBER_ITERATIONS); + class OP_API Profiler + { + public: + static unsigned long long DEFAULT_X; + + // Non-thread safe, it must be performed at the beginning of the code before any parallelization occurs + static void setDefaultX(const unsigned long long defaultX); + + static const std::string timerInit(const int line, const std::string& function, const std::string& file); + + static void timerEnd(const std::string& key); + + static void printAveragedTimeMsOnIterationX( + const std::string& key, const int line, const std::string& function, const std::string& file, + const unsigned long long x = DEFAULT_X); + + static void printAveragedTimeMsEveryXIterations( + const std::string& key, const int line, const std::string& function, const std::string& file, + const unsigned long long x = DEFAULT_X); + + static void profileGpuMemory(const int line, const std::string& function, const std::string& file); + }; +} + +#endif // OPENPOSE_UTILITIES_PROFILER_HPP diff --git a/usr/local/include/openpose/utilities/standard.hpp b/usr/local/include/openpose/utilities/standard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b249a25fd2f842b8de038ac81541ace123763c50 --- /dev/null +++ b/usr/local/include/openpose/utilities/standard.hpp @@ -0,0 +1,57 @@ +#ifndef OPENPOSE_UTILITIES_STANDARD_HPP +#define OPENPOSE_UTILITIES_STANDARD_HPP + +#include + +namespace op +{ + template + bool vectorsAreEqual(const std::vector& vectorA, const std::vector& vectorB) + { + try + { + if (vectorA.size() != vectorB.size()) + return false; + else + { + for (auto i = 0u ; i < vectorA.size() ; i++) + if (vectorA[i] != vectorB[i]) + return false; + return true; + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + /** + * std::vector concatenator. + * Auxiliary function that concatenate std::vectors of any class type T. + * It assumes basic copy (ideal for smart pointers, pointers, etc.), so note that the copy still shares the same + * internal data. It will not work for element that cannot be copied. + * @param vectorA First std::shared_ptr element to be concatenated. + * @param vectorB Second std::shared_ptr element to be concatenated. + * @return Concatenated std::vector of both vectorA and vectorB. + */ + template + std::vector mergeVectors(const std::vector& vectorA, const std::vector& vectorB) + { + try + { + auto vectorToReturn(vectorA); + for (auto& tElement : vectorB) + vectorToReturn.emplace_back(tElement); + return vectorToReturn; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return std::vector{}; + } + } +} + +#endif // OPENPOSE_UTILITIES_STANDARD_HPP diff --git a/usr/local/include/openpose/utilities/string.hpp b/usr/local/include/openpose/utilities/string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..31c13e0082cb56c0976283bdc54a6d66512b405f --- /dev/null +++ b/usr/local/include/openpose/utilities/string.hpp @@ -0,0 +1,31 @@ +#ifndef OPENPOSE_UTILITIES_STRING_HPP +#define OPENPOSE_UTILITIES_STRING_HPP + +#include + +namespace op +{ + OP_API unsigned long long getLastNumber(const std::string& string); + + /** + * This template function turns an integer number into a fixed-length std::string. + * @param number T integer corresponding to the integer to be formatted. + * @param stringLength unsigned long long indicating the final length. If 0, the + * final length is the original number length. + * @return std::string with the formatted value. + */ + template + std::string toFixedLengthString(const T number, const unsigned long long stringLength = 0); + + OP_API std::vector splitString(const std::string& stringToSplit, const std::string& delimiter); + + OP_API std::string toLower(const std::string& string); + + OP_API std::string toUpper(const std::string& string); + + OP_API std::string remove0sFromString(const std::string& string); + + OP_API std::string getFirstNumberOnString(const std::string& string); +} + +#endif // OPENPOSE_UTILITIES_STRING_HPP diff --git a/usr/local/include/openpose/wrapper/enumClasses.hpp b/usr/local/include/openpose/wrapper/enumClasses.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d8283054d1d8bce8eadc3abd159d244d19a73a2 --- /dev/null +++ b/usr/local/include/openpose/wrapper/enumClasses.hpp @@ -0,0 +1,33 @@ +#ifndef OPENPOSE_WRAPPER_ENUM_CLASSES_HPP +#define OPENPOSE_WRAPPER_ENUM_CLASSES_HPP + +namespace op +{ + enum class PoseMode : unsigned char + { + Disabled = 0, + Enabled, + NoNetwork, + Size, + }; + + enum class Detector : unsigned char + { + Body = 0, + OpenCV, + Provided, + BodyWithTracking, + Size, + }; + + enum class WorkerType : unsigned char + { + Input = 0, + PreProcessing, + PostProcessing, + Output, + Size, + }; +} + +#endif // OPENPOSE_WRAPPER_ENUM_CLASSES_HPP diff --git a/usr/local/include/openpose/wrapper/headers.hpp b/usr/local/include/openpose/wrapper/headers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a49b8980fe0502a72d982f6a7f6d97dd7757b77 --- /dev/null +++ b/usr/local/include/openpose/wrapper/headers.hpp @@ -0,0 +1,15 @@ +#ifndef OPENPOSE_WRAPPER_HEADERS_HPP +#define OPENPOSE_WRAPPER_HEADERS_HPP + +// wrapper module +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // OPENPOSE_WRAPPER_HEADERS_HPP diff --git a/usr/local/include/openpose/wrapper/wrapper.hpp b/usr/local/include/openpose/wrapper/wrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f281bb4cdee0919f5f1c7943e6ddbd31eb503394 --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapper.hpp @@ -0,0 +1,716 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_HPP +#define OPENPOSE_WRAPPER_WRAPPER_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + /** + * WrapperT: OpenPose all-in-one wrapper template class. Simplified into Wrapper for WrapperT> + * WrapperT allows the user to set up the input (video, webcam, custom input, etc.), pose, face and/or hands + * estimation and rendering, and output (integrated small GUI, custom output, etc.). + * + * This function can be used in 2 ways: + * - Synchronous mode: call the full constructor with your desired input and output workers. + * - Asynchronous mode: call the empty constructor WrapperT() + use the emplace and pop functions to push the + * original frames and retrieve the processed ones. + * - Mix of them: + * - Synchronous input + asynchronous output: call the constructor WrapperT(ThreadManagerMode::Synchronous, + * workersInput, {}, true) + * - Asynchronous input + synchronous output: call the constructor + * WrapperT(ThreadManagerMode::Synchronous, nullptr, workersOutput, irrelevantBoolean, true) + */ + template>, + typename TDatumsSP = std::shared_ptr, + typename TWorker = std::shared_ptr>> + class WrapperT + { + public: + /** + * Constructor. + * @param threadManagerMode Thread synchronization mode. If set to ThreadManagerMode::Synchronous, everything + * will run inside the WrapperT. If ThreadManagerMode::Synchronous(In/Out), then input (frames producer) and/or + * output (GUI, writing results, etc.) will be controlled outside the WrapperT class by the user. See + * ThreadManagerMode for a detailed explanation of when to use each one. + */ + explicit WrapperT(const ThreadManagerMode threadManagerMode = ThreadManagerMode::Synchronous); + + /** + * Destructor. + * It automatically frees resources. + */ + virtual ~WrapperT(); + + /** + * Disable multi-threading. + * Useful for debugging and logging, all the Workers will run in the same thread. + * Note that workerOnNewThread (argument for setWorker function) will not make any effect. + */ + void disableMultiThreading(); + + /** + * Add an user-defined extra Worker for a desired task (input, output, ...). + * @param workerType WorkerType to configure (e.g., Input, PreProcessing, PostProcessing, Output). + * @param worker TWorker to be added. + * @param workerOnNewThread Whether to add this TWorker on a new thread (if it is computationally demanding) or + * simply reuse existing threads (for light functions). Set to true if the performance time is unknown. + */ + void setWorker(const WorkerType workerType, const TWorker& worker, const bool workerOnNewThread = true); + + /** + * It configures the pose parameters. Do not call for default values. + */ + void configure(const WrapperStructPose& wrapperStructPose); + + /** + * Analogous to configure(WrapperStructPose) but applied to face (WrapperStructFace) + */ + void configure(const WrapperStructFace& wrapperStructFace); + + /** + * Analogous to configure() but applied to hand (WrapperStructHand) + */ + void configure(const WrapperStructHand& wrapperStructHand); + + /** + * Analogous to configure() but applied to the extra options (WrapperStructExtra) + */ + void configure(const WrapperStructExtra& wrapperStructExtra); + + /** + * Analogous to configure() but applied to the input (WrapperStructInput) + */ + void configure(const WrapperStructInput& wrapperStructInput); + + /** + * Analogous to configure() but applied to the output (WrapperStructOutput) + */ + void configure(const WrapperStructOutput& wrapperStructOutput); + + /** + * Analogous to configure() but applied to the GUI (WrapperStructGui) + */ + void configure(const WrapperStructGui& wrapperStructGui); + + /** + * Function to start multi-threading. + * Similar to start(), but exec() blocks the thread that calls the function (it saves 1 thread). Use exec() + * instead of start() if the calling thread will otherwise be waiting for the WrapperT to end. + */ + void exec(); + + /** + * Function to start multi-threading. + * Similar to exec(), but start() does not block the thread that calls the function. It just opens new threads, + * so it lets the user perform other tasks meanwhile on the calling thread. + * VERY IMPORTANT NOTE: if the GUI is selected and OpenCV is compiled with Qt support, this option will not + * work. Qt needs the main thread to plot visual results, so the final GUI (which uses OpenCV) would return an + * exception similar to: `QMetaMethod::invoke: Unable to invoke methods with return values in queued + * connections`. Use exec() in that case. + */ + void start(); + + /** + * Function to stop multi-threading. + * It can be called internally or externally. + */ + void stop(); + + /** + * Whether the WrapperT is running. + * It will return true after exec() or start() and before stop(), and false otherwise. + * @return Boolean specifying whether the WrapperT is running. + */ + bool isRunning() const; + + /** + * It sets the maximum number of elements in the queue. + * For maximum speed, set to a very large number, but the trade-off would be: + * - Latency will hugely increase. + * - The program might go out of RAM memory (so the computer might freeze). + * For minimum latency while keeping an optimal speed, set to -1, that will automatically + * detect the ideal number based on how many elements are connected to that queue. + * @param defaultMaxSizeQueues long long element with the maximum number of elements on the queue. + */ + void setDefaultMaxSizeQueues(const long long defaultMaxSizeQueues = -1); + + /** + * Emplace (move) an element on the first (input) queue. + * Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousIn. + * If the input queue is full or the WrapperT was stopped, it will return false and not emplace it. + * @param tDatums TDatumsSP element to be emplaced. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + bool tryEmplace(TDatumsSP& tDatums); + + /** + * Emplace (move) an element on the first (input) queue. + * Similar to tryEmplace. + * However, if the input queue is full, it will wait until it can emplace it. + * If the WrapperT class is stopped before adding the element, it will return false and not emplace it. + * @param tDatums TDatumsSP element to be emplaced. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + bool waitAndEmplace(TDatumsSP& tDatums); + + /** + * Similar to waitAndEmplace(const TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return Boolean specifying whether the tDatums could be emplaced. + */ + bool waitAndEmplace(Matrix& matrix); + + /** + * Push (copy) an element on the first (input) queue. + * Same as tryEmplace, but it copies the data instead of moving it. + * @param tDatums TDatumsSP element to be pushed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + bool tryPush(const TDatumsSP& tDatums); + + /** + * Push (copy) an element on the first (input) queue. + * Same as waitAndEmplace, but it copies the data instead of moving it. + * @param tDatums TDatumsSP element to be pushed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + bool waitAndPush(const TDatumsSP& tDatums); + + /** + * Similar to waitAndPush(const TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return Boolean specifying whether the tDatums could be pushed. + */ + bool waitAndPush(const Matrix& matrix); + + /** + * Pop (retrieve) an element from the last (output) queue. + * Only valid if ThreadManagerMode::Asynchronous or ThreadManagerMode::AsynchronousOut. + * If the output queue is empty or the WrapperT was stopped, it will return false and not retrieve it. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + bool tryPop(TDatumsSP& tDatums); + + /** + * Pop (retrieve) an element from the last (output) queue. + * Similar to tryPop. + * However, if the output queue is empty, it will wait until it can pop an element. + * If the WrapperT class is stopped before popping the element, it will return false and not retrieve it. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + bool waitAndPop(TDatumsSP& tDatums); + + /** + * Runs both waitAndEmplace and waitAndPop. + * @param tDatums TDatumsSP element where the retrieved element will be placed. + * @return Boolean specifying whether the tDatums could be retrieved. + */ + bool emplaceAndPop(TDatumsSP& tDatums); + + /** + * Similar to emplaceAndPop(TDatumsSP& tDatums), but it takes a Matrix as input. + * @param matrix Matrix with the image to be processed. + * @return TDatumsSP element where the processed information will be placed. + */ + TDatumsSP emplaceAndPop(const Matrix& matrix); + + private: + const ThreadManagerMode mThreadManagerMode; + ThreadManager mThreadManager; + bool mMultiThreadEnabled; + // Configuration + WrapperStructPose mWrapperStructPose; + WrapperStructFace mWrapperStructFace; + WrapperStructHand mWrapperStructHand; + WrapperStructExtra mWrapperStructExtra; + WrapperStructInput mWrapperStructInput; + WrapperStructOutput mWrapperStructOutput; + WrapperStructGui mWrapperStructGui; + // User configurable workers + std::array mUserWsOnNewThread; + std::array, int(WorkerType::Size)> mUserWs; + + DELETE_COPY(WrapperT); + }; + + // Type + typedef WrapperT Wrapper; +} + + + + + +// Implementation +#include +namespace op +{ + template + WrapperT::WrapperT(const ThreadManagerMode threadManagerMode) : + mThreadManagerMode{threadManagerMode}, + mThreadManager{threadManagerMode}, + mMultiThreadEnabled{true} + { + } + + template + WrapperT::~WrapperT() + { + try + { + stop(); + // Reset mThreadManager + mThreadManager.reset(); + // Reset user workers + for (auto& userW : mUserWs) + userW.clear(); + } + catch (const std::exception& e) + { + errorDestructor(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::disableMultiThreading() + { + try + { + mMultiThreadEnabled = false; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::setWorker( + const WorkerType workerType, const TWorker& worker, const bool workerOnNewThread) + { + try + { + // Sanity check + if (worker == nullptr) + error("Your worker is a nullptr.", __LINE__, __FILE__, __FUNCTION__); + // Add worker + mUserWs[int(workerType)].clear(); + mUserWs[int(workerType)].emplace_back(worker); + mUserWsOnNewThread[int(workerType)] = workerOnNewThread; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructPose& wrapperStructPose) + { + try + { + mWrapperStructPose = wrapperStructPose; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructFace& wrapperStructFace) + { + try + { + mWrapperStructFace = wrapperStructFace; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructHand& wrapperStructHand) + { + try + { + mWrapperStructHand = wrapperStructHand; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructExtra& wrapperStructExtra) + { + try + { + mWrapperStructExtra = wrapperStructExtra; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructInput& wrapperStructInput) + { + try + { + mWrapperStructInput = wrapperStructInput; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructOutput& wrapperStructOutput) + { + try + { + mWrapperStructOutput = wrapperStructOutput; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::configure(const WrapperStructGui& wrapperStructGui) + { + try + { + mWrapperStructGui = wrapperStructGui; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::exec() + { + try + { + configureThreadManager( + mThreadManager, mMultiThreadEnabled, mThreadManagerMode, mWrapperStructPose, mWrapperStructFace, + mWrapperStructHand, mWrapperStructExtra, mWrapperStructInput, mWrapperStructOutput, mWrapperStructGui, + mUserWs, mUserWsOnNewThread); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + mThreadManager.exec(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::start() + { + try + { + configureThreadManager( + mThreadManager, mMultiThreadEnabled, mThreadManagerMode, mWrapperStructPose, mWrapperStructFace, + mWrapperStructHand, mWrapperStructExtra, mWrapperStructInput, mWrapperStructOutput, mWrapperStructGui, + mUserWs, mUserWsOnNewThread); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + mThreadManager.start(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void WrapperT::stop() + { + try + { + mThreadManager.stop(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool WrapperT::isRunning() const + { + try + { + return mThreadManager.isRunning(); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + void WrapperT::setDefaultMaxSizeQueues(const long long defaultMaxSizeQueues) + { + try + { + mThreadManager.setDefaultMaxSizeQueues(defaultMaxSizeQueues); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + bool WrapperT::tryEmplace(TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Input)].empty()) + error("Emplace cannot be called if an input worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + // tryEmplace for 1 camera + if (tDatums->size() < 2) + { + return mThreadManager.tryEmplace(tDatums); + } + // tryEmplace for multiview + else + { + bool successfulEmplace = true; + for (auto datumIndex = 0u; datumIndex < tDatums->size(); ++datumIndex) + { + auto tDatumsSingle = std::make_shared(TDatums({ tDatums->at(datumIndex) })); + if (!tryEmplace(tDatumsSingle)) + { + successfulEmplace = false; + break; + } + } + return successfulEmplace; + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::waitAndEmplace(TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Input)].empty()) + error("Emplace cannot be called if an input worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + // waitAndEmplace for 1 camera + if (tDatums->size() < 2) + { + return mThreadManager.waitAndEmplace(tDatums); + } + // waitAndEmplace for multiview + else + { + bool successfulEmplace = true; + for (auto datumIndex = 0u ; datumIndex < tDatums->size() ; ++datumIndex) + { + auto tDatumsSingle = std::make_shared(TDatums({tDatums->at(datumIndex)})); + if (!waitAndEmplace(tDatumsSingle)) + { + successfulEmplace = false; + opLog("Waiting to emplace for multi-camera failed.", + Priority::High, __LINE__, __FUNCTION__, __FILE__); + break; + } + } + return successfulEmplace; + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::waitAndEmplace(Matrix& matrix) + { + try + { + // Create new datum + auto datumsPtr = std::make_shared>>(); + datumsPtr->emplace_back(); + auto& tDatumPtr = datumsPtr->at(0); + tDatumPtr = std::make_shared(); + // Fill datum + std::swap(tDatumPtr->cvInputData, matrix); + // Return result + return waitAndEmplace(datumsPtr); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::tryPush(const TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Input)].empty()) + error("Push cannot be called if an input worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + return mThreadManager.tryPush(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::waitAndPush(const TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Input)].empty()) + error("Push cannot be called if an input worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + return mThreadManager.waitAndPush(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::waitAndPush(const Matrix& matrix) + { + try + { + // Create new datum + auto datumsPtr = std::make_shared>>(); + datumsPtr->emplace_back(); + auto& tDatumPtr = datumsPtr->at(0); + tDatumPtr = std::make_shared(); + // Fill datum + tDatumPtr->cvInputData = matrix.clone(); + // Return result + return waitAndEmplace(datumsPtr); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::tryPop(TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Output)].empty()) + error("Pop cannot be called if an output worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + return mThreadManager.tryPop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::waitAndPop(TDatumsSP& tDatums) + { + try + { + if (!mUserWs[int(WorkerType::Output)].empty()) + error("Pop cannot be called if an output worker was already selected.", + __LINE__, __FUNCTION__, __FILE__); + return mThreadManager.waitAndPop(tDatums); + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + bool WrapperT::emplaceAndPop(TDatumsSP& tDatums) + { + try + { + // Run waitAndEmplace + waitAndPop + if (waitAndEmplace(tDatums)) + return waitAndPop(tDatums); + return false; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return false; + } + } + + template + TDatumsSP WrapperT::emplaceAndPop(const Matrix& matrix) + { + try + { + // Create new datum + auto datumsPtr = std::make_shared>>(); + datumsPtr->emplace_back(); + auto& tDatumPtr = datumsPtr->at(0); + tDatumPtr = std::make_shared(); + // Fill datum + tDatumPtr->cvInputData = matrix; + // Emplace and pop + emplaceAndPop(datumsPtr); + // Return result + return datumsPtr; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + return TDatumsSP{}; + } + } + + extern template class WrapperT; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperAuxiliary.hpp b/usr/local/include/openpose/wrapper/wrapperAuxiliary.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c2820df17ad30e8b3a535184a7cf23b356474745 --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperAuxiliary.hpp @@ -0,0 +1,1275 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP +#define OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace op +{ + /** + * It checks that no wrong/contradictory flags are enabled for Wrapper(T) + * @param wrapperStructPose + * @param wrapperStructFace + * @param wrapperStructHand + * @param wrapperStructExtra + * @param wrapperStructInput + * @param wrapperStructOutput + * @param renderOutput + * @param userOutputWsEmpty + * @param producerSharedPtr + * @param threadManagerMode + */ + OP_API void wrapperConfigureSanityChecks( + WrapperStructPose& wrapperStructPose, const WrapperStructFace& wrapperStructFace, + const WrapperStructHand& wrapperStructHand, const WrapperStructExtra& wrapperStructExtra, + const WrapperStructInput& wrapperStructInput, const WrapperStructOutput& wrapperStructOutput, + const WrapperStructGui& wrapperStructGui, const bool renderOutput, const bool userInputAndPreprocessingWsEmpty, + const bool userOutputWsEmpty, const std::shared_ptr& producerSharedPtr, + const ThreadManagerMode threadManagerMode); + + /** + * Thread ID increase (private internal function). + * If multi-threading mode, it increases the thread ID. + * If single-threading mode (for debugging), it does not modify it. + * Note that mThreadId must be re-initialized to 0 before starting a new Wrapper(T) configuration. + * @param threadId unsigned long long element with the current thread id value. I will be edited to the next + * `desired thread id number. + */ + OP_API void threadIdPP(unsigned long long& threadId, const bool multiThreadEnabled); + + /** + * Set ThreadManager from TWorkers (private internal function). + * After any configure() has been called, the TWorkers are initialized. This function resets the ThreadManager + * and adds them. + * Common code for start() and exec(). + */ + template>, + typename TDatumsSP = std::shared_ptr, + typename TWorker = std::shared_ptr>> + void configureThreadManager( + ThreadManager& threadManager, const bool multiThreadEnabled, + const ThreadManagerMode threadManagerMode, const WrapperStructPose& wrapperStructPose, + const WrapperStructFace& wrapperStructFace, const WrapperStructHand& wrapperStructHand, + const WrapperStructExtra& wrapperStructExtra, const WrapperStructInput& wrapperStructInput, + const WrapperStructOutput& wrapperStructOutput, const WrapperStructGui& wrapperStructGui, + const std::array, int(WorkerType::Size)>& userWs, + const std::array& userWsOnNewThread); + + /** + * It fills camera parameters and splits the cvMat depending on how many camera parameter matrices are found. + * For example usage, check `examples/tutorial_api_cpp/11_asynchronous_custom_input_multi_camera.cpp` + */ + template>, + typename TDatumsSP = std::shared_ptr> + void createMultiviewTDatum( + TDatumsSP& tDatumsSP, unsigned long long& frameCounter, + const CameraParameterReader& cameraParameterReader, const void* const cvMatPtr); +} + + + + + +// Implementation +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace op +{ + template + void configureThreadManager( + ThreadManager& threadManager, const bool multiThreadEnabledTemp, + const ThreadManagerMode threadManagerMode, const WrapperStructPose& wrapperStructPoseTemp, + const WrapperStructFace& wrapperStructFace, const WrapperStructHand& wrapperStructHand, + const WrapperStructExtra& wrapperStructExtra, const WrapperStructInput& wrapperStructInput, + const WrapperStructOutput& wrapperStructOutput, const WrapperStructGui& wrapperStructGui, + const std::array, int(WorkerType::Size)>& userWs, + const std::array& userWsOnNewThread) + { + try + { + opLog("Running configureThreadManager...", Priority::Normal); + + // Create producer + auto producerSharedPtr = createProducer( + wrapperStructInput.producerType, wrapperStructInput.producerString.getStdString(), + wrapperStructInput.cameraResolution, wrapperStructInput.cameraParameterPath.getStdString(), + wrapperStructInput.undistortImage, wrapperStructInput.numberViews); + + // Editable arguments + auto wrapperStructPose = wrapperStructPoseTemp; + auto multiThreadEnabled = multiThreadEnabledTemp; + + // User custom workers + const auto& userInputWs = userWs[int(WorkerType::Input)]; + const auto& userPreProcessingWs = userWs[int(WorkerType::PreProcessing)]; + const auto& userPostProcessingWs = userWs[int(WorkerType::PostProcessing)]; + const auto& userOutputWs = userWs[int(WorkerType::Output)]; + const auto userInputWsOnNewThread = userWsOnNewThread[int(WorkerType::Input)]; + const auto userPreProcessingWsOnNewThread = userWsOnNewThread[int(WorkerType::PreProcessing)]; + const auto userPostProcessingWsOnNewThread = userWsOnNewThread[int(WorkerType::PostProcessing)]; + const auto userOutputWsOnNewThread = userWsOnNewThread[int(WorkerType::Output)]; + + // Video seek + const auto spVideoSeek = std::make_shared, std::atomic>>(); + // It cannot be directly included in the constructor (compiler error for copying std::atomic) + spVideoSeek->first = false; + spVideoSeek->second = 0; + + // Required parameters + const auto gpuMode = getGpuMode(); + const auto renderModePose = ( + wrapperStructPose.renderMode != RenderMode::Auto + ? wrapperStructPose.renderMode + : (gpuMode == GpuMode::Cuda ? RenderMode::Gpu : RenderMode::Cpu)); + const auto renderModeFace = ( + wrapperStructFace.renderMode != RenderMode::Auto + ? wrapperStructFace.renderMode + : (gpuMode == GpuMode::Cuda ? RenderMode::Gpu : RenderMode::Cpu)); + const auto renderModeHand = ( + wrapperStructHand.renderMode != RenderMode::Auto + ? wrapperStructHand.renderMode + : (gpuMode == GpuMode::Cuda ? RenderMode::Gpu : RenderMode::Cpu)); + const auto renderOutput = renderModePose != RenderMode::None + || renderModeFace != RenderMode::None + || renderModeHand != RenderMode::None; + const bool renderOutputGpu = renderModePose == RenderMode::Gpu + || (wrapperStructFace.enable && renderModeFace == RenderMode::Gpu) + || (wrapperStructHand.enable && renderModeHand == RenderMode::Gpu); + const bool renderFace = wrapperStructFace.enable && renderModeFace != RenderMode::None; + const bool renderHand = wrapperStructHand.enable && renderModeHand != RenderMode::None; + const bool renderHandGpu = wrapperStructHand.enable && renderModeHand == RenderMode::Gpu; + opLog("renderModePose = " + std::to_string(int(renderModePose)), Priority::Normal); + opLog("renderModeFace = " + std::to_string(int(renderModeFace)), Priority::Normal); + opLog("renderModeHand = " + std::to_string(int(renderModeHand)), Priority::Normal); + opLog("renderOutput = " + std::to_string(int(renderOutput)), Priority::Normal); + opLog("renderOutputGpu = " + std::to_string(int(renderOutput)), Priority::Normal); + opLog("renderFace = " + std::to_string(int(renderFace)), Priority::Normal); + opLog("renderHand = " + std::to_string(int(renderHand)), Priority::Normal); + opLog("renderHandGpu = " + std::to_string(int(renderHandGpu)), Priority::Normal); + + // Check no wrong/contradictory flags enabled + const bool userInputAndPreprocessingWsEmpty = userInputWs.empty() && userPreProcessingWs.empty(); + const bool userOutputWsEmpty = userOutputWs.empty(); + wrapperConfigureSanityChecks( + wrapperStructPose, wrapperStructFace, wrapperStructHand, wrapperStructExtra, wrapperStructInput, + wrapperStructOutput, wrapperStructGui, renderOutput, userInputAndPreprocessingWsEmpty, + userOutputWsEmpty, producerSharedPtr, threadManagerMode); + opLog("userInputAndPreprocessingWsEmpty = " + std::to_string(int(userInputAndPreprocessingWsEmpty)), + Priority::Normal); + opLog("userOutputWsEmpty = " + std::to_string(int(userOutputWsEmpty)), Priority::Normal); + + // Get number threads + auto numberGpuThreads = wrapperStructPose.gpuNumber; + auto gpuNumberStart = wrapperStructPose.gpuNumberStart; + opLog("numberGpuThreads = " + std::to_string(numberGpuThreads), Priority::Normal); + opLog("gpuNumberStart = " + std::to_string(gpuNumberStart), Priority::Normal); + // CPU --> 1 thread or no pose extraction + if (gpuMode == GpuMode::NoGpu) + { + numberGpuThreads = (wrapperStructPose.gpuNumber == 0 ? 0 : 1); + gpuNumberStart = 0; + // Disabling multi-thread makes the code 400 ms faster (2.3 sec vs. 2.7 in i7-6850K) + // and fixes the bug that the screen was not properly displayed and only refreshed sometimes + // Note: The screen bug could be also fixed by using waitKey(30) rather than waitKey(1) + multiThreadEnabled = false; + } + // GPU --> user picks (<= #GPUs) + else + { + // Get total number GPUs + const auto totalGpuNumber = getGpuNumber(); + // If number GPU < 0 --> set it to all the available GPUs + if (numberGpuThreads < 0) + { + if (totalGpuNumber <= gpuNumberStart) + error("Number of initial GPU (`--number_gpu_start`) must be lower than the total number of" + " used GPUs (`--number_gpu`)", __LINE__, __FUNCTION__, __FILE__); + numberGpuThreads = totalGpuNumber - gpuNumberStart; + // Reset initial GPU to 0 (we want them all) + // Logging message + opLog("Auto-detecting all available GPUs... Detected " + std::to_string(totalGpuNumber) + + " GPU(s), using " + std::to_string(numberGpuThreads) + " of them starting at GPU " + + std::to_string(gpuNumberStart) + ".", Priority::High); + } + // Sanity check + if (gpuNumberStart + numberGpuThreads > totalGpuNumber) + error("Initial GPU selected (`--number_gpu_start`) + number GPUs to use (`--number_gpu`) must" + " be lower or equal than the total number of GPUs in your machine (" + + std::to_string(gpuNumberStart) + " + " + + std::to_string(numberGpuThreads) + " vs. " + + std::to_string(totalGpuNumber) + ").", + __LINE__, __FUNCTION__, __FILE__); + } + + // Proper format + const auto writeImagesCleaned = formatAsDirectory(wrapperStructOutput.writeImages.getStdString()); + const auto writeKeypointCleaned = formatAsDirectory(wrapperStructOutput.writeKeypoint.getStdString()); + const auto writeJsonCleaned = formatAsDirectory(wrapperStructOutput.writeJson.getStdString()); + const auto writeHeatMapsCleaned = formatAsDirectory(wrapperStructOutput.writeHeatMaps.getStdString()); + const auto modelFolder = formatAsDirectory(wrapperStructPose.modelFolder.getStdString()); + opLog("writeImagesCleaned = " + writeImagesCleaned, Priority::Normal); + opLog("writeKeypointCleaned = " + writeKeypointCleaned, Priority::Normal); + opLog("writeJsonCleaned = " + writeJsonCleaned, Priority::Normal); + opLog("writeHeatMapsCleaned = " + writeHeatMapsCleaned, Priority::Normal); + opLog("modelFolder = " + modelFolder, Priority::Normal); + + // Common parameters + auto finalOutputSize = wrapperStructPose.outputSize; + Point producerSize{-1,-1}; + const auto oPProducer = (producerSharedPtr != nullptr); + if (oPProducer) + { + // 1. Set producer properties + const auto displayProducerFpsMode = (wrapperStructInput.realTimeProcessing + ? ProducerFpsMode::OriginalFps : ProducerFpsMode::RetrievalFps); + producerSharedPtr->setProducerFpsMode(displayProducerFpsMode); + producerSharedPtr->set(ProducerProperty::Flip, wrapperStructInput.frameFlip); + producerSharedPtr->set(ProducerProperty::Rotation, wrapperStructInput.frameRotate); + producerSharedPtr->set(ProducerProperty::AutoRepeat, wrapperStructInput.framesRepeat); + // 2. Set finalOutputSize + producerSize = Point{(int)producerSharedPtr->get(getCvCapPropFrameWidth()), + (int)producerSharedPtr->get(getCvCapPropFrameHeight())}; + // Set finalOutputSize to input size if desired + if (finalOutputSize.x == -1 || finalOutputSize.y == -1) + finalOutputSize = producerSize; + } + opLog("finalOutputSize = [" + std::to_string(finalOutputSize.x) + "," + std::to_string(finalOutputSize.y) + + "]", Priority::Normal); + + // Producer + TWorker datumProducerW; + if (oPProducer) + { + const auto datumProducer = std::make_shared>( + producerSharedPtr, wrapperStructInput.frameFirst, wrapperStructInput.frameStep, + wrapperStructInput.frameLast, spVideoSeek + ); + datumProducerW = std::make_shared>(datumProducer); + } + else + datumProducerW = nullptr; + + std::vector> poseExtractorNets; + std::vector> faceExtractorNets; + std::vector> handExtractorNets; + std::vector> poseGpuRenderers; + // CUDA vs. CPU resize + std::vector> cvMatToOpOutputs; + std::vector> opOutputToCvMats; + std::shared_ptr poseCpuRenderer; + // Workers + TWorker scaleAndSizeExtractorW; + TWorker cvMatToOpInputW; + TWorker cvMatToOpOutputW; + bool addCvMatToOpOutput = renderOutput; + bool addCvMatToOpOutputInCpu = addCvMatToOpOutput; + std::vector> poseExtractorsWs; + std::vector> poseTriangulationsWs; + std::vector> jointAngleEstimationsWs; + std::vector postProcessingWs; + if (numberGpuThreads > 0) + { + // Get input scales and sizes + const auto scaleAndSizeExtractor = std::make_shared( + wrapperStructPose.netInputSize, (float)wrapperStructPose.netInputSizeDynamicBehavior, finalOutputSize, + wrapperStructPose.scalesNumber, wrapperStructPose.scaleGap); + scaleAndSizeExtractorW = std::make_shared>(scaleAndSizeExtractor); + + // Input cvMat to OpenPose input & output format + // Note: resize on GPU reduces accuracy about 0.1% + bool resizeOnCpu = true; + // const auto resizeOnCpu = (wrapperStructPose.poseMode != PoseMode::Enabled); + if (resizeOnCpu) + { + const auto gpuResize = false; + const auto cvMatToOpInput = std::make_shared( + wrapperStructPose.poseModel, gpuResize); + cvMatToOpInputW = std::make_shared>(cvMatToOpInput); + } + // Note: We realized that somehow doing it on GPU for any number of GPUs does speedup the whole OP + resizeOnCpu = false; + addCvMatToOpOutputInCpu = addCvMatToOpOutput + && (resizeOnCpu || !renderOutputGpu || wrapperStructPose.poseMode != PoseMode::Enabled + // Resize in GPU causing bug + || wrapperStructPose.outputSize.x != -1 || wrapperStructPose.outputSize.y != -1); + if (addCvMatToOpOutputInCpu) + { + const auto gpuResize = false; + const auto cvMatToOpOutput = std::make_shared(gpuResize); + cvMatToOpOutputW = std::make_shared>(cvMatToOpOutput); + } + + // Pose estimators & renderers + std::vector cpuRenderers; + poseExtractorsWs.clear(); + poseExtractorsWs.resize(numberGpuThreads); + if (wrapperStructPose.poseMode != PoseMode::Disabled) + { + // Pose estimators + for (auto gpuId = 0; gpuId < numberGpuThreads; gpuId++) + poseExtractorNets.emplace_back(std::make_shared( + wrapperStructPose.poseModel, modelFolder, gpuId + gpuNumberStart, + wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScaleMode, + wrapperStructPose.addPartCandidates, wrapperStructPose.maximizePositives, + wrapperStructPose.protoTxtPath.getStdString(), + wrapperStructPose.caffeModelPath.getStdString(), + wrapperStructPose.upsamplingRatio, wrapperStructPose.poseMode == PoseMode::Enabled, + wrapperStructPose.enableGoogleLogging + )); + + // Pose renderers + if (renderOutputGpu || renderModePose == RenderMode::Cpu) + { + // If renderModePose != RenderMode::Gpu but renderOutput, then we create an + // alpha = 0 pose renderer in order to keep the removing background option + const auto alphaKeypoint = (renderModePose != RenderMode::None + ? wrapperStructPose.alphaKeypoint : 0.f); + const auto alphaHeatMap = (renderModePose != RenderMode::None + ? wrapperStructPose.alphaHeatMap : 0.f); + // GPU rendering + if (renderOutputGpu) + { + for (const auto& poseExtractorNet : poseExtractorNets) + { + poseGpuRenderers.emplace_back(std::make_shared( + wrapperStructPose.poseModel, poseExtractorNet, wrapperStructPose.renderThreshold, + wrapperStructPose.blendOriginalFrame, alphaKeypoint, + alphaHeatMap, wrapperStructPose.defaultPartToRender + )); + } + } + // CPU rendering + if (renderModePose == RenderMode::Cpu) + { + poseCpuRenderer = std::make_shared( + wrapperStructPose.poseModel, wrapperStructPose.renderThreshold, + wrapperStructPose.blendOriginalFrame, alphaKeypoint, alphaHeatMap, + wrapperStructPose.defaultPartToRender); + cpuRenderers.emplace_back(std::make_shared>(poseCpuRenderer)); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Pose extractor(s) + poseExtractorsWs.resize(poseExtractorNets.size()); + const auto personIdExtractor = (wrapperStructExtra.identification + ? std::make_shared() : nullptr); + // Keep top N people + // Added right after PoseExtractorNet to avoid: + // 1) Rendering people that are later deleted (wrong visualization). + // 2) Processing faces and hands on people that will be deleted (speed up). + // 3) Running tracking before deleting the people. + // Add KeepTopNPeople for each PoseExtractorNet + const auto keepTopNPeople = (wrapperStructPose.numberPeopleMax > 0 ? + std::make_shared(wrapperStructPose.numberPeopleMax) + : nullptr); + // Person tracker + auto personTrackers = std::make_shared>>(); + if (wrapperStructExtra.tracking > -1) + personTrackers->emplace_back( + std::make_shared(wrapperStructExtra.tracking == 0)); + for (auto i = 0u; i < poseExtractorsWs.size(); i++) + { + // OpenPose keypoint detector + keepTopNPeople + // + ID extractor (experimental) + tracking (experimental) + const auto poseExtractor = std::make_shared( + poseExtractorNets.at(i), keepTopNPeople, personIdExtractor, personTrackers, + wrapperStructPose.numberPeopleMax, wrapperStructExtra.tracking); + // If we want the initial image resize on GPU + if (cvMatToOpInputW == nullptr) + { + const auto gpuResize = true; + const auto cvMatToOpInput = std::make_shared( + wrapperStructPose.poseModel, gpuResize); + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(cvMatToOpInput)); + } + // If we want the final image resize on GPU + if (addCvMatToOpOutput && cvMatToOpOutputW == nullptr) + { + const auto gpuResize = true; + cvMatToOpOutputs.emplace_back(std::make_shared(gpuResize)); + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(cvMatToOpOutputs.back())); + } + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(poseExtractor)); + // poseExtractorsWs.at(i) = {std::make_shared>(poseExtractor)}; + // // Just OpenPose keypoint detector + // poseExtractorsWs.at(i) = {std::make_shared>( + // poseExtractorNets.at(i))}; + } + + // // (Before tracking / id extractor) + // // Added right after PoseExtractorNet to avoid: + // // 1) Rendering people that are later deleted (wrong visualization). + // // 2) Processing faces and hands on people that will be deleted (speed up). + // if (wrapperStructPose.numberPeopleMax > 0) + // { + // // Add KeepTopNPeople for each PoseExtractorNet + // const auto keepTopNPeople = std::make_shared( + // wrapperStructPose.numberPeopleMax); + // for (auto& wPose : poseExtractorsWs) + // wPose.emplace_back(std::make_shared>(keepTopNPeople)); + // } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Pose renderer(s) + if (!poseGpuRenderers.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + for (auto i = 0u; i < poseExtractorsWs.size(); i++) + { + poseExtractorsWs.at(i).emplace_back(std::make_shared>( + poseGpuRenderers.at(i))); + // Get shared params + if (!cvMatToOpOutputs.empty()) + poseGpuRenderers.at(i)->setSharedParameters( + cvMatToOpOutputs.at(i)->getSharedParameters()); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Face extractor(s) + if (wrapperStructFace.enable) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Face detector + // OpenPose body-based face detector + if (wrapperStructFace.detector == Detector::Body) + { + // Sanity check + if (wrapperStructPose.poseMode == PoseMode::Disabled) + error("Body keypoint detection is disabled but face Detector is set to Body. Either" + " re-enable OpenPose body or select a different face Detector (`--face_detector`).", + __LINE__, __FUNCTION__, __FILE__); + // Constructors + const auto faceDetector = std::make_shared(wrapperStructPose.poseModel); + for (auto& wPose : poseExtractorsWs) + wPose.emplace_back(std::make_shared>(faceDetector)); + } + // OpenCV face detector + else if (wrapperStructFace.detector == Detector::OpenCV) + { + opLog("Body keypoint detection is disabled. Hence, using OpenCV face detector (much less" + " accurate but faster).", Priority::High); + for (auto& wPose : poseExtractorsWs) + { + // 1 FaceDetectorOpenCV per thread, OpenCV face detector is not thread-safe + const auto faceDetectorOpenCV = std::make_shared(modelFolder); + wPose.emplace_back( + std::make_shared>(faceDetectorOpenCV) + ); + } + } + // If provided by user: We do not need to create a FaceDetector + // Unknown face Detector + else if (wrapperStructFace.detector != Detector::Provided) + error("Unknown face Detector. Select a valid face Detector (`--face_detector`).", + __LINE__, __FUNCTION__, __FILE__); + // Face keypoint extractor + for (auto gpu = 0u; gpu < poseExtractorsWs.size(); gpu++) + { + // Face keypoint extractor + const auto netOutputSize = wrapperStructFace.netInputSize; + const auto faceExtractorNet = std::make_shared( + wrapperStructFace.netInputSize, netOutputSize, modelFolder, + gpu + gpuNumberStart, wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScaleMode, + wrapperStructPose.enableGoogleLogging + ); + faceExtractorNets.emplace_back(faceExtractorNet); + poseExtractorsWs.at(gpu).emplace_back( + std::make_shared>(faceExtractorNet)); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Hand extractor(s) + if (wrapperStructHand.enable) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto handDetector = std::make_shared(wrapperStructPose.poseModel); + for (auto gpu = 0u; gpu < poseExtractorsWs.size(); gpu++) + { + // Sanity check + if ((wrapperStructHand.detector == Detector::BodyWithTracking + || wrapperStructHand.detector == Detector::Body) + && wrapperStructPose.poseMode == PoseMode::Disabled) + error("Body keypoint detection is disabled but hand Detector is set to Body. Either" + " re-enable OpenPose body or select a different hand Detector (`--hand_detector`).", + __LINE__, __FUNCTION__, __FILE__); + // Hand detector + // OpenPose body-based hand detector with tracking + if (wrapperStructHand.detector == Detector::BodyWithTracking) + { + poseExtractorsWs.at(gpu).emplace_back( + std::make_shared>(handDetector)); + } + // OpenPose body-based hand detector + else if (wrapperStructHand.detector == Detector::Body) + { + poseExtractorsWs.at(gpu).emplace_back( + std::make_shared>(handDetector)); + } + // If provided by user: We do not need to create a FaceDetector + // Unknown hand Detector + else if (wrapperStructHand.detector != Detector::Provided) + error("Unknown hand Detector. Select a valid hand Detector (`--hand_detector`).", + __LINE__, __FUNCTION__, __FILE__); + // Hand keypoint extractor + const auto netOutputSize = wrapperStructHand.netInputSize; + const auto handExtractorNet = std::make_shared( + wrapperStructHand.netInputSize, netOutputSize, modelFolder, + gpu + gpuNumberStart, wrapperStructHand.scalesNumber, wrapperStructHand.scaleRange, + wrapperStructPose.heatMapTypes, wrapperStructPose.heatMapScaleMode, + wrapperStructPose.enableGoogleLogging + ); + handExtractorNets.emplace_back(handExtractorNet); + poseExtractorsWs.at(gpu).emplace_back( + std::make_shared>(handExtractorNet) + ); + // If OpenPose body-based hand detector with tracking + if (wrapperStructHand.detector == Detector::BodyWithTracking) + poseExtractorsWs.at(gpu).emplace_back( + std::make_shared>(handDetector)); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Face renderer(s) + if (renderFace) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // CPU rendering + if (renderModeFace == RenderMode::Cpu) + { + // Construct face renderer + const auto faceRenderer = std::make_shared( + wrapperStructFace.renderThreshold, wrapperStructFace.alphaKeypoint, + wrapperStructFace.alphaHeatMap); + // Add worker + cpuRenderers.emplace_back(std::make_shared>(faceRenderer)); + } + // GPU rendering + else if (renderModeFace == RenderMode::Gpu) + { + for (auto i = 0u; i < poseExtractorsWs.size(); i++) + { + // Construct face renderer + const auto faceRenderer = std::make_shared( + wrapperStructFace.renderThreshold, wrapperStructFace.alphaKeypoint, + wrapperStructFace.alphaHeatMap + ); + // Performance boost -> share spGpuMemory for all renderers + if (!poseGpuRenderers.empty()) + { + // const bool isLastRenderer = !renderHandGpu; + const bool isLastRenderer = !renderHandGpu && !(addCvMatToOpOutput && !addCvMatToOpOutputInCpu); + const auto renderer = std::static_pointer_cast( + poseGpuRenderers.at(i)); + faceRenderer->setSharedParametersAndIfLast( + renderer->getSharedParameters(), isLastRenderer); + } + // Add worker + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(faceRenderer)); + } + } + else + error("Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Hand renderer(s) + if (renderHand) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // CPU rendering + if (renderModeHand == RenderMode::Cpu) + { + // Construct hand renderer + const auto handRenderer = std::make_shared( + wrapperStructHand.renderThreshold, wrapperStructHand.alphaKeypoint, + wrapperStructHand.alphaHeatMap); + // Add worker + cpuRenderers.emplace_back(std::make_shared>(handRenderer)); + } + // GPU rendering + else if (renderModeHand == RenderMode::Gpu) + { + for (auto i = 0u; i < poseExtractorsWs.size(); i++) + { + // Construct hands renderer + const auto handRenderer = std::make_shared( + wrapperStructHand.renderThreshold, wrapperStructHand.alphaKeypoint, + wrapperStructHand.alphaHeatMap + ); + // Performance boost -> share spGpuMemory for all renderers + if (!poseGpuRenderers.empty()) + { + // const bool isLastRenderer = true; + const bool isLastRenderer = !(addCvMatToOpOutput && !addCvMatToOpOutputInCpu); + const auto renderer = std::static_pointer_cast( + poseGpuRenderers.at(i)); + handRenderer->setSharedParametersAndIfLast( + renderer->getSharedParameters(), isLastRenderer); + } + // Add worker + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(handRenderer)); + } + } + else + error("Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // Frames processor (OpenPose format -> cv::Mat format) + if (addCvMatToOpOutput && !addCvMatToOpOutputInCpu) + { + // for (auto& poseExtractorsW : poseExtractorsWs) + for (auto i = 0u ; i < poseExtractorsWs.size() ; ++i) + { + const auto gpuResize = true; + opOutputToCvMats.emplace_back(std::make_shared(gpuResize)); + poseExtractorsWs.at(i).emplace_back( + std::make_shared>(opOutputToCvMats.back())); + // Assign shared parameters + opOutputToCvMats.back()->setSharedParameters( + cvMatToOpOutputs.at(i)->getSharedParameters()); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // 3-D reconstruction + poseTriangulationsWs.clear(); + if (wrapperStructExtra.reconstruct3d) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // For all (body/face/hands): PoseTriangulations ~30 msec, 8 GPUS ~30 msec for keypoint estimation + poseTriangulationsWs.resize(fastMax(1, int(poseExtractorsWs.size() / 4))); + for (auto i = 0u ; i < poseTriangulationsWs.size() ; i++) + { + const auto poseTriangulation = std::make_shared( + wrapperStructExtra.minViews3d); + poseTriangulationsWs.at(i) = {std::make_shared>( + poseTriangulation)}; + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Itermediate workers (e.g., OpenPose format to cv::Mat, json & frames recorder, ...) + postProcessingWs.clear(); + // // Person ID identification (when no multi-thread and no dependency on tracking) + // if (wrapperStructExtra.identification) + // { + // const auto personIdExtractor = std::make_shared(); + // postProcessingWs.emplace_back( + // std::make_shared>(personIdExtractor) + // ); + // } + // Frames processor (OpenPose format -> cv::Mat format) + if (addCvMatToOpOutputInCpu) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + postProcessingWs = mergeVectors(postProcessingWs, cpuRenderers); + const auto opOutputToCvMat = std::make_shared(); + postProcessingWs.emplace_back(std::make_shared>(opOutputToCvMat)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Re-scale pose if desired + // If desired scale is not the current input + if (wrapperStructPose.keypointScaleMode != ScaleMode::InputResolution + // and desired scale is not output when size(input) = size(output) + && !(wrapperStructPose.keypointScaleMode == ScaleMode::OutputResolution && + (finalOutputSize == producerSize || finalOutputSize.x <= 0 || finalOutputSize.y <= 0)) + // and desired scale is not net output when size(input) = size(net output) + && !(wrapperStructPose.keypointScaleMode == ScaleMode::NetOutputResolution + && producerSize == wrapperStructPose.netInputSize)) + { + // Then we must rescale the keypoints + auto keypointScaler = std::make_shared(wrapperStructPose.keypointScaleMode); + postProcessingWs.emplace_back(std::make_shared>(keypointScaler)); + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + // IK/Adam + const auto displayAdam = wrapperStructGui.displayMode == DisplayMode::DisplayAdam + || (wrapperStructGui.displayMode == DisplayMode::DisplayAll + && wrapperStructExtra.ikThreads > 0); + jointAngleEstimationsWs.clear(); +#ifdef USE_3D_ADAM_MODEL + if (wrapperStructExtra.ikThreads > 0) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + jointAngleEstimationsWs.resize(wrapperStructExtra.ikThreads); + // Pose extractor(s) + for (auto i = 0u; i < jointAngleEstimationsWs.size(); i++) + { + const auto jointAngleEstimation = std::make_shared(displayAdam); + jointAngleEstimationsWs.at(i) = {std::make_shared>( + jointAngleEstimation)}; + } + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); +#endif + + // Output workers + std::vector outputWs; + // Print verbose + if (wrapperStructOutput.verbose > 0.) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto verbosePrinter = std::make_shared( + wrapperStructOutput.verbose, uLongLongRound(producerSharedPtr->get(getCvCapPropFrameCount()))); + outputWs.emplace_back(std::make_shared>(verbosePrinter)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Send information (e.g., to Unity) though UDP client-server communication + +#ifdef USE_3D_ADAM_MODEL + if (!wrapperStructOutput.udpHost.empty() && !wrapperStructOutput.udpPort.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto udpSender = std::make_shared(wrapperStructOutput.udpHost, + wrapperStructOutput.udpPort); + outputWs.emplace_back(std::make_shared>(udpSender)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); +#endif + // Write people pose data on disk (json for OpenCV >= 3, xml, yml...) + if (!writeKeypointCleaned.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto keypointSaver = std::make_shared(writeKeypointCleaned, + wrapperStructOutput.writeKeypointFormat); + outputWs.emplace_back(std::make_shared>(keypointSaver)); + if (wrapperStructFace.enable) + outputWs.emplace_back(std::make_shared>(keypointSaver)); + if (wrapperStructHand.enable) + outputWs.emplace_back(std::make_shared>(keypointSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Write OpenPose output data on disk in JSON format (body/hand/face keypoints, body part locations if + // enabled, etc.) + if (!writeJsonCleaned.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto peopleJsonSaver = std::make_shared(writeJsonCleaned); + outputWs.emplace_back(std::make_shared>(peopleJsonSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Write people pose/foot/face/hand/etc. data on disk (COCO validation JSON format) + if (!wrapperStructOutput.writeCocoJson.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // If humanFormat: bigger size (& maybe slower to process), but easier for user to read it + const auto humanFormat = true; + const auto cocoJsonSaver = std::make_shared( + wrapperStructOutput.writeCocoJson.getStdString(), wrapperStructPose.poseModel, humanFormat, + wrapperStructOutput.writeCocoJsonVariants, + (wrapperStructPose.poseModel != PoseModel::CAR_22 + && wrapperStructPose.poseModel != PoseModel::CAR_12 + ? CocoJsonFormat::Body : CocoJsonFormat::Car), + wrapperStructOutput.writeCocoJsonVariant); + outputWs.emplace_back(std::make_shared>(cocoJsonSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Write frames as desired image format on hard disk + if (!writeImagesCleaned.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto imageSaver = std::make_shared( + writeImagesCleaned, wrapperStructOutput.writeImagesFormat.getStdString()); + outputWs.emplace_back(std::make_shared>(imageSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + auto originalVideoFps = 0.; + if (!wrapperStructOutput.writeVideo.empty() || !wrapperStructOutput.writeVideo3D.empty() + || !wrapperStructOutput.writeBvh.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + if (wrapperStructOutput.writeVideoFps <= 0 + && (!oPProducer || producerSharedPtr->get(getCvCapPropFrameFps()) <= 0)) + error("The frame rate of the frames producer is unknown. Set `--write_video_fps` to your desired" + " FPS if you wanna record video (`--write_video`). E.g., if it is a folder of images, you" + " will have to know or guess the frame rate; if it is a webcam, you should use the OpenPose" + " displayed FPS as desired value. If you do not care, simply add `--write_video_fps 30`.", + __LINE__, __FUNCTION__, __FILE__); + originalVideoFps = ( + wrapperStructOutput.writeVideoFps > 0 ? + wrapperStructOutput.writeVideoFps : producerSharedPtr->get(getCvCapPropFrameFps())); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Write frames as *.avi video on hard disk + if (!wrapperStructOutput.writeVideo.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Sanity checks + if (!oPProducer) + error("Video file can only be recorded inside `wrapper/wrapper.hpp` if the producer" + " is one of the default ones (e.g., video, webcam, ...).", + __LINE__, __FUNCTION__, __FILE__); + if (wrapperStructOutput.writeVideoWithAudio && producerSharedPtr->getType() != ProducerType::Video) + error("Audio can only be added to the output saved video if the input is also a video (either" + " disable `--write_video_with_audio` or use a video as input with `--video`).", + __LINE__, __FUNCTION__, __FILE__); + // Create video saver worker + const auto videoSaver = std::make_shared( + wrapperStructOutput.writeVideo.getStdString(), getCvFourcc('M','J','P','G'), originalVideoFps, + (wrapperStructOutput.writeVideoWithAudio ? wrapperStructInput.producerString.getStdString() : "")); + outputWs.emplace_back(std::make_shared>(videoSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Write joint angles as *.bvh file on hard disk +#ifdef USE_3D_ADAM_MODEL + if (!wrapperStructOutput.writeBvh.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto bvhSaver = std::make_shared( + wrapperStructOutput.writeBvh, JointAngleEstimation::getTotalModel(), originalVideoFps + ); + outputWs.emplace_back(std::make_shared>(bvhSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); +#endif + // Write heat maps as desired image format on hard disk + if (!writeHeatMapsCleaned.empty()) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto heatMapSaver = std::make_shared( + writeHeatMapsCleaned, wrapperStructOutput.writeHeatMapsFormat.getStdString()); + outputWs.emplace_back(std::make_shared>(heatMapSaver)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Add frame information for GUI + const bool guiEnabled = (wrapperStructGui.displayMode != DisplayMode::NoDisplay); + // If this WGuiInfoAdder instance is placed before the WImageSaver or WVideoSaver, then the resulting + // recorded frames will look exactly as the final displayed image by the GUI + if (wrapperStructGui.guiVerbose && (guiEnabled || !userOutputWs.empty() + || threadManagerMode == ThreadManagerMode::Asynchronous + || threadManagerMode == ThreadManagerMode::AsynchronousOut)) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + const auto guiInfoAdder = std::make_shared(numberGpuThreads, guiEnabled); + outputWs.emplace_back(std::make_shared>(guiInfoAdder)); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Minimal graphical user interface (GUI) + TWorker guiW; + TWorker videoSaver3DW; + if (guiEnabled) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // PoseRenderers to Renderers + std::vector> renderers; + if (renderModePose == RenderMode::Cpu) + renderers.emplace_back(std::static_pointer_cast(poseCpuRenderer)); + else + for (const auto& poseGpuRenderer : poseGpuRenderers) + renderers.emplace_back(std::static_pointer_cast(poseGpuRenderer)); + // Display + const auto numberViews = (producerSharedPtr != nullptr + ? positiveIntRound(producerSharedPtr->get(ProducerProperty::NumberViews)) : 1); + auto finalOutputSizeGui = finalOutputSize; + if (numberViews > 1 && finalOutputSizeGui.x > 0) + finalOutputSizeGui.x *= numberViews; + // Adam (+3-D/2-D) display + if (displayAdam) + { +#ifdef USE_3D_ADAM_MODEL + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Gui + const auto gui = std::make_shared( + finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), + spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers, + wrapperStructGui.displayMode, JointAngleEstimation::getTotalModel(), + wrapperStructOutput.writeVideoAdam + ); + // WGui + guiW = {std::make_shared>(gui)}; + // Write 3D frames as *.avi video on hard disk + if (!wrapperStructOutput.writeVideo3D.empty()) + error("3D video can only be recorded if 3D render is enabled.", + __LINE__, __FUNCTION__, __FILE__); +#endif + } + // 3-D (+2-D) display + else if (wrapperStructGui.displayMode == DisplayMode::Display3D + || wrapperStructGui.displayMode == DisplayMode::DisplayAll) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Gui + const auto gui = std::make_shared( + finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), + spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers, + wrapperStructPose.poseModel, wrapperStructGui.displayMode, + !wrapperStructOutput.writeVideo3D.empty() + ); + // WGui + guiW = {std::make_shared>(gui)}; + // Write 3D frames as *.avi video on hard disk + if (!wrapperStructOutput.writeVideo3D.empty()) + { + const auto videoSaver = std::make_shared( + wrapperStructOutput.writeVideo3D.getStdString(), getCvFourcc('M','J','P','G'), originalVideoFps, ""); + videoSaver3DW = std::make_shared>(videoSaver); + } + } + // 2-D display + else if (wrapperStructGui.displayMode == DisplayMode::Display2D) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Gui + const auto gui = std::make_shared( + finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), + spVideoSeek, poseExtractorNets, faceExtractorNets, handExtractorNets, renderers + ); + // WGui + guiW = {std::make_shared>(gui)}; + // Write 3D frames as *.avi video on hard disk + if (!wrapperStructOutput.writeVideo3D.empty()) + error("3D video can only be recorded if 3D render is enabled.", + __LINE__, __FUNCTION__, __FILE__); + } + else + error("Unknown DisplayMode.", __LINE__, __FUNCTION__, __FILE__); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Set FpsMax + TWorker wFpsMax; + if (wrapperStructPose.fpsMax > 0.) + wFpsMax = std::make_shared>(wrapperStructPose.fpsMax); + // Set wrapper as configured + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + + + + + + // The less number of queues -> the less threads opened, and potentially the less lag + + // Sanity checks + if ((datumProducerW == nullptr) == (userInputWs.empty()) + && threadManagerMode != ThreadManagerMode::Asynchronous + && threadManagerMode != ThreadManagerMode::AsynchronousIn) + { + const auto message = "You need to have 1 and only 1 producer selected. You can introduce your own" + " producer by using setWorker(WorkerType::Input, ...) or use the OpenPose" + " default producer by configuring it in the configure function) or use the" + " ThreadManagerMode::Asynchronous(In) mode."; + error(message, __LINE__, __FUNCTION__, __FILE__); + } + if (outputWs.empty() && userOutputWs.empty() && guiW == nullptr + && threadManagerMode != ThreadManagerMode::Asynchronous + && threadManagerMode != ThreadManagerMode::AsynchronousOut) + { + error("No output selected.", __LINE__, __FUNCTION__, __FILE__); + } + + // Thread Manager + // Clean previous thread manager (avoid configure to crash the program if used more than once) + threadManager.reset(); + unsigned long long threadId = 0ull; + auto queueIn = 0ull; + auto queueOut = 1ull; + // After producer + // ID generator (before any multi-threading or any function that requires the ID) + const auto wIdGenerator = std::make_shared>(); + // If custom user Worker and uses its own thread + std::vector workersAux; + if (!userPreProcessingWs.empty()) + { + // If custom user Worker in its own thread + if (userPreProcessingWsOnNewThread) + opLog("You chose to add your pre-processing function in a new thread. However, OpenPose will" + " add it in the same thread than the input frame producer.", + Priority::High, __LINE__, __FUNCTION__, __FILE__); + workersAux = mergeVectors(workersAux, {userPreProcessingWs}); + } + workersAux = mergeVectors(workersAux, {wIdGenerator}); + // Scale & cv::Mat to OP format + if (scaleAndSizeExtractorW != nullptr) + workersAux = mergeVectors(workersAux, {scaleAndSizeExtractorW}); + if (cvMatToOpInputW != nullptr) + workersAux = mergeVectors(workersAux, {cvMatToOpInputW}); + // cv::Mat to output format + if (cvMatToOpOutputW != nullptr) + workersAux = mergeVectors(workersAux, {cvMatToOpOutputW}); + + // Producer + // If custom user Worker and uses its own thread + if (!userInputWs.empty() && userInputWsOnNewThread) + { + // Thread 0, queues 0 -> 1 + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, userInputWs, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + // If custom user Worker in same thread + else if (!userInputWs.empty()) + workersAux = mergeVectors(userInputWs, workersAux); + // If OpenPose producer (same thread) + else if (datumProducerW != nullptr) + workersAux = mergeVectors({datumProducerW}, workersAux); + // Otherwise + else if (threadManagerMode != ThreadManagerMode::Asynchronous + && threadManagerMode != ThreadManagerMode::AsynchronousIn) + error("No input selected.", __LINE__, __FUNCTION__, __FILE__); + // Thread 0 or 1, queues 0 -> 1 + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, workersAux, queueIn++, queueOut++); + // Increase thread + threadIdPP(threadId, multiThreadEnabled); + + // Pose estimation & rendering + // Thread 1 or 2...X, queues 1 -> 2, X = 2 + #GPUs + if (!poseExtractorsWs.empty()) + { + if (multiThreadEnabled) + { + for (auto& wPose : poseExtractorsWs) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wPose, queueIn, queueOut); + threadIdPP(threadId, multiThreadEnabled); + } + queueIn++; + queueOut++; + // Sort frames - Required own thread + if (poseExtractorsWs.size() > 1u) + { + const auto wQueueOrderer = std::make_shared>(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + } + else + { + if (poseExtractorsWs.size() > 1) + opLog("Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the" + " first one, which is defined by gpuNumberStart (e.g., in the OpenPose demo, it is set" + " with the `--num_gpu_start` flag).", Priority::High); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, poseExtractorsWs.at(0), queueIn++, queueOut++); + } + } + // Assemble all frames from same time instant (3-D module) + const auto wQueueAssembler = std::make_shared>(); + // 3-D reconstruction + if (!poseTriangulationsWs.empty()) + { + // Assemble frames + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wQueueAssembler, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + // 3-D reconstruction + if (multiThreadEnabled) + { + for (auto& wPoseTriangulations : poseTriangulationsWs) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wPoseTriangulations, queueIn, queueOut); + threadIdPP(threadId, multiThreadEnabled); + } + queueIn++; + queueOut++; + // Sort frames + if (poseTriangulationsWs.size() > 1u) + { + const auto wQueueOrderer = std::make_shared>(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + } + else + { + if (poseTriangulationsWs.size() > 1) + opLog("Multi-threading disabled, only 1 thread running for 3-D triangulation.", + Priority::High); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, poseTriangulationsWs.at(0), queueIn++, queueOut++); + } + } + else + postProcessingWs = mergeVectors({wQueueAssembler}, postProcessingWs); + // Adam/IK step + if (!jointAngleEstimationsWs.empty()) + { + if (multiThreadEnabled) + { + for (auto& wJointAngleEstimator : jointAngleEstimationsWs) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wJointAngleEstimator, queueIn, queueOut); + threadIdPP(threadId, multiThreadEnabled); + } + queueIn++; + queueOut++; + // Sort frames + if (jointAngleEstimationsWs.size() > 1) + { + const auto wQueueOrderer = std::make_shared>(); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + } + else + { + if (jointAngleEstimationsWs.size() > 1) + opLog("Multi-threading disabled, only 1 thread running for joint angle estimation.", + Priority::High); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, jointAngleEstimationsWs.at(0), queueIn++, queueOut++); + } + } + // Post processing workers + if (!postProcessingWs.empty()) + { + // Combining postProcessingWs and outputWs + outputWs = mergeVectors(postProcessingWs, outputWs); + // // If I wanna split them + // opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // threadManager.add(threadId, postProcessingWs, queueIn++, queueOut++); + // threadIdPP(threadId, multiThreadEnabled); + } + // If custom user Worker and uses its own thread + if (!userPostProcessingWs.empty()) + { + // If custom user Worker in its own thread + if (userPostProcessingWsOnNewThread) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, userPostProcessingWs, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + // If custom user Worker in same thread + // Merge with outputWs + else + outputWs = mergeVectors(outputWs, userPostProcessingWs); + } + // Output workers + if (!outputWs.empty()) + { + // Thread 4 or 5, queues 4 -> 5 + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, outputWs, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + // User output worker + // Thread Y, queues Q -> Q+1 + if (!userOutputWs.empty()) + { + if (userOutputWsOnNewThread) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, userOutputWs, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + else + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId-1, userOutputWs, queueIn++, queueOut++); + } + } + // OpenPose GUI + if (guiW != nullptr) + { + // Thread Y+1, queues Q+1 -> Q+2 + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, guiW, queueIn++, queueOut++); + // Saving 3D output + if (videoSaver3DW != nullptr) + threadManager.add(threadId, videoSaver3DW, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // Setting maximum speed + if (wFpsMax != nullptr) + { + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + threadManager.add(threadId, wFpsMax, queueIn++, queueOut++); + threadIdPP(threadId, multiThreadEnabled); + } + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } + + template + void createMultiviewTDatum( + TDatumsSP& tDatumsSP, unsigned long long& frameCounter, + const CameraParameterReader& cameraParameterReader, const void* const cvMatPtr) + { + try + { + // Sanity check + if (tDatumsSP == nullptr) + op::error("tDatumsSP was nullptr, it must be initialized.", __LINE__, __FUNCTION__, __FILE__); + // Camera parameters + const std::vector& cameraMatrices = cameraParameterReader.getCameraMatrices(); + const std::vector& cameraIntrinsics = cameraParameterReader.getCameraIntrinsics(); + const std::vector& cameraExtrinsics = cameraParameterReader.getCameraExtrinsics(); + const auto matrixesSize = cameraMatrices.size(); + // More sanity checks + if (cameraMatrices.size() < 2) + op::error("There is less than 2 camera parameter matrices.", + __LINE__, __FUNCTION__, __FILE__); + if (cameraMatrices.size() != cameraIntrinsics.size() || cameraMatrices.size() != cameraExtrinsics.size()) + op::error("Camera parameters must have the same size.", __LINE__, __FUNCTION__, __FILE__); + // Split image to process + std::vector imagesToProcess(matrixesSize); + op::Matrix::splitCvMatIntoVectorMatrix(imagesToProcess, cvMatPtr); + // Fill tDatumsSP + tDatumsSP->resize(cameraMatrices.size()); + for (auto datumIndex = 0 ; datumIndex < matrixesSize ; ++datumIndex) + { + auto& datumPtr = tDatumsSP->at(datumIndex); + datumPtr = std::make_shared(); + datumPtr->frameNumber = frameCounter; + datumPtr->cvInputData = imagesToProcess[datumIndex]; + if (matrixesSize > 1) + { + datumPtr->subId = datumIndex; + datumPtr->subIdMax = matrixesSize-1; + datumPtr->cameraMatrix = cameraMatrices[datumIndex]; + datumPtr->cameraExtrinsics = cameraExtrinsics[datumIndex]; + datumPtr->cameraIntrinsics = cameraIntrinsics[datumIndex]; + } + } + ++frameCounter; + } + catch (const std::exception& e) + { + error(e.what(), __LINE__, __FUNCTION__, __FILE__); + } + } +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_AUXILIARY_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructExtra.hpp b/usr/local/include/openpose/wrapper/wrapperStructExtra.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d103281d78b0b0437862930bb205b4ab0aa000ef --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructExtra.hpp @@ -0,0 +1,60 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP + +#include + +namespace op +{ + /** + * WrapperStructExtra: Pose estimation and rendering configuration struct. + * WrapperStructExtra allows the user to set up the pose estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + struct OP_API WrapperStructExtra + { + /** + * Whether to run the 3-D reconstruction demo, i.e., + * 1) Reading from a stereo camera system. + * 2) Performing 3-D reconstruction from the multiple views. + * 3) Displaying 3-D reconstruction results. + */ + bool reconstruct3d; + + /** + * Minimum number of views required to reconstruct each keypoint. + * By default (-1), it will require max(2, min(4, #cameras-1)) cameras to see the keypoint in order to + * reconstruct it. + */ + int minViews3d; + + /** + * Whether to return a person ID for each body skeleton, providing temporal consistency. + */ + bool identification; + + /** + * Whether to enable people tracking across frames. The value indicates the number of frames where tracking + * is run between each OpenPose keypoint detection. Select -1 (default) to disable it or 0 to run + * simultaneously OpenPose keypoint detector and tracking for potentially higher accuracy than only OpenPose. + */ + int tracking; + + /** + * Whether to enable inverse kinematics (IK) from 3-D keypoints to obtain 3-D joint angles. By default + * (0 threads), it is disabled. Increasing the number of threads will increase the speed but also the + * global system latency. + */ + int ikThreads; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructExtra( + const bool reconstruct3d = false, const int minViews3d = -1, const bool identification = false, + const int tracking = -1, const int ikThreads = 0); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_EXTRA_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructFace.hpp b/usr/local/include/openpose/wrapper/wrapperStructFace.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a14da9f5bc80193e864146c3cce1f46545733bbf --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructFace.hpp @@ -0,0 +1,77 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP + +#include +#include +#include +#include + +namespace op +{ + /** + * WrapperStructFace: Face estimation and rendering configuration struct. + * WrapperStructFace allows the user to set up the face estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + struct OP_API WrapperStructFace + { + /** + * Whether to extract face. + */ + bool enable; + + /** + * Kind of face rectangle detector. Recommended Detector::Body (fastest one if body is enabled and most + * accurate one), which is based on the OpenPose body keypoint detector. + */ + Detector detector; + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + Point netInputSize; + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select `None` for no rendering, `Cpu` or `Gpu` por CPU and GPU rendering respectively. + */ + RenderMode renderMode; + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + float alphaKeypoint; + + /** + * Rendering blending alpha value of the heat maps (face part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + float alphaHeatMap; + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + float renderThreshold; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructFace( + const bool enable = false, const Detector detector = Detector::Body, + const Point& netInputSize = Point{368, 368}, const RenderMode renderMode = RenderMode::Auto, + const float alphaKeypoint = FACE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = FACE_DEFAULT_ALPHA_HEAT_MAP, const float renderThreshold = 0.4f); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_FACE_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructGui.hpp b/usr/local/include/openpose/wrapper/wrapperStructGui.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c86e8e11a98cd749f0409761e54181868f0870a --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructGui.hpp @@ -0,0 +1,48 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP + +#include +#include + +namespace op +{ + /** + * WrapperStructGui: It controls a small GUI for quick visualization. + */ + struct OP_API WrapperStructGui + { + /** + * Display mode + * a) -1 for automatic selection. + * b) 0 for no display. Useful if there is no X server and/or to slightly speed up the processing if visual + * output is not required. + * c) 2 for 2-D display in the OpenPose small integrated GUI. + * d) 3 for 3-D display, if `--3d` was enabled. + * e) 1 for both 2-D and 3-D display. + */ + DisplayMode displayMode; + + /** + * Whether to add some information to the frame (number of frame, number people detected, etc.) after it is + * saved on disk and before it is displayed and/or returned to the user. + */ + bool guiVerbose; + + /** + * Whether to display the OpenPose small integrated GUI on fullscreen mode. It can be changed by interacting + * with the GUI itself. + */ + bool fullScreen; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructGui( + const DisplayMode displayMode = DisplayMode::NoDisplay, const bool guiVerbose = false, + const bool fullScreen = false); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_GUI_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructHand.hpp b/usr/local/include/openpose/wrapper/wrapperStructHand.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00eb9c62de0eb6fd781a76db23a7eab98796b320 --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructHand.hpp @@ -0,0 +1,97 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP + +#include +#include +#include +#include + +namespace op +{ + /** + * WrapperStructHand: Hand estimation and rendering configuration struct. + * WrapperStructHand allows the user to set up the hand estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + struct OP_API WrapperStructHand + { + /** + * Whether to extract hand. + */ + bool enable; + + /** + * Kind of hand rectangle detector. Recommended Detector::Body (fastest one if body is enabled and most + * accurate one), which is based on the OpenPose body keypoint detector. + * For hand, there is the alternative of Detector::BodyWithTracking. If selected, it will add tracking + * between frames. Adding hand tracking might improve hand keypoints detection for webcam (if the frame + * rate is high enough, i.e., >7 FPS per GPU) and video. This is not person ID tracking, it simply looks + * for hands in positions at which hands were located in previous frames, but it does not guarantee the + * same person id among frames. + */ + Detector detector; + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + Point netInputSize; + + /** + * Number of scales to process. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * This parameter is related with scaleRange, such as the final pose estimation will be an average of the + * predicted results for each scale. + */ + int scalesNumber; + + /** + * Total range between smallest and biggest scale. The scales will be centered in ratio 1. E.g., if + * scaleRange = 0.4 and scalesNumber = 2, then there will be 2 scales, 0.8 and 1.2. + */ + float scaleRange; + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select `None` for no rendering, `Cpu` or `Gpu` por CPU and GPU rendering respectively. + */ + RenderMode renderMode; + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + float alphaKeypoint; + + /** + * Rendering blending alpha value of the heat maps (hand part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + float alphaHeatMap; + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + float renderThreshold; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructHand( + const bool enable = false, const Detector detector = Detector::Body, + const Point& netInputSize = Point{368, 368}, const int scalesNumber = 1, + const float scaleRange = 0.4f, const RenderMode renderMode = RenderMode::Auto, + const float alphaKeypoint = HAND_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = HAND_DEFAULT_ALPHA_HEAT_MAP, const float renderThreshold = 0.2f); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_HAND_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructInput.hpp b/usr/local/include/openpose/wrapper/wrapperStructInput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff30487796521c1129b54301257f3c76a8291fd8 --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructInput.hpp @@ -0,0 +1,110 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP + +#include // std::numeric_limits +#include +#include + +namespace op +{ + /** + * WrapperStructInput: Input (images, video, webcam, etc.) configuration struct. + * WrapperStructInput allows the user to set up the input frames generator. + */ + struct OP_API WrapperStructInput + { + /** + * Desired type of producer (FlirCamera, ImageDirectory, IPCamera, Video, Webcam, None, etc.). + * Default: ProducerType::None. + */ + ProducerType producerType; + + /** + * Path of the producer (image directory path for ImageDirectory, video path for Video, + * camera index for Webcam and FlirCamera, URL for IPCamera, etc.). + * Default: "". + */ + String producerString; + + /** + * First image to process. + * Default: 0. + */ + unsigned long long frameFirst; + + /** + * Step or gap across processed frames. + * Default: 1 (i.e., process all frames). + * Example: A value of 5 would mean to process frames 0, 5, 10, etc. + */ + unsigned long long frameStep; + + /** + * Last image to process. + * Default: -1 (i.e., process all frames). + */ + unsigned long long frameLast; + + /** + * Whether to skip or sleep in order to keep the same FPS as the frames producer. + */ + bool realTimeProcessing; + + /** + * Whether to flip (mirror) the image. + */ + bool frameFlip; + + /** + * Image rotation. + * Only 4 possible values: 0 (default, no rotation), 90, 180 or 270 degrees + */ + int frameRotate; + + /** + * Whether to re-open the producer if it reaches the end (e.g., video or image directory after the last frame). + */ + bool framesRepeat; + + /** + * Camera resolution (only for Webcam and FlirCamera). + */ + Point cameraResolution; + + /** + * Directory path for the camera parameters (intrinsic and extrinsic parameters) or optionally XML file + * full path (if only 1 view). + */ + String cameraParameterPath; + + /** + * Whether to undistort the image given the camera parameters. + */ + bool undistortImage; + + /** + * Number of camera views. + * Complementary option for `--image_dir` or `--video` + * It is -1 for Flir cameras (# cameras detected at runtime), as well as for any other frames source (-1 and 1 + * are equivalent for those). It could be greater than 1 only for prerecorded produced sources, such as video + * and image directory. + */ + int numberViews; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructInput( + const ProducerType producerType = ProducerType::None, const String& producerString = "", + const unsigned long long frameFirst = 0, const unsigned long long frameStep = 1, + const unsigned long long frameLast = std::numeric_limits::max(), + const bool realTimeProcessing = false, const bool frameFlip = false, const int frameRotate = 0, + const bool framesRepeat = false, const Point& cameraResolution = Point{-1,-1}, + const String& cameraParameterPath = "models/cameraParameters/", + const bool undistortImage = false, const int numberViews = -1); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_INPUT_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp b/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp new file mode 100644 index 0000000000000000000000000000000000000000..257c2bc70f695069d8292e8172af366366401b57 --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp @@ -0,0 +1,164 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP + +#include +#include +#include + +namespace op +{ + /** + * WrapperStructOutput: Output ( writing rendered results and/or pose data, etc.) configuration struct. + */ + struct OP_API WrapperStructOutput + { + /** + * Output verbose in the command line. + * If -1, it will be disabled (default). If it is a positive integer number, it will print on" + * the command line every `verbose` frames. If number in the range (0,1), it will print the" + * progress every `verbose` times the total of frames. + */ + double verbose; + + /** + * Pose (x, y, score) locations saving folder location. + * If it is empty (default), it is disabled. + * Select format with writeKeypointFormat. + */ + String writeKeypoint; + + /** + * Data format to save Pose (x, y, score) locations. + * Options: DataFormat::Json (default), DataFormat::Xml and DataFormat::Yml (equivalent to DataFormat::Yaml) + * JSON option only available for OpenCV >= 3.0. + */ + DataFormat writeKeypointFormat; + + /** + * Directory to write OpenPose output in JSON format. + * If it is empty (default), it is disabled. + * It includes: + * - `people` field with body, hand, and face pose keypoints in (x, y, score) format. + * - `part_candidates` field with body part candidates in (x, y, score) format (if enabled with + * `--part_candidates`). + */ + String writeJson; + + /** + * Pose (x, y, score) locations saving folder location in JSON COCO validation format. + * If it is empty (default), it is disabled. + */ + String writeCocoJson; + + /** + * It selects the COCO variants for cocoJsonSaver. + * Add 1 for body, add 2 for foot, 4 for face, and/or 8 for hands. Use 0 to use all the possible candidates. + * E.g., 7 would mean body+foot+face COCO JSON.. + */ + int writeCocoJsonVariants; + + /** + * Experimental option (only makes effect on car JSON generation). + * It selects the COCO variant for cocoJsonSaver. + */ + int writeCocoJsonVariant; + + /** + * Rendered image saving folder. + * If it is empty (default), it is disabled. + */ + String writeImages; + + /** + * Rendered image saving folder format. + * Check your OpenCV version documentation for a list of compatible formats. + * E.g., png, jpg, etc. + * If writeImages is empty (default), it makes no effect. + */ + String writeImagesFormat; + + /** + * Rendered images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + String writeVideo; + + /** + * Frame rate of the recorded video. + * By default (-1.), it will try to get the input frames producer frame rate (e.g., input video or webcam frame + * rate). If the input frames producer does not have a set FPS (e.g., image_dir or webcam if OpenCV not + * compiled with its support), set this value accordingly (e.g., to the frame rate displayed by the OpenPose + * GUI). + */ + double writeVideoFps; + + /** + * Whether to save the output video with audio. The input producer must be a video too. + */ + bool writeVideoWithAudio; + + /** + * Rendered heat maps saving folder. + * In order to save the heatmaps, WrapperStructPose.heatMapTypes must also be filled. + * If it is empty (default), it is disabled. + */ + String writeHeatMaps; + + /** + * Heat maps image saving format. + * Analogous to writeImagesFormat. + */ + String writeHeatMapsFormat; + + /** + * Rendered 3D images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + String writeVideo3D; + + /** + * Rendered Adam images saving video path. + * Please, use *.avi format. + * If it is empty (default), it is disabled. + */ + String writeVideoAdam; + + /** + * Path to save a 3-D joint angle BVH file. + * Please, use *.bvh format. + * If it is empty (default), it is disabled. + */ + String writeBvh; + + /** + * Target server IP address for UDP client-server communication. + */ + String udpHost; + + /** + * Target server IP port for UDP client-server communication. + */ + String udpPort; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructOutput( + const double verbose = -1, const String& writeKeypoint = "", + const DataFormat writeKeypointFormat = DataFormat::Xml, const String& writeJson = "", + const String& writeCocoJson = "", const int writeCocoJsonVariants = 1, + const int writeCocoJsonVariant = 1, const String& writeImages = "", + const String& writeImagesFormat = "png", const String& writeVideo = "", + const double writeVideoFps = -1., const bool writeVideoWithAudio = false, + const String& writeHeatMaps = "", const String& writeHeatMapsFormat = "png", + const String& writeVideo3D = "", const String& writeVideoAdam = "", + const String& writeBvh = "", const String& udpHost = "", + const String& udpPort = "8051"); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_OUTPUT_HPP diff --git a/usr/local/include/openpose/wrapper/wrapperStructPose.hpp b/usr/local/include/openpose/wrapper/wrapperStructPose.hpp new file mode 100644 index 0000000000000000000000000000000000000000..72c1a4dcfdf81c485bc70bdee1cb9c504687bf1f --- /dev/null +++ b/usr/local/include/openpose/wrapper/wrapperStructPose.hpp @@ -0,0 +1,238 @@ +#ifndef OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP +#define OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP + +#include +#include +#include +#include +#include +#include + +namespace op +{ + /** + * WrapperStructPose: Pose estimation and rendering configuration struct. + * WrapperStructPose allows the user to set up the pose estimation and rendering parameters that will be used for + * the OpenPose WrapperT template and Wrapper class. + */ + struct OP_API WrapperStructPose + { + /** + * Whether to extract body. + * It might be optionally disabled for very few cases (e.g., if only face keypoint detection is desired for + * speedup while reducing its accuracy). Otherwise, it must be always enabled. + */ + PoseMode poseMode; + + /** + * CCN (Conv Net) input size. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * Both width and height must be divisible by 16. + */ + Point netInputSize; + + /** + * Zero or negative means that using `-1` in netInputSize will behave as explained in its flag description. + * Otherwise, and to avoid out of memory errors, the `-1` in netInputSize will clip to this value times the + * default 16/9 aspect ratio value (i.e., 656 width for a 368 height). E.g., netInputSizeDynamicBehavior = 10 + * and netInputSize = {-1x368} will clip to 6560x368 (10 x 656). Recommended 1 for small GPUs (to avoid out of + * memory errors but maximize speed) and 0 for big GPUs (for maximum accuracy and speed). + */ + double netInputSizeDynamicBehavior; + + /** + * Output size of the final rendered image. + * It barely affects performance compared to netInputSize. + * The final Datum.poseKeypoints can be scaled with respect to outputSize if `keypointScaleMode` is set to + * ScaleMode::OutputResolution, even if the rendering is disabled. + */ + Point outputSize; + + /** + * Final scale of the Array Datum.poseKeypoints and the written pose data. + * The final Datum.poseKeypoints can be scaled with respect to input size (ScaleMode::InputResolution), net + * output size (ScaleMode::NetOutputResolution), output rendering size (ScaleMode::OutputResolution), from 0 to + * 1 (ScaleMode::ZeroToOne(FixedAspect)), and -1 to 1 (ScaleMode::PlusMinusOne(FixedAspect)). + */ + ScaleMode keypointScaleMode; + + /** + * Number of GPUs processing in parallel. + * The greater, the faster the algorithm will run, but potentially higher lag will appear (which only affects + * in real-time webcam scenarios). + */ + int gpuNumber; + + /** + * First GPU device. + * Such as the GPUs used will be the ones in the range: [gpuNumberStart, gpuNumberStart + gpuNumber]. + */ + int gpuNumberStart; + + /** + * Number of scales to process. + * The greater, the slower and more memory it will be needed, but it will potentially increase accuracy. + * This parameter is related with scaleGap, such as the final pose estimation will be an average of the + * predicted results for each scale. + */ + int scalesNumber; + + /** + * Gap between successive scales. + * The pose estimation will be estimation for the scales in the range [1, 1-scaleGap*scalesNumber], with a gap + * of scaleGap. + */ + float scaleGap; + + /** + * Whether to render the output (pose locations, body, background or PAF heat maps) with CPU or GPU. + * Select `None` for no rendering, `Cpu` or `Gpu` por CPU and GPU rendering respectively. + */ + RenderMode renderMode; + + /** + * Pose model, it affects the number of body parts to render + * Select PoseModel::BODY_25 for 25 body-part COCO + foot model; PoseModel::COCO_18 for 18 body-part COCO; + * PoseModel::MPI_15 for 15 body-part MPI; PoseModel::MPI_15_4 for faster version of MPI; etc.. + */ + PoseModel poseModel; + + /** + * Whether to blend the final results on top of the original image, or just render them on a flat background. + */ + bool blendOriginalFrame; + + /** + * Rendering blending alpha value of the pose point locations with respect to the background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will fully render the pose. + */ + float alphaKeypoint; + + /** + * Rendering blending alpha value of the heat maps (body part, background or PAF) with respect to the + * background image. + * Value in the range [0, 1]. 0 will only render the background, 1 will only render the heat map. + */ + float alphaHeatMap; + + /** + * Element to initially render. + * Set 0 for pose, [1, #body parts] for each body part following the order on POSE_BODY_PART_MAPPING on + * `include/pose/poseParameters.hpp`, #body parts+1 for background, #body parts+2 for all body parts + * overlapped, #body parts+3 for all PAFs, and [#body parts+4, #body parts+4+#pair pairs] for each PAF + * following the order on POSE_BODY_PART_PAIRS. + */ + int defaultPartToRender; + + /** + * Folder where the pose Caffe models are located. + */ + String modelFolder; + + /** + * Whether and which heat maps to save on the Array Datum.heatmaps. + * Use HeatMapType::Parts for body parts, HeatMapType::Background for the background, and HeatMapType::PAFs for + * the Part Affinity Fields. + */ + std::vector heatMapTypes; + + /** + * Scale of the Datum.heatmaps. + * Select ScaleMode::ZeroToOne(FixedAspect) for range [0,1], ScaleMode::PlusMinusOne(FixedAspect) for [-1,1] + * and ScaleMode::UnsignedChar for [0, 255]. + * If heatMapTypes.empty(), then this parameters makes no effect. + */ + ScaleMode heatMapScaleMode; + + /** + * Whether to add the body part candidates. + * Candidates refer to all the detected body parts, before being assembled into people. + */ + bool addPartCandidates; + + /** + * Rendering threshold. Only estimated keypoints whose score confidences are higher than this value will be + * rendered. Note: Rendered refers only to visual display in the OpenPose basic GUI, not in the saved results. + * Generally, a high threshold (> 0.5) will only render very clear body parts; while small thresholds + * (~0.1) will also output guessed and occluded keypoints, but also more false positives (i.e., wrong + * detections). + */ + float renderThreshold; + + /** + * Maximum number of people to be detected. + * This parameter will limit the maximum number of people detected, by keeping the people with the + * `numberPeopleMax` top scores. + * Useful if you know the exact number of people in the scene, so it can remove false positives (if all the + * people have been detected. + * However, it might also include false negatives by removing very small or highly occluded people. + */ + int numberPeopleMax; + + /** + * Whether to maximize the number of positives. + * It reduces the thresholds to accept a person candidate. It highly increases both false and true positives. + * I.e., it maximizes average recall but could harm average precision. + */ + bool maximizePositives; + + /** + * Maximum processing frame rate. + * By default (-1), OpenPose will process frames as fast as possible. + * Example usage: If OpenPose is displaying images too quickly, this can reduce the speed so the user can + * analyze better each frame from the GUI. + */ + double fpsMax; + + /** + * Final path where the pose Caffe ProtoTxt file is located. + * The combination modelFolder + protoTxtPath represents the whole path to the prototxt file. + * If empty, it will use the default OpenPose ProtoTxt file. + */ + String protoTxtPath; + + /** + * Final path where the pose Caffe CaffeModel is located. + * The combination modelFolder + caffeModelPath represents the whole path to the caffemodel file. + * If empty, it will use the default OpenPose CaffeModel file. + */ + String caffeModelPath; + + /** + * The image upsampling scale. 8 is the stride of the network, so the ideal value to maximize the + * speed/accuracy trade-off. + */ + float upsamplingRatio; + + /** + * Whether to internally enable Google Logging. + * This option is only applicable if Caffe is used. + * Only disable it if the user is already calling google::InitGoogleLogging() in his code. + * If the user disables Google Logging and he does not call it by himself, then Caffe will start to pop up + * all the verbose messages. + */ + bool enableGoogleLogging; + + /** + * Constructor of the struct. + * It has the recommended and default values we recommend for each element of the struct. + * Since all the elements of the struct are public, they can also be manually filled. + */ + WrapperStructPose( + const PoseMode poseMode = PoseMode::Enabled, const Point& netInputSize = Point{-1, 368}, + const double netInputSizeDynamicBehavior = 1., + const Point& outputSize = Point{-1, -1}, + const ScaleMode keypointScaleMode = ScaleMode::InputResolution, const int gpuNumber = -1, + const int gpuNumberStart = 0, const int scalesNumber = 1, const float scaleGap = 0.25f, + const RenderMode renderMode = RenderMode::Auto, const PoseModel poseModel = PoseModel::BODY_25, + const bool blendOriginalFrame = true, const float alphaKeypoint = POSE_DEFAULT_ALPHA_KEYPOINT, + const float alphaHeatMap = POSE_DEFAULT_ALPHA_HEAT_MAP, const int defaultPartToRender = 0, + const String& modelFolder = "models/", const std::vector& heatMapTypes = {}, + const ScaleMode heatMapScaleMode = ScaleMode::UnsignedChar, const bool addPartCandidates = false, + const float renderThreshold = 0.05f, const int numberPeopleMax = -1, const bool maximizePositives = false, + const double fpsMax = -1., const String& protoTxtPath = "", const String& caffeModelPath = "", + const float upsamplingRatio = 0.f, const bool enableGoogleLogging = true); + }; +} + +#endif // OPENPOSE_WRAPPER_WRAPPER_STRUCT_POSE_HPP diff --git a/usr/local/lib/OpenPose/OpenPose-release.cmake b/usr/local/lib/OpenPose/OpenPose-release.cmake new file mode 100644 index 0000000000000000000000000000000000000000..f6c41150a5e1bbc5a4f94ef8b3cd8bc1f5e599fb --- /dev/null +++ b/usr/local/lib/OpenPose/OpenPose-release.cmake @@ -0,0 +1,179 @@ +#---------------------------------------------------------------- +# Generated CMake target import file for configuration "Release". +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Import target "openpose_3d" for configuration "Release" +set_property(TARGET openpose_3d APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_3d PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_3d.so" + IMPORTED_SONAME_RELEASE "libopenpose_3d.so" + ) + +list(APPEND _cmake_import_check_targets openpose_3d ) +list(APPEND _cmake_import_check_files_for_openpose_3d "${_IMPORT_PREFIX}/lib/libopenpose_3d.so" ) + +# Import target "openpose_calibration" for configuration "Release" +set_property(TARGET openpose_calibration APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_calibration PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_calibration.so" + IMPORTED_SONAME_RELEASE "libopenpose_calibration.so" + ) + +list(APPEND _cmake_import_check_targets openpose_calibration ) +list(APPEND _cmake_import_check_files_for_openpose_calibration "${_IMPORT_PREFIX}/lib/libopenpose_calibration.so" ) + +# Import target "openpose_core" for configuration "Release" +set_property(TARGET openpose_core APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_core PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_core.so" + IMPORTED_SONAME_RELEASE "libopenpose_core.so" + ) + +list(APPEND _cmake_import_check_targets openpose_core ) +list(APPEND _cmake_import_check_files_for_openpose_core "${_IMPORT_PREFIX}/lib/libopenpose_core.so" ) + +# Import target "openpose_face" for configuration "Release" +set_property(TARGET openpose_face APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_face PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_face.so" + IMPORTED_SONAME_RELEASE "libopenpose_face.so" + ) + +list(APPEND _cmake_import_check_targets openpose_face ) +list(APPEND _cmake_import_check_files_for_openpose_face "${_IMPORT_PREFIX}/lib/libopenpose_face.so" ) + +# Import target "openpose_filestream" for configuration "Release" +set_property(TARGET openpose_filestream APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_filestream PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_filestream.so" + IMPORTED_SONAME_RELEASE "libopenpose_filestream.so" + ) + +list(APPEND _cmake_import_check_targets openpose_filestream ) +list(APPEND _cmake_import_check_files_for_openpose_filestream "${_IMPORT_PREFIX}/lib/libopenpose_filestream.so" ) + +# Import target "openpose_gpu" for configuration "Release" +set_property(TARGET openpose_gpu APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_gpu PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_gpu.so" + IMPORTED_SONAME_RELEASE "libopenpose_gpu.so" + ) + +list(APPEND _cmake_import_check_targets openpose_gpu ) +list(APPEND _cmake_import_check_files_for_openpose_gpu "${_IMPORT_PREFIX}/lib/libopenpose_gpu.so" ) + +# Import target "openpose_gui" for configuration "Release" +set_property(TARGET openpose_gui APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_gui PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_gui.so" + IMPORTED_SONAME_RELEASE "libopenpose_gui.so" + ) + +list(APPEND _cmake_import_check_targets openpose_gui ) +list(APPEND _cmake_import_check_files_for_openpose_gui "${_IMPORT_PREFIX}/lib/libopenpose_gui.so" ) + +# Import target "openpose_hand" for configuration "Release" +set_property(TARGET openpose_hand APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_hand PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_hand.so" + IMPORTED_SONAME_RELEASE "libopenpose_hand.so" + ) + +list(APPEND _cmake_import_check_targets openpose_hand ) +list(APPEND _cmake_import_check_files_for_openpose_hand "${_IMPORT_PREFIX}/lib/libopenpose_hand.so" ) + +# Import target "openpose_net" for configuration "Release" +set_property(TARGET openpose_net APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_net PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_net.so" + IMPORTED_SONAME_RELEASE "libopenpose_net.so" + ) + +list(APPEND _cmake_import_check_targets openpose_net ) +list(APPEND _cmake_import_check_files_for_openpose_net "${_IMPORT_PREFIX}/lib/libopenpose_net.so" ) + +# Import target "openpose_pose" for configuration "Release" +set_property(TARGET openpose_pose APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_pose PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_pose.so" + IMPORTED_SONAME_RELEASE "libopenpose_pose.so" + ) + +list(APPEND _cmake_import_check_targets openpose_pose ) +list(APPEND _cmake_import_check_files_for_openpose_pose "${_IMPORT_PREFIX}/lib/libopenpose_pose.so" ) + +# Import target "openpose_producer" for configuration "Release" +set_property(TARGET openpose_producer APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_producer PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_producer.so" + IMPORTED_SONAME_RELEASE "libopenpose_producer.so" + ) + +list(APPEND _cmake_import_check_targets openpose_producer ) +list(APPEND _cmake_import_check_files_for_openpose_producer "${_IMPORT_PREFIX}/lib/libopenpose_producer.so" ) + +# Import target "openpose_thread" for configuration "Release" +set_property(TARGET openpose_thread APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_thread PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_thread.so" + IMPORTED_SONAME_RELEASE "libopenpose_thread.so" + ) + +list(APPEND _cmake_import_check_targets openpose_thread ) +list(APPEND _cmake_import_check_files_for_openpose_thread "${_IMPORT_PREFIX}/lib/libopenpose_thread.so" ) + +# Import target "openpose_tracking" for configuration "Release" +set_property(TARGET openpose_tracking APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_tracking PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_tracking.so" + IMPORTED_SONAME_RELEASE "libopenpose_tracking.so" + ) + +list(APPEND _cmake_import_check_targets openpose_tracking ) +list(APPEND _cmake_import_check_files_for_openpose_tracking "${_IMPORT_PREFIX}/lib/libopenpose_tracking.so" ) + +# Import target "openpose_unity" for configuration "Release" +set_property(TARGET openpose_unity APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_unity PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_unity.so" + IMPORTED_SONAME_RELEASE "libopenpose_unity.so" + ) + +list(APPEND _cmake_import_check_targets openpose_unity ) +list(APPEND _cmake_import_check_files_for_openpose_unity "${_IMPORT_PREFIX}/lib/libopenpose_unity.so" ) + +# Import target "openpose_utilities" for configuration "Release" +set_property(TARGET openpose_utilities APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_utilities PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_utilities.so" + IMPORTED_SONAME_RELEASE "libopenpose_utilities.so" + ) + +list(APPEND _cmake_import_check_targets openpose_utilities ) +list(APPEND _cmake_import_check_files_for_openpose_utilities "${_IMPORT_PREFIX}/lib/libopenpose_utilities.so" ) + +# Import target "openpose_wrapper" for configuration "Release" +set_property(TARGET openpose_wrapper APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose_wrapper PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose_wrapper.so" + IMPORTED_SONAME_RELEASE "libopenpose_wrapper.so" + ) + +list(APPEND _cmake_import_check_targets openpose_wrapper ) +list(APPEND _cmake_import_check_files_for_openpose_wrapper "${_IMPORT_PREFIX}/lib/libopenpose_wrapper.so" ) + +# Import target "openpose" for configuration "Release" +set_property(TARGET openpose APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) +set_target_properties(openpose PROPERTIES + IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopenpose.so.1.7.0" + IMPORTED_SONAME_RELEASE "libopenpose.so.1.7.0" + ) + +list(APPEND _cmake_import_check_targets openpose ) +list(APPEND _cmake_import_check_files_for_openpose "${_IMPORT_PREFIX}/lib/libopenpose.so.1.7.0" ) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) diff --git a/usr/local/lib/OpenPose/OpenPose.cmake b/usr/local/lib/OpenPose/OpenPose.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b8e24f43b953f0d43c15119e9386195c623b8942 --- /dev/null +++ b/usr/local/lib/OpenPose/OpenPose.cmake @@ -0,0 +1,217 @@ +# Generated by CMake + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8) + message(FATAL_ERROR "CMake >= 2.8.0 required") +endif() +if(CMAKE_VERSION VERSION_LESS "2.8.3") + message(FATAL_ERROR "CMake >= 2.8.3 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.8.3...3.25) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_cmake_targets_defined "") +set(_cmake_targets_not_defined "") +set(_cmake_expected_targets "") +foreach(_cmake_expected_target IN ITEMS openpose_3d openpose_calibration openpose_core openpose_face openpose_filestream openpose_gpu openpose_gui openpose_hand openpose_net openpose_pose openpose_producer openpose_thread openpose_tracking openpose_unity openpose_utilities openpose_wrapper openpose) + list(APPEND _cmake_expected_targets "${_cmake_expected_target}") + if(TARGET "${_cmake_expected_target}") + list(APPEND _cmake_targets_defined "${_cmake_expected_target}") + else() + list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") + endif() +endforeach() +unset(_cmake_expected_target) +if(_cmake_targets_defined STREQUAL _cmake_expected_targets) + unset(_cmake_targets_defined) + unset(_cmake_targets_not_defined) + unset(_cmake_expected_targets) + unset(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT _cmake_targets_defined STREQUAL "") + string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") + string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") +endif() +unset(_cmake_targets_defined) +unset(_cmake_targets_not_defined) +unset(_cmake_expected_targets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target openpose_3d +add_library(openpose_3d SHARED IMPORTED) + +set_target_properties(openpose_3d PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;caffe;openpose_core" +) + +# Create imported target openpose_calibration +add_library(openpose_calibration SHARED IMPORTED) + +set_target_properties(openpose_calibration PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_core" +) + +# Create imported target openpose_core +add_library(openpose_core SHARED IMPORTED) + +set_target_properties(openpose_core PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a" +) + +# Create imported target openpose_face +add_library(openpose_face SHARED IMPORTED) + +set_target_properties(openpose_face PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_core" +) + +# Create imported target openpose_filestream +add_library(openpose_filestream SHARED IMPORTED) + +set_target_properties(openpose_filestream PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_core" +) + +# Create imported target openpose_gpu +add_library(openpose_gpu SHARED IMPORTED) + +set_target_properties(openpose_gpu PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_core" +) + +# Create imported target openpose_gui +add_library(openpose_gui SHARED IMPORTED) + +set_target_properties(openpose_gui PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_pose;opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_alphamat;opencv_aruco;opencv_barcode;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_wechat_qrcode;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto" +) + +# Create imported target openpose_hand +add_library(openpose_hand SHARED IMPORTED) + +set_target_properties(openpose_hand PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_core" +) + +# Create imported target openpose_net +add_library(openpose_net SHARED IMPORTED) + +set_target_properties(openpose_net PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;caffe;openpose_core" +) + +# Create imported target openpose_pose +add_library(openpose_pose SHARED IMPORTED) + +set_target_properties(openpose_pose PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_core" +) + +# Create imported target openpose_producer +add_library(openpose_producer SHARED IMPORTED) + +set_target_properties(openpose_producer PROPERTIES + INTERFACE_LINK_LIBRARIES "opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_alphamat;opencv_aruco;opencv_barcode;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_wechat_qrcode;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto;openpose_core;openpose_thread;openpose_filestream" +) + +# Create imported target openpose_thread +add_library(openpose_thread SHARED IMPORTED) + +set_target_properties(openpose_thread PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_core" +) + +# Create imported target openpose_tracking +add_library(openpose_tracking SHARED IMPORTED) + +set_target_properties(openpose_tracking PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_core" +) + +# Create imported target openpose_unity +add_library(openpose_unity SHARED IMPORTED) + +set_target_properties(openpose_unity PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_pose;opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_alphamat;opencv_aruco;opencv_barcode;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_wechat_qrcode;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto;/usr/lib/x86_64-linux-gnu/libglog.so;/content/openpose/build/caffe/lib/libcaffe.so;pthread" +) + +# Create imported target openpose_utilities +add_library(openpose_utilities SHARED IMPORTED) + +set_target_properties(openpose_utilities PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;openpose_producer;openpose_filestream" +) + +# Create imported target openpose_wrapper +add_library(openpose_wrapper SHARED IMPORTED) + +set_target_properties(openpose_wrapper PROPERTIES + INTERFACE_LINK_LIBRARIES "openpose_thread;openpose_pose;openpose_hand;openpose_core;openpose_face;openpose_filestream;openpose_gui;openpose_producer;openpose_utilities" +) + +# Create imported target openpose +add_library(openpose SHARED IMPORTED) + +set_target_properties(openpose PROPERTIES + INTERFACE_LINK_LIBRARIES "/usr/local/cuda/lib64/libcudart_static.a;Threads::Threads;dl;/usr/lib/x86_64-linux-gnu/librt.a;opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_alphamat;opencv_aruco;opencv_barcode;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_wechat_qrcode;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto;/usr/lib/x86_64-linux-gnu/libglog.so;/content/openpose/build/caffe/lib/libcaffe.so;pthread;caffe" +) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Load information for each installed configuration. +file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OpenPose-*.cmake") +foreach(_cmake_config_file IN LISTS _cmake_config_files) + include("${_cmake_config_file}") +endforeach() +unset(_cmake_config_file) +unset(_cmake_config_files) + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(_cmake_target IN LISTS _cmake_import_check_targets) + foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}") + if(NOT EXISTS "${_cmake_file}") + message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file + \"${_cmake_file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_cmake_file) + unset("_cmake_import_check_files_for_${_cmake_target}") +endforeach() +unset(_cmake_target) +unset(_cmake_import_check_targets) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/usr/local/lib/OpenPose/OpenPoseConfig.cmake b/usr/local/lib/OpenPose/OpenPoseConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ed6018ba3ee06f46b42993ed763d283a2046bbfa --- /dev/null +++ b/usr/local/lib/OpenPose/OpenPoseConfig.cmake @@ -0,0 +1,39 @@ +# Compute and install package configuration and version files +get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_prefix "${_dir}/../.." ABSOLUTE) + +# Import the targets +include("${_prefix}/lib/OpenPose/OpenPose.cmake") +if (ON) + set(Caffe_INCLUDE_DIRS "${_prefix}/include/") + # set(Caffe_LIBS "${_prefix}/lib/libcaffe.so") +endif (ON) + +# Report other information +set(OpenPose_INCLUDE_DIRS "${_prefix}/include/") +set(OpenPose_VERSION_MAJOR 1) +set(OpenPose_VERSION_MINOR 7) +set(OpenPose_VERSION_PATCH 0) +set(OpenPose_VERSION 1.7.0) + +# Check that the user requested components +# are actually targets that are part of this build +if (OpenPose_FIND_COMPONENTS) + foreach (comp ${OpenPose_FIND_COMPONENTS}) + if (NOT TARGET ${comp}) + set (OpenPose_${comp}_FOUND 0) + if (OpenPose_FIND_REQUIRED_${comp}) + message(FATAL_ERROR "OpenPose ${comp} not available.") + endif (OpenPose_FIND_REQUIRED_${comp}) + else (NOT TARGET ${comp}) + set(OpenPose_${comp}_FOUND 1) + set(OpenPose_LIBS "${comp};${OpenPose_LIBS}") + endif (NOT TARGET ${comp}) + endforeach () +else (OpenPose_FIND_COMPONENTS) + set(OpenPose_LIBS "openpose") +endif (OpenPose_FIND_COMPONENTS) + +if (OpenPose_INCLUDE_DIRS AND OpenPose_LIBS) + set(OpenPose_FOUND 1) +endif (OpenPose_INCLUDE_DIRS AND OpenPose_LIBS) diff --git a/usr/local/lib/libcaffe.so b/usr/local/lib/libcaffe.so new file mode 100644 index 0000000000000000000000000000000000000000..689982df07bd9401328709b557a5be82f762d6d2 --- /dev/null +++ b/usr/local/lib/libcaffe.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30f3dd5d009812fb44f7de57d4215a4f814fb6773f0ae454156a75f20ed7a841 +size 6381112 diff --git a/usr/local/lib/libcaffe.so.1.0.0 b/usr/local/lib/libcaffe.so.1.0.0 new file mode 100644 index 0000000000000000000000000000000000000000..689982df07bd9401328709b557a5be82f762d6d2 --- /dev/null +++ b/usr/local/lib/libcaffe.so.1.0.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30f3dd5d009812fb44f7de57d4215a4f814fb6773f0ae454156a75f20ed7a841 +size 6381112 diff --git a/usr/local/lib/libcaffeproto.a b/usr/local/lib/libcaffeproto.a new file mode 100644 index 0000000000000000000000000000000000000000..d650d5135df44603bebc6e7ebab49e2590cc57d5 --- /dev/null +++ b/usr/local/lib/libcaffeproto.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:601c5c778e88bb71ac349016862a7b271544f65b6f763df4d56071a58e1cc94e +size 1164458 diff --git a/usr/local/lib/libopenpose.so b/usr/local/lib/libopenpose.so new file mode 100644 index 0000000000000000000000000000000000000000..d28d8b73f901373464c911f3536b8fe281e0cf62 --- /dev/null +++ b/usr/local/lib/libopenpose.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4f7b595cd29f70cadcfff4d22a25acfbe21997a9b52cc012b57a9f08463c0f +size 6045568 diff --git a/usr/local/lib/libopenpose.so.1.7.0 b/usr/local/lib/libopenpose.so.1.7.0 new file mode 100644 index 0000000000000000000000000000000000000000..d28d8b73f901373464c911f3536b8fe281e0cf62 --- /dev/null +++ b/usr/local/lib/libopenpose.so.1.7.0 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4f7b595cd29f70cadcfff4d22a25acfbe21997a9b52cc012b57a9f08463c0f +size 6045568 diff --git a/usr/local/lib/libopenpose_3d.so b/usr/local/lib/libopenpose_3d.so new file mode 100644 index 0000000000000000000000000000000000000000..23d2eaa51da3a8cb6ba8b37ba8dc23fa5d4b1347 Binary files /dev/null and b/usr/local/lib/libopenpose_3d.so differ diff --git a/usr/local/lib/libopenpose_calibration.so b/usr/local/lib/libopenpose_calibration.so new file mode 100644 index 0000000000000000000000000000000000000000..b8d638f5ba3c7eaf7cd801a08ccc86716a7f83c4 Binary files /dev/null and b/usr/local/lib/libopenpose_calibration.so differ diff --git a/usr/local/lib/libopenpose_core.so b/usr/local/lib/libopenpose_core.so new file mode 100644 index 0000000000000000000000000000000000000000..6570cd83cda4a00174c00d4c05eddbde88a3e1c7 --- /dev/null +++ b/usr/local/lib/libopenpose_core.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a89be0ee7172a34bd4b2f402d85887d50fbabdb62fed51f129a0aca0f44fb8ad +size 2233576 diff --git a/usr/local/lib/libopenpose_face.so b/usr/local/lib/libopenpose_face.so new file mode 100644 index 0000000000000000000000000000000000000000..e47a8f5f1ef28647c04fc62ae229ca3f81ecc7bc --- /dev/null +++ b/usr/local/lib/libopenpose_face.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bfd2e96723a7e8dccf25c63087888c7e301f987accd431b121671c9b46ce7d4 +size 1146240 diff --git a/usr/local/lib/libopenpose_filestream.so b/usr/local/lib/libopenpose_filestream.so new file mode 100644 index 0000000000000000000000000000000000000000..8bc499028e61ed238d5e455cc5f511884f7462f9 Binary files /dev/null and b/usr/local/lib/libopenpose_filestream.so differ diff --git a/usr/local/lib/libopenpose_gpu.so b/usr/local/lib/libopenpose_gpu.so new file mode 100644 index 0000000000000000000000000000000000000000..f446ee4b4af0e974cf97dcaf9ec6048dcfcb8c18 --- /dev/null +++ b/usr/local/lib/libopenpose_gpu.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:821109f2e622da0309c2d9a235718a3c8b3f191ab82f3dc0b1f627c729a708dd +size 1014144 diff --git a/usr/local/lib/libopenpose_gui.so b/usr/local/lib/libopenpose_gui.so new file mode 100644 index 0000000000000000000000000000000000000000..a7b1c5ac034d6c463112c77b9c7a0a90ab080d64 Binary files /dev/null and b/usr/local/lib/libopenpose_gui.so differ diff --git a/usr/local/lib/libopenpose_hand.so b/usr/local/lib/libopenpose_hand.so new file mode 100644 index 0000000000000000000000000000000000000000..058f8c47a0e18ce01800b3fff5f584b6287d44d0 --- /dev/null +++ b/usr/local/lib/libopenpose_hand.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de7f59c365cb8a5f039ade80c33a1317e4fe706f891e5f04cbb28c2640bb36e5 +size 1171336 diff --git a/usr/local/lib/libopenpose_net.so b/usr/local/lib/libopenpose_net.so new file mode 100644 index 0000000000000000000000000000000000000000..665d1e25dd2da32bf9d339864c943ccbd4c3780f --- /dev/null +++ b/usr/local/lib/libopenpose_net.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a71514fc9c362851e366dad718338122b04eb5466bb606b140e2d1ad72f7369 +size 2084552 diff --git a/usr/local/lib/libopenpose_pose.so b/usr/local/lib/libopenpose_pose.so new file mode 100644 index 0000000000000000000000000000000000000000..68da8cedb02932830f87d17fbec1e5c60690e4f4 --- /dev/null +++ b/usr/local/lib/libopenpose_pose.so @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9126a62eff5bb1315ab3158da4dd87a4074aab2685499ad98fbec8e2e731b37 +size 1512984 diff --git a/usr/local/lib/libopenpose_producer.so b/usr/local/lib/libopenpose_producer.so new file mode 100644 index 0000000000000000000000000000000000000000..ae52a756776fd46117b504a56d999d197c7b6358 Binary files /dev/null and b/usr/local/lib/libopenpose_producer.so differ diff --git a/usr/local/lib/libopenpose_thread.so b/usr/local/lib/libopenpose_thread.so new file mode 100644 index 0000000000000000000000000000000000000000..735871256955ca470d1cc722674cfd2b083aa095 Binary files /dev/null and b/usr/local/lib/libopenpose_thread.so differ diff --git a/usr/local/lib/libopenpose_tracking.so b/usr/local/lib/libopenpose_tracking.so new file mode 100644 index 0000000000000000000000000000000000000000..5efbe3e78ba3438bcea9e987023793da5d5b16af Binary files /dev/null and b/usr/local/lib/libopenpose_tracking.so differ diff --git a/usr/local/lib/libopenpose_unity.so b/usr/local/lib/libopenpose_unity.so new file mode 100644 index 0000000000000000000000000000000000000000..72101b231492387f77468d46dc710a4cbbd6e08b Binary files /dev/null and b/usr/local/lib/libopenpose_unity.so differ diff --git a/usr/local/lib/libopenpose_utilities.so b/usr/local/lib/libopenpose_utilities.so new file mode 100644 index 0000000000000000000000000000000000000000..2f6562f7948d4e41960cf933ccfb25c282ed6c9d Binary files /dev/null and b/usr/local/lib/libopenpose_utilities.so differ diff --git a/usr/local/lib/libopenpose_wrapper.so b/usr/local/lib/libopenpose_wrapper.so new file mode 100644 index 0000000000000000000000000000000000000000..24d211de10e18aeea44239afc4980548db2b5293 Binary files /dev/null and b/usr/local/lib/libopenpose_wrapper.so differ