Standard fully-connected block of weights. Often followed by a GBlockActivation.
|
| GBlockLinear (size_t outputs, size_t inputs=0) |
|
| GBlockLinear (GDomNode *pNode) |
|
virtual void | backProp (GContext &ctx, const GVec &input, const GVec &output, const GVec &outBlame, GVec &inBlame) const override |
| Evaluates outBlame, and adds to inBlame. (Note that it "adds to" the inBlame because multiple blocks may fork from a common source.) More...
|
|
void | backProp2 (const GVec &outBlame, GVec &inBlame1, GVec &inBlame2) const |
| A convenience method that mirrors forwardProp2. More...
|
|
GVec & | bias () |
| Returns the bias vector of this block. More...
|
|
const GVec & | bias () const |
| Returns the bias vector of this block. More...
|
|
void | contractWeights (double factor, bool contractBiases, const GVec &output) |
| Applies contractive regularization to the weights in this block. More...
|
|
virtual void | copyWeights (const GBlock *pSource) override |
| Copy the weights from pSource to this block. (Assumes pSource is the same type of block.) More...
|
|
virtual void | diminishWeights (double amount, bool regularizeBiases) override |
| Moves all weights in the direction of zero by the specified amount. More...
|
|
void | dropInput (size_t input) |
| Drops an input from this block. More...
|
|
void | dropOutput (size_t output) |
| Drops an output from this block. More...
|
|
virtual void | forwardProp (GContext &ctx, const GVec &input, GVec &output) const override |
| Evaluate the input, set the output. More...
|
|
void | forwardProp2 (const GVec &in1, const GVec &in2, GVec &output) const |
| A convenience method that concatenates two vectors before feeding into this block. More...
|
|
virtual size_t | inputs () const override |
| Returns the number of inputs this block consumes. More...
|
|
virtual void | maxNorm (double min, double max) override |
| Scales weights if necessary such that the manitude of the weights (not including the bias) feeding into each unit are >= min and <= max. More...
|
|
virtual std::string | name () const override |
| Returns the name of this block. More...
|
|
virtual size_t | outputs () const override |
| Returns the number of outputs this block produces. More...
|
|
virtual void | perturbWeights (GRand &rand, double deviation) override |
| Perturbs the weights that feed into the specifed units with Gaussian noise. The default values apply the perturbation to all units. More...
|
|
void | renormalizeInput (size_t input, double oldMin, double oldMax, double newMin=0.0, double newMax=1.0) |
| Adjusts weights such that values in the new range will result in the same behavior that previously resulted from values in the old range. More...
|
|
virtual void | resetWeights (GRand &rand) override |
| Initialize the weights with small random values. More...
|
|
virtual void | resize (size_t inputs, size_t outputs) override |
| Resizes this block. More...
|
|
virtual void | scaleWeights (double factor, bool scaleBiases) override |
| Multiplies all the weights by the specified factor. More...
|
|
virtual GDomNode * | serialize (GDom *pDoc) const override |
| Marshall this block into a DOM. More...
|
|
virtual void | step (double learningRate, const GVec &gradient) override |
| Add the weight and bias gradient to the weights. More...
|
|
void | transformWeights (GMatrix &transform, const GVec &offset) |
| Transforms the weights of this block by the specified transformation matrix and offset vector. transform should be the pseudoinverse of the transform applied to the inputs. pOffset should be the negation of the offset added to the inputs after the transform, or the transformed offset that is added before the transform. More...
|
|
virtual BlockType | type () const override |
| Returns the type of this block. More...
|
|
virtual void | updateGradient (GContext &ctx, const GVec &input, const GVec &outBlame, GVec &gradient) const override |
| Updates the gradient for updating the weights by gradient descent. (Assumes the error has already been computed and deactivated.) More...
|
|
void | updateGradient2 (const GVec &in1, const GVec &in2, const GVec &outBlame, GVec &gradient) const |
| A convenience method that goes with forwardProp2 and backProp2. More...
|
|
virtual size_t | vectorToWeights (const double *pVector) override |
| Deserialize from a vector to the weights in this block. Return the number of elements consumed. More...
|
|
virtual size_t | weightCount () const override |
| Returns the number of double-precision elements necessary to serialize the weights of this block into a vector. More...
|
|
GMatrix & | weights () |
| Get the entire weights matrix. More...
|
|
const GMatrix & | weights () const |
| Get the entire weights matrix. More...
|
|
virtual size_t | weightsToVector (double *pOutVector) const override |
| Serialize the weights in this block into a vector. Return the number of elements written. More...
|
|
| GBlock () |
|
| GBlock (GDomNode *pNode) |
|
virtual | ~GBlock () |
|
virtual bool | elementWise () const |
| Returns true iff this block operates only on individual elements. More...
|
|
size_t | inPos () const |
| Returns the offset in the previous layer's output where values are fed as input to this block. More...
|
|
virtual bool | isRecurrent () const |
| Returns true iff this block is recurrent. More...
|
|
void | setInPos (size_t n) |
| Sets the starting offset in the previous layer's output where values will be fed as input to this block. More...
|
|
virtual std::string | to_str () const |
| Returns a string representation of this block. More...
|
|
virtual bool | usesGPU () |
| Returns true iff this block does its computations in parallel on a GPU. More...
|
|