class MXNet::Gluon::HybridBlock
- MXNet::Gluon::HybridBlock
- MXNet::Gluon::Block
- Reference
- Object
Overview
HybridBlock
supports forwarding with both Symbol
and
NDArray
.
Included Modules
Direct Known Subclasses
- MXNet::Gluon::Loss
- MXNet::Gluon::NN::Activation
- MXNet::Gluon::NN::Dense
- MXNet::Gluon::NN::Flatten
- MXNet::Gluon::NN::HybridSequential
- MXNet::Gluon::NN::Internal::Conv
- MXNet::Gluon::NN::Internal::Pooling
Defined in:
mxnet/gluon/block.crInstance Method Summary
-
#export(filename, epoch = 0)
Exports model and parameters in a format that can be loaded by
SymbolBlock.import
. -
#forward(inputs : Array(T)) : Array(T) forall T
Defines the forward computation.
-
#hybrid_forward(inputs : Array(T), params : Hash(String, T) = {} of String => T) : Array(T) forall T
Override to construct symbolic graph for this
HybridBlock
. -
#hybridize(active = true, flags = {} of String => String)
Activates or deactivates
HybridBlock
children recursively. -
#register_child(block, name = nil)
Registers block as a child of self.
Instance methods inherited from module MXNet::Gluon::CachedGraph
clear_cache
clear_cache,
infer_dtype(args)
infer_dtype,
infer_shape(args)
infer_shape
Constructor methods inherited from module MXNet::Gluon::CachedGraph
new(**kwargs)
new
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
Instance Method Detail
def export(filename, epoch = 0)
#
Exports model and parameters in a format that can be loaded by
SymbolBlock.import
.
Parameters
- filename (
String
) Path and base filename to which to save model and parameters. Two files, "[filename]-symbol.json" and "[filename]-NNNN.params" will be created, whereNNNN
is the 4 digit epoch number. - epoch (
Integer
, default =0
) Epoch number of saved model.
def forward(inputs : Array(T)) : Array(T) forall T
#
def hybrid_forward(inputs : Array(T), params : Hash(String, T) = {} of String => T) : Array(T) forall T
#
Override to construct symbolic graph for this HybridBlock
.
Parameters
Activates or deactivates HybridBlock
children
recursively.
Parameters
- active (
Bool
, default =true
) Whether to turn hybridization on or off.
def register_child(block, name = nil)
#
Description copied from class MXNet::Gluon::Block
Registers block as a child of self. Blocks assigned as attributes will be registered automatically.