class MXNet::Gluon::SymbolBlock
- MXNet::Gluon::SymbolBlock
- MXNet::Gluon::Block
- Reference
- Object
Overview
A block constructed from a Symbol
. This is useful for using
pre-trained models as feature extractors.
Included Modules
Defined in:
mxnet/gluon/block.crConstructors
-
.new(outputs, inputs, params = nil)
Creates a new instance.
Class Method Summary
-
.import(filename, inputs, epoch = 0, ctx = MXNet.cpu, allow_missing = false, ignore_extra = false)
Imports model and parameters previously saved by
HybridBlock#export
as aSymbolBlock
for use in Gluon.
Instance Method Summary
- #forward(inputs : Array(MXNet::Symbol))
- #forward(inputs : Array(MXNet::NDArray))
- #hybrid_forward(inputs : Array(T), params : Hash(String, T) = {} of String => T) : Array(T) forall T
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
Constructor Detail
def self.new(outputs, inputs, params = nil)
#
Creates a new instance.
Parameters
- outputs (
Array(Symbol)
) The desired outputs. - inputs (
Array(Symbol)
) The output's arguments that should be used as inputs. - params (
ParameterDict
, default =nil
) Dictionary of arguments and auxiliary states that are not inputs.
Class Method Detail
def self.import(filename, inputs, epoch = 0, ctx = MXNet.cpu, allow_missing = false, ignore_extra = false)
#
Imports model and parameters previously saved by
HybridBlock#export
as a SymbolBlock
for use in Gluon.
Parameters
- filename (
String
) Path and base filename from which to load model and parameters. Two files, "[filename]-symbol.json" and "[filename]-NNNN.params" will be loaded, whereNNNN
is the 4 digit epoch number. - inputs (
String
orArray(String)
) Input names. - epoch (
Integer
, default =0
) Epoch number of saved model. - ctx (
Context
orArray(Context)
, default = cpu) Context(s) to initialize loaded parameters on.
Instance Method Detail
def hybrid_forward(inputs : Array(T), params : Hash(String, T) = {} of String => T) : Array(T) forall T
#