geopm 3.1.1.dev410+g40bf96ed
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
NNFactory.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef NNFACTORY_HPP_INCLUDE
7#define NNFACTORY_HPP_INCLUDE
8
9#include <memory>
10#include <vector>
11
12#include "DenseLayer.hpp"
13#include "LocalNeuralNet.hpp"
14#include "TensorOneD.hpp"
15#include "TensorTwoD.hpp"
16
17namespace geopm
18{
21 class NNFactory {
22 public:
25 static std::unique_ptr<NNFactory> make_unique();
28 static std::shared_ptr<NNFactory> make_shared();
29 virtual ~NNFactory() = default;
35 virtual std::shared_ptr<LocalNeuralNet> createLocalNeuralNet(const std::vector<std::shared_ptr<DenseLayer> > &layers) const = 0;
43 virtual std::shared_ptr<DenseLayer> createDenseLayer(const TensorTwoD &weights, const TensorOneD &biases) const = 0;
49 virtual TensorTwoD createTensorTwoD(const std::vector<std::vector<double> > &vals) const = 0;
55 virtual TensorOneD createTensorOneD(const std::vector<double> &vals) const = 0;
56 };
57}
58
59#endif // NNFACTORY_HPP_INCLUDE
Class to generate objects related to feed-forward neural nets, i.e. TensorOneD, TensorTwoD,...
Definition NNFactory.hpp:21
virtual ~NNFactory()=default
virtual std::shared_ptr< LocalNeuralNet > createLocalNeuralNet(const std::vector< std::shared_ptr< DenseLayer > > &layers) const =0
Create a LocalNeuralNet.
virtual TensorOneD createTensorOneD(const std::vector< double > &vals) const =0
Create a TensorOneD object.
static std::unique_ptr< NNFactory > make_unique()
Returns a unique pointer to a concrete object constructed using the underlying implementation.
Definition NNFactory.cpp:14
virtual std::shared_ptr< DenseLayer > createDenseLayer(const TensorTwoD &weights, const TensorOneD &biases) const =0
Create a Dense Layer.
virtual TensorTwoD createTensorTwoD(const std::vector< std::vector< double > > &vals) const =0
Create a TensorTwoD object.
static std::shared_ptr< NNFactory > make_shared()
Returns a shared pointer to a concrete object constructed using the underlying implementation.
Definition NNFactory.cpp:19
Class to store and perform operations on 1D Tensors, aka vectors, suitable for use in feed-forward ne...
Definition TensorOneD.hpp:21
Class to manage data and operations related to 2D Tensors required for neural net inference.
Definition TensorTwoD.hpp:22
Definition Accumulator.cpp:12