Convolution

/// Parametric chains convolution operator

Constructors

this
this(int nInput, int nOutput, int[dim] kernel, bool useBias)
this
this(int nInput, int nOutput, int[dim] kernel, int[dim] stride, int[dim] pad, int[dim] dilation, bool useBias)

Members

Functions

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

pytorch style init (LeCun uniform init)

Variables

bias
Variable!(T, dim + 2, Storage) bias;
dilation
int[dim] dilation;
Undocumented in source.
kernel
int[dim] kernel;
Undocumented in source.
nInput
int nInput;
nOutput
int nOutput;
pad
int[dim] pad;
stride
int[dim] stride;
Undocumented in source.
useBias
bool useBias;
Undocumented in source.
weight
Variable!(T, dim + 2, Storage) weight;
Undocumented in source.

Examples

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

auto conv = Convolution!(float, 2, HostStorage)(3, 4, [3, 3]);
auto x = uniform!float(2, 3, 4, 4).slice.variable(true);
auto y = conv(x);
auto gy = uniform!float(y.shape.castArray!size_t).slice.variable;
gradCheckChain!conv(x, gy, 1e-3, 5e-2, 5e-2);

Meta