|
| Dense (Context &context, const std::string &name, int numOutputDims, bool useBias) |
| Creates a Dense operation. More...
|
|
Size | getOutputSize (int outputIndex=0) const |
| Returns full size of a specific operation output. More...
|
|
int | getInputCount () const |
| Returns number of operation inputs. More...
|
|
int | getOutputCount () const |
| Returns number of operation outputs. More...
|
|
bool | acceptsStorageInput (int index=0) const |
| Returns true if the operation can take a Storage::View at a specific input. More...
|
|
bool | acceptsVectorInput (int index=0) const |
| Returns true if the operation can take a GL::Vector at a specific input. More...
|
|
bool | acceptsVectorOutput (int index=0) const |
| Returns true if the operation can take a GL::Vector at a specific output. More...
|
|
void | getOutput (GL::Vector *&, int index=0) |
| Returns a GL::Vector bound to a specific operation output. More...
|
|
void | setInput (Storage::View &&view, int index=0) |
|
void | setInput (GL::Vector &vector, int index=0) |
|
void | setOutput (GL::Vector &vector, int index=0) |
|
GL::Vector::Format | getOutputVectorFormat () const |
|
std::map< std::string, std::string > | serialize () const |
| Returns a serialized representation of th operation;. More...
|
|
void | disconnect () |
| Assigns empty inputs and outputs. More...
|
|
unsigned long | countMultiplyAdds () const |
| Counts (approximate) number of multiply-adds used by this operation. More...
|
|
unsigned long | countTexelFetches () const |
| Counts (approximate) number of texels fetches. More...
|
|
virtual | ~AbstractOperation () |
|
virtual bool | usesGpu () const |
| Returns true if the operation is run on GPU. More...
|
|
virtual bool | acceptsTextureInput (int index=0) const |
| Returns true if the operation can take a GL::TextureHandler at a specific input. More...
|
|
virtual bool | acceptsStorageOutput (int index=0) const |
| Returns true if the operation can take a Storage::View at a specific output. More...
|
|
virtual bool | acceptsTextureOutput (int index=0) const |
| Returns true if the operation can take a GL::TextureHandler at a specific output. More...
|
|
virtual Storage::View | getOutput (int index=0) |
| Returns a storage view bound to a specific operation output. More...
|
|
virtual void | getOutput (GL::TextureHandler *&vector, int index=0) |
| Returns a GL::TextureHandler bound to a specific operation output. More...
|
|
virtual void | setOutput (Storage::View &&storage, int index=0) |
|
virtual void | setInput (GL::TextureHandler &image, int index=0) |
|
virtual void | setOutput (GL::TextureHandler &image, int index=0) |
|
std::string | getName () const |
|
|
void | prepare (GraphicPipeline &gpu, ChunkCollection &data, GL::ProgramBank &bank) |
| Compiles GLSL shaders. More...
|
|
void | execute (TaskThread &thread, GraphicPipeline &gpu) |
| Executes the operation. More...
|
|
void | getSampledChannels (int index, int &min, int &max) const |
| Retrieves range of input features channels sampled at the same time for a specific input. More...
|
|
| LinearMapping (Context &context, bool forceFixed16=false) |
| Instantiates LinearMapping. More...
|
|
| ~LinearMapping () |
|
void | setMatrix (GraphicPipeline &gpu, const int width, const int height, const float *values) |
|
void | setBias (GraphicPipeline &gpu, const int height, const float *values) |
|
void | operator() (GraphicPipeline &gpu, TextureHandler &result, TextureHandler &input) |
|
void | prepare (GraphicPipeline &gpu, TextureHandler &output, TextureHandler &input, ProgramBank *bank=nullptr) |
| Prepares the mapping for application (builds its GPU programs). More...
|
|
void | process (GraphicPipeline &gpu, TextureHandler &output, TextureHandler &input) |
|
Dense (linear) layer.
Computes A*x + b
for input feature vector x
, a matrix A
and an optional bias vector b
. Accepts a GL::Vector or a flat Storage view on input, amd only a GL::Vector on output.
Constraints:
- Number of input channels must be a multiple of 8.
- No activation function is applied on output (not yet implemented).
The matrix and bias coefficients are searched in chunks. The chunk names consist of the operation name followed by Dense::MATRIX_CHUNK_SUFFIX and Dense::BIAS_CHUNK_SUFFIX respectively. The chunk contents is a single precision floating point array. The matrix coefficients are taken in row-major order.
Definition at line 42 of file dense.h.
void Dense::getSampledChannels |
( |
int |
index, |
|
|
int & |
min, |
|
|
int & |
max |
|
) |
| const |
|
privatevirtual |
Retrieves range of input features channels sampled at the same time for a specific input.
The operation would typically take the entire storage and sample it at once, if needed. If the number of textures in a storage exceeds the number of texture samplers that the GPU may use simultaneously, an exception occurs. This function provides the necessary information to limit the number of textures in the storage when allocating it. When the limit is reached, multiple channels are packed into a single texture in the storage.
- Parameters
-
[in] | index | The input index. Expected to fall in the valid range, i.e. from zero to getInputCount() - 1 inclusive. |
[out] | min | The minimum number of channels that can be sampled at once |
[out] | max | The maximum number of channels that can be sampled at once |
Implements Beatmup::NNets::AbstractOperation.
Definition at line 186 of file dense.cpp.
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
bool Beatmup::NNets::Dense::acceptsStorageInput |
( |
int |
index = 0 | ) |
const |
|
inlinevirtual |
Returns true
if the operation can take a Storage::View at a specific input.
Neural network operations may accept different kinds of data containers on inputs and outputs, namely Storage::View, GL::Vector and textures. This function is used to check whether a given operation accepts a storage view on input.
- Parameters
-
[in] | index | The input index. Expected to fall in the valid range, i.e. from zero to getInputCount() - 1 inclusive. |
Reimplemented from Beatmup::NNets::AbstractOperation.
Definition at line 74 of file dense.h.
74 {
return index == 0; }
bool Beatmup::NNets::Dense::acceptsVectorInput |
( |
int |
index = 0 | ) |
const |
|
inlinevirtual |
Returns true
if the operation can take a GL::Vector at a specific input.
Neural network operations may accept different kinds of data containers on inputs and outputs, namely Storage::View, GL::Vector and textures. This function is used to check whether a given operation accepts a vector on input.
- Parameters
-
[in] | index | The input index. Expected to fall in the valid range, i.e. from zero to getInputCount() - 1 inclusive. |
Reimplemented from Beatmup::NNets::AbstractOperation.
Definition at line 75 of file dense.h.
75 {
return index == 0; }
bool Beatmup::NNets::Dense::acceptsVectorOutput |
( |
int |
index = 0 | ) |
const |
|
inlinevirtual |
Returns true
if the operation can take a GL::Vector at a specific output.
Neural network operations may accept different kinds of data containers on outputs and outputs, namely Storage::View, GL::Vector and textures. This function is used to check whether a given operation accepts a vector on output.
- Parameters
-
[in] | index | The output index. Expected to fall in the valid range, i.e. from zero to getOutputCount() - 1 inclusive. |
Reimplemented from Beatmup::NNets::AbstractOperation.
Definition at line 76 of file dense.h.
76 {
return index == 0; }