diff --git a/src/mlpack/methods/ann/CMakeLists.txt b/src/mlpack/methods/ann/CMakeLists.txt index 3b7ee5b79f..fb1101ec11 100644 --- a/src/mlpack/methods/ann/CMakeLists.txt +++ b/src/mlpack/methods/ann/CMakeLists.txt @@ -14,7 +14,6 @@ add_subdirectory(layer) add_subdirectory(loss_functions) add_subdirectory(convolution_rules) add_subdirectory(regularizer) -# add_subdirectory(reduction_rules) # Add directory name to sources. set(DIR_SRCS) diff --git a/src/mlpack/methods/ann/reduction_rules/CMakeLists.txt b/src/mlpack/methods/ann/reduction_rules/CMakeLists.txt deleted file mode 100644 index 4af5f9bfce..0000000000 --- a/src/mlpack/methods/ann/reduction_rules/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Define the files we need to compile -# Anything not in this list will not be compiled into mlpack. -set(SOURCES - add_reduction.hpp -) - -# Add directory name to sources. -set(DIR_SRCS) -foreach(file ${SOURCES}) - set(DIR_SRCS ${DIR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/${file}) -endforeach() -# Append sources (with directory name) to list of all mlpack sources (used at -# the parent scope). -set(MLPACK_SRCS ${MLPACK_SRCS} ${DIR_SRCS} PARENT_SCOPE) diff --git a/src/mlpack/methods/ann/reduction_rules/add_reduction.hpp b/src/mlpack/methods/ann/reduction_rules/add_reduction.hpp deleted file mode 100644 index 2122b66c13..0000000000 --- a/src/mlpack/methods/ann/reduction_rules/add_reduction.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @file methods/ann/reduction_rules/add_reduction.hpp - * @author Shubham Agrawal - * - * Reduction of a given network with add reduction rule. - * - * mlpack is free software; you may redistribute it and/or modify it under the - * terms of the 3-clause BSD license. You should have received a copy of the - * 3-clause BSD license along with mlpack. If not, see - * http://www.opensource.org/licenses/BSD-3-Clause for more information. - */ -#ifndef MLPACK_METHODS_ANN_REDUCTION_RULES_ADD_REDUCTION_HPP -#define MLPACK_METHODS_ANN_REDUCTION_RULES_ADD_REDUCTION_HPP - -#include -#include - -namespace mlpack { -namespace ann /** Artificial Neural Network. */ { - -/** - * This class is used to reduce the network with the add reduction rule. - * @tparam MatType Type of matrix used. - */ -template -class AddReductionType -{ - public: - /** - * Reduce the specified network and store the results in the given - * parameter. - * - * @param layerOutputs Network output that should be reduced. - * @param output The network output. - */ - void Reduce(const std::vector& layerOutputs, - MatType& output) - { - output.zeros(); - for (size_t i = 0; i < layerOutputs.size(); i++) - { - output += layerOutputs[i]; - } - } - - /** - * Reduce the specified network and store the results in the given - * parameter. - * - * @param input Network layer wise delta output. - * @param networkSize The network size. - * @param layerDeltas The network deltas output. - */ - void UnReduce( - const MatType& input, - const size_t networkSize, - std::vector& layerDeltas) - { - layerDeltas.resize(networkSize, MatType()); - for (size_t i = 0; i < networkSize; i++) - { - layerDeltas[i] = input; - } - } - - std::vector ReduceSize( - const std::vector*>& network) - { - if (network.size() == 0) - { - return std::vector(); - } - else if (network.size() == 1) - { - return network[0]->OutputDimensions(); - } - const std::vector networkSize = network[0]->OutputDimensions(); - for (size_t i = 1; i < network.size(); i++) - { - if (!(networkSize == network[i]->OutputDimensions())) - { - Log::Fatal << "Network size mismatch. (" << networkSize[0] << ", " - << networkSize[1] << ") != (" - << network[i]->OutputDimensions()[0] << ", " << network[i]->OutputDimensions()[1] - << ")." << std::endl; - } - } - return networkSize; - } -}; // class AddReduction - -typedef AddReductionType AddReduction; - -} // namespace ann -} // namespace mlpack - -#endif