Linear

linear operator

Constructors

this
this(int nInput, int nOutput, bool useBias)
Undocumented in source.

Members

Functions

opCall
auto opCall(Variable!(T, 2, Storage) x)
Undocumented in source. Be warned that the author may not have intended to support it.
resetParameters
void resetParameters()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

bias
Variable!(T, 1, Storage) bias;
Undocumented in source.
nInput
int nInput;
nOutput
int nOutput;
Undocumented in source.
useBias
bool useBias;
Undocumented in source.
weight
Variable!(T, 2, Storage) weight;
Undocumented in source.

Examples

import grain.testing;
import grain.utility;
import numir;
import mir.ndslice;

auto f = Linear!(float, HostStorage)(2, 3);
auto x = uniform!float(2, 2).slice.variable(true);
auto y = f(x);
auto gy = uniform!float(y.shape.castArray!size_t).slice.variable;
gradCheckChain!f(x, gy, 1e-3, 5e-2, 5e-2);

Meta