geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
DenseLayer.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 DENSELAYER_HPP_INCLUDE
7 #define DENSELAYER_HPP_INCLUDE
8 
9 #include "TensorOneD.hpp"
10 
11 namespace geopm
12 {
13  class TensorTwoD;
14 
18  class DenseLayer
19  {
20  public:
33  static std::unique_ptr<DenseLayer> make_unique(const TensorTwoD &weights,
34  const TensorOneD &biases);
35  virtual ~DenseLayer() = default;
44  virtual TensorOneD forward(const TensorOneD &input) const = 0;
48  virtual size_t get_input_dim() const = 0;
52  virtual size_t get_output_dim() const = 0;
53 
54  TensorOneD operator()(const TensorOneD &input) const;
55  };
56 }
57 
58 #endif /* DENSELAYER_HPP_INCLUDE */
Class to store dense layers and perform operations on the layers' 1D and 2D Tensors,...
Definition: DenseLayer.hpp:19
virtual TensorOneD forward(const TensorOneD &input) const =0
Perform inference using the instance weights and biases.
virtual ~DenseLayer()=default
static std::unique_ptr< DenseLayer > make_unique(const TensorTwoD &weights, const TensorOneD &biases)
Returns a unique_ptr to a concrete object constructed using the underlying implementation from an pai...
Definition: DenseLayer.cpp:17
virtual size_t get_input_dim() const =0
Get the dimension required for the input TensorOneD.
virtual size_t get_output_dim() const =0
Get the dimension of the resulting TensorOneD.
TensorOneD operator()(const TensorOneD &input) const
Definition: DenseLayer.cpp:23
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