<commit_before>/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#include "Layer.h"
#include "paddle/math/BaseMatrix.h"
#include "paddle/math/Matrix.h"

namespace paddle {
/**
 * @brief A layer for generate prior box locations and variances.
 * - Input: Two and only two input layer are accepted. The input layer must be
 *        be a data output layer and a convolution output layer.
 * - Output: The prior box locations and variances of the input data.
 * Reference:
 *    <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
 *    <NAME>, <NAME>. SSD: Single Shot MultiBox Detector
 */

class PriorBoxLayer : public Layer {
public:
  explicit PriorBoxLayer(const LayerConfig& config) : Layer(config) {}
  bool init(const LayerMap& layerMap, const ParameterMap& parameterMap);
  void forward(PassType passType);
  void backward(const UpdateCallback& callback) {}
  int numPriors_;
  std::vector<int> minSize_;
  std::vector<int> maxSize_;
  std::vector<real> aspectRatio_;
  std::vector<real> variance_;
  MatrixPtr buffer_;
};

bool PriorBoxLayer::init(const LayerMap& layerMap,
                         const ParameterMap& parameterMap) {
  Layer::init(layerMap, parameterMap);
  auto pbConf = config_.inputs(0).priorbox_conf();
  std::copy(pbConf.min_size().begin(),
            pbConf.min_size().end(),
            std::back_inserter(minSize_));
  std::copy(pbConf.max_size().begin(),
            pbConf.max_size().end(),
            std::back_inserter(maxSize_));
  std::copy(pbConf.aspect_ratio().begin(),
            pbConf.aspect_ratio().end(),<commit_msg>Change member variables from public to protected<commit_after>/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#include "Layer.h"
#include "paddle/math/BaseMatrix.h"
#include "paddle/math/Matrix.h"

namespace paddle {
/**
 * @brief A layer for generating priorbox locations and variances.
 * - Input: Two and only two input layer are accepted. The input layer must be
 *        be a data output layer and a convolution output layer.
 * - Output: The priorbox locations and variances of the input data.
 * Reference:
 *    <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
 *    <NAME>, <NAME>. SSD: Single Shot MultiBox Detector
 */

class PriorBoxLayer : public Layer {
public:
  explicit PriorBoxLayer(const LayerConfig& config) : Layer(config) {}
  bool init(const LayerMap& layerMap, const ParameterMap& parameterMap);

  void forward(PassType passType);
  void backward(const UpdateCallback& callback) {}

protected:
  int numPriors_;
  std::vector<int> minSize_;
  std::vector<int> maxSize_;
  std::vector<real> aspectRatio_;
  std::vector<real> variance_;
  MatrixPtr buffer_;
};

bool PriorBoxLayer::init(const LayerMap& layerMap,
                         const ParameterMap& parameterMap) {
  Layer::init(layerMap, parameterMap);
  auto pbConf = config_.inputs(0).priorbox_conf();
  std::copy(pbConf.min_size().begin(),
            pbConf.min_size().end(),
            std::back_inserter(minSize_));
  std::copy(pbConf.max_size().begin(),
            pbConf.max_size().end(),
            std::back_inserter(maxSize_));
  std::copy(pbConf.aspect_ratio().begin(),
            pbConf.aspect_ratio().end(),
{'fraction_non_alphanumeric': 0.10867515322960868, 'fraction_numerical': 0.004243281471004243, 'mean_word_length': 3.9800469483568075, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1061169', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1188, 'n_words': 422}