57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "Neuron.h"
|
|
|
|
#include <SimpleJSON/SerializableObject.h>
|
|
|
|
#include <cstddef>
|
|
#include <vector>
|
|
|
|
#define NEURAL_NETWORK_INIT() const static bool ______TMP= NeuralNetwork::Network::loaded()
|
|
|
|
namespace NeuralNetwork
|
|
{
|
|
|
|
/**
|
|
* @author Tomas Cernik (Tom.Cernik@gmail.com)
|
|
* @brief Abstract model of simple Network
|
|
*/
|
|
class Network : public SimpleJSON::SerializableObject
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Constructor for Network
|
|
*/
|
|
inline Network() {
|
|
loaded();
|
|
};
|
|
|
|
/**
|
|
* @brief Virtual destructor for Network
|
|
*/
|
|
virtual ~Network() {};
|
|
|
|
/**
|
|
* @brief This is a virtual function for all networks
|
|
* @param input is input of network
|
|
* @returns output of network
|
|
*/
|
|
virtual std::vector<float> computeOutput(const std::vector<float>& input)=0;
|
|
|
|
/**
|
|
* @param t is number of threads, if set to 0 or 1 then threading is disabled
|
|
* @brief Enables or disables Threaded computing of ANN
|
|
*/
|
|
|
|
inline virtual void setThreads(const unsigned& t) final {threads=t;}
|
|
|
|
protected:
|
|
/**
|
|
* @brief Number of threads used by network
|
|
*/
|
|
unsigned threads=1;
|
|
|
|
public:
|
|
static bool loaded();
|
|
};
|
|
} |