class MXNet::Gluon::NN::Sequential
- MXNet::Gluon::NN::Sequential
- MXNet::Gluon::Block
- Reference
- Object
Overview
Stacks blocks sequentially.
net = MXNet::Gluon::NN::Sequential.new
net.with_name_scope do
net.add(MXNet::Gluon::NN::Dense.new(10, activation: :relu))
net.add(MXNet::Gluon::NN::Dense.new(20))
end
Defined in:
mxnet/gluon/nn/layers.crConstructors
-
.new(**kwargs)
Creates a new instance.
Instance Method Summary
-
#[](index)
Returns the block at the specified index.
-
#[]?(index)
Returns the block at the specified index.
-
#add(*blocks)
Adds blocks on top of the stack.
-
#forward(inputs : Array(T)) : Array(T) forall T
Runs a forward pass on all child blocks.
-
#size
Returns the number of blocks in the sequential stack.
Instance methods inherited from class MXNet::Gluon::Block
call(inputs : Array(T)) : Array(T) forall T
call,
children
children,
collect_params(selector = nil)
collect_params,
forward(inputs : Array(T)) : Array(T) forall T
forward,
get_attr(name : String) : Block | Parameter | Nil
get_attr,
hybridize(active = true)
hybridize,
init(init = nil, ctx = nil, force_reinit = false)
init,
load_parameters(fname, ctx = MXNet.cpu, allow_missing = false, ignore_extra = false)
load_parameters,
params : MXNet::Gluon::ParameterDict
params,
prefix : String
prefix,
register_child(block, name = nil)
register_child,
register_parameter(param, name = nil)
register_parameter,
save_parameters(fname)
save_parameters,
scope : MXNet::Gluon::BlockScope?
scope,
set_attr(name : String, value : Block | Parameter | Nil)
set_attr,
with_name_scope(&)
with_name_scope
Constructor methods inherited from class MXNet::Gluon::Block
new(prefix = nil, params = nil)
new
Constructor Detail
Instance Method Detail
def [](index)
#
Returns the block at the specified index.
Raises IndexError
if the index is out of bounds.
def []?(index)
#
Returns the block at the specified index.
Returns nil
if the index is out of bounds.
def forward(inputs : Array(T)) : Array(T) forall T
#