21 #include "../gpu/linear_mapping.h"
89 std::map<std::string, std::string>
serialize()
const;
A key-value pair set storing pieces of arbitrary data (chunks) under string keys.
Basic class: task and memory management, any kind of static data.
Evaluates expression A*x + b = y for a matrix A and vectors x and b using GPU.
Stores linked GLSL programs and their associated fragment shader codes.
Real-valued vector usable by GPU.
Format
Vector data format.
Internal low-level GPU control API.
Abstract neural net operation (layer).
static const char * BIAS_CHUNK_SUFFIX
suffix added to the op name to get the bias chunk id in the model data
GL::Vector * outputVector
pointer to the output vector
GL::Vector * inputVector
if not null, points the input vector x; otherwise the input is a storage view
int getInputCount() const
Returns number of operation inputs.
void setInput(Storage::View &&view, int index=0)
static const char * MATRIX_CHUNK_SUFFIX
suffix added to the op name to get the matrix chunk id in the model data
void setOutput(GL::Vector &vector, int index=0)
Size getOutputSize(int outputIndex=0) const
Returns full size of a specific operation output.
unsigned long countMultiplyAdds() const
Counts (approximate) number of multiply-adds used by this operation.
GL::Vector::Format getOutputVectorFormat() const
unsigned long countTexelFetches() const
Counts (approximate) number of texels fetches.
void getOutput(GL::Vector *&, int index=0)
Returns a GL::Vector bound to a specific operation output.
Storage::View inputStorage
if not empty, contains the input features; otherwise the input is a GL vector
bool acceptsVectorInput(int index=0) const
Returns true if the operation can take a GL::Vector at a specific input.
void getSampledChannels(int index, int &min, int &max) const
Retrieves range of input features channels sampled at the same time for a specific input.
std::map< std::string, std::string > serialize() const
Returns a serialized representation of th operation;.
static bool initDeserializer()
Sets up deserialization of the operation.
void execute(TaskThread &thread, GraphicPipeline &gpu)
Executes the operation.
Dense(Context &context, const std::string &name, int numOutputDims, bool useBias)
Creates a Dense operation.
const bool useBias
if true, the bias vector b is searched in the model data to add to the output
int getOutputCount() const
Returns number of operation outputs.
const int numOutputDims
output feature vector size / number of rows in A
bool acceptsStorageInput(int index=0) const
Returns true if the operation can take a Storage::View at a specific input.
void prepare(GraphicPipeline &gpu, ChunkCollection &data, GL::ProgramBank &bank)
Compiles GLSL shaders.
bool acceptsVectorOutput(int index=0) const
Returns true if the operation can take a GL::Vector at a specific output.
void disconnect()
Assigns empty inputs and outputs.
Operation 3D input/output size.
Maps a 3D tensor onto a storage.
static const bool DENSE_OP_DESERIALIZABLE
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
CustomPoint< numeric > max(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)