class chainer.links.SimplifiedDropconnect(in_size, out_size, ratio=0.5, nobias=False, initialW=None, initial_bias=None)[source]¶
Fully-connected layer with simplified dropconnect regularization.
This implementation cannot be used for reproduction of the paper.
There is a difference between the current implementation and the
The original version uses sampling with gaussian distribution before
passing activation function, whereas the current implementation averages
in_size (int) – Dimension of input vectors. If None, parameter
initialization will be deferred until the first forward data pass
at which time the size will be determined.
x (chainer.Variable or numpy.ndarray or cupy.ndarray) – Batch of input vectors. Its first dimension n is assumed
to be the minibatch dimension.
train (bool) – If True, executes simplified dropconnect.
Otherwise, simplified dropconnect link works as a linear unit.
mask (None or chainer.Variable or numpy.ndarray or cupy.ndarray) – If None, randomized simplified dropconnect mask is
generated. Otherwise, The mask must be (n,M,N) or
(M,N) shaped array, and use_batchwise_mask is ignored.
Main purpose of this option is debugging.
mask array will be used as a dropconnect mask.
use_batchwise_mask (bool) – If True, dropped connections depend on each sample in
The latter is easier for IDEs to keep track of the attribute’s
name (str) – Name of the parameter. This name is also used as the
shape (int or tuple of ints) – Shape of the parameter array. If it
is omitted, the parameter variable is left uninitialized.
dtype – Data type of the parameter array.
initializer – If it is not None, the data is initialized with
the given initializer. If it is an array, the data is directly
initialized by it. If it is callable, it is used as a weight
initializer. Note that in these cases, dtype argument is
The whole hierarchy rooted by this link is copied. The copy is
basically shallow, except that the parameter variables are also
shallowly copied. It means that the parameter variables of copied one
are different from ones of original link, while they share the data and
The name of the link is reset on the copy, since the copied instance
does not belong to the original parent chain (even if exists).
This method returns a context manager object that enables registration
of parameters (and links for Chain) by an assignment.
A Parameter object can be automatically registered
by assigning it to an attribute under this context manager.
In most cases, the parameter registration is done in the
initializer method. Using the init_scope method, we can
simply assign a Parameter object to register
it to the link.
Registers an attribute of a given name as a persistent value.
This is a convenient method to register an existing attribute as a
persistent value. If name has been already registered as a
parameter, this method removes it from the list of parameter names
and re-registers it as a persistent value.
name (str) – Name of the attribute to be registered.