<commit_before>//=======================================================================
// Copyright (c) 2014 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#ifndef DLL_PATCHES_LAYER_INL
#define DLL_PATCHES_LAYER_INL

namespace dll {

/*!
 * \brief Layer to cut images into patches.
 */
template<typename Desc>
struct patches_layer {
    using desc = Desc;

    static constexpr const std::size_t width = desc::width;
    static constexpr const std::size_t height = desc::height;
    static constexpr const std::size_t v_stride = desc::v_stride;
    static constexpr const std::size_t h_stride = desc::h_stride;

    using weight = double; //TODO Should be made configurable

    using input_deep_t = etl::dyn_matrix<weight, 3>;
    using output_deep_t= etl::dyn_matrix<weight, 3>;

    using input_one_t = etl::dyn_matrix<weight, 3>;
    using input_t = std::vector<input_one_t>;

    using output_one_t = std::vector<etl::dyn_matrix<weight, 3>>;
    using output_t = std::vector<output_one_t>;

    patches_layer() = default;

    static std::string to_short_string(){
        return "patches";
    }

    static void display(){
        std::cout << to_short_string() << std::endl;
    }

    static constexpr std::size_t output_size() noexcept {
        return width * height;
    }

    //TODO Ideally, the dbn should guess if h_a/h_s are used or only h_a

    static void activate_one(const input_one_t& input, output_one_t& h_a){<commit_msg>Better description<commit_after>//=======================================================================
// Copyright (c) 2014 <NAME>
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
//  http://opensource.org/licenses/MIT)
//=======================================================================

#ifndef DLL_PATCHES_LAYER_INL
#define DLL_PATCHES_LAYER_INL

namespace dll {

/*!
 * \brief Layer to cut images into patches.
 */
template<typename Desc>
struct patches_layer {
    using desc = Desc;

    static constexpr const std::size_t width = desc::width;
    static constexpr const std::size_t height = desc::height;
    static constexpr const std::size_t v_stride = desc::v_stride;
    static constexpr const std::size_t h_stride = desc::h_stride;

    using weight = double; //TODO Should be made configurable

    using input_deep_t = etl::dyn_matrix<weight, 3>;
    using output_deep_t= etl::dyn_matrix<weight, 3>;

    using input_one_t = etl::dyn_matrix<weight, 3>;
    using input_t = std::vector<input_one_t>;

    using output_one_t = std::vector<etl::dyn_matrix<weight, 3>>;
    using output_t = std::vector<output_one_t>;

    patches_layer() = default;

    static std::string to_short_string(){
        char buffer[1024];
        snprintf(buffer, 1024, "Patches -> (%lu:%lux%lu:%lu)", height, v_stride, width, h_stride);
        return {buffer};
    }

    static void display(){
        std::cout << to_short_string() << std::endl;
    }

    static constexpr std::size_t output_size() noexcept {
        return width * height;
    }

    //TODO Ideally, the dbn should guess if h_a/h_s are used or only h_a

    static void activate_one(const input_one_t& input, output_one_t& h_a){
{'fraction_non_alphanumeric': 0.1876484560570071, 'fraction_numerical': 0.007125890736342043, 'mean_word_length': 4.089123867069486, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4865984', 'n_tokens_mistral': 1079, 'n_tokens_neox': 993, 'n_words': 282}