Linear

Linear layer accepting sparse or dense parents and outputing a dense vector.

class Linear : NeuralLayer {
float[][] W;
float[][] grad;
size_t _with_intercept;
AdditiveLinearPrior[] priors;
ProxyLinearPrior prox;
}

Inherited Members

From NeuralLayer

name
string name;
type
LayerT type;
dim_in
size_t dim_in;

total input dimension of this layer (sum of output dimensions of its parents)

dim_out
size_t dim_out;

total output dimension of this layer

children
NeuralLayer[] children;

array referencing all the children of this layer

parents
NeuralLayer[] parents;

array referencing all the parents of this layer

learnable
bool learnable [@property getter]

whether or not this layer has any parameters to be learnt

out_d
float[] out_d;

dense output vector of this layer (might be unused)

out_s
SparseF[] out_s;

sparse output vector of this layer (might be unused)

backgrads
float[][] backgrads;

array of gradients to backpropagate to parents

Examples

auto l1 = Linear(10); // 10 dense output neurons, each with an intercept
auto l2 = Linear(5, false); // 5 dense output neurons, without intercepts

Meta