AI-MXNet
view release on metacpan or search on metacpan
lib/AI/MXNet/Executor/Group.pm view on Meta::CPAN
206207208209210211212213214215216217218219220221222223224225226
symbol
with
the same set of parameters (e.g. unrolled RNNs
with
different lengths).
In this case the memory regions of the parameters will be shared.
logger : Logger
Default is AI::MXNet::Logging->get_logger.
fixed_param_names: Maybe[ArrayRef[Str]]
Indicate parameters to be fixed during training. Parameters in this array
ref
will not allocate
space
for
gradient, nor
do
gradient calculation.
grad_req : ArrayRef[GradReq]|HashRef[GradReq]|GradReq
Requirement
for
gradient accumulation. Can be
'write'
,
'add'
, or
'null'
(
default
to
'write'
).
Can be specified globally (str) or
for
each
argument (array
ref
, hash
ref
).
state_names: Maybe[ArrayRef[Str]]
=cut
has 'symbol' => (is => 'ro', isa => 'AI::MXNet::Symbol', required => 1);
has 'contexts' => (is => 'ro', isa => 'ArrayRef[AI::MXNet::Context]', required => 1);
has 'workload' => (is => 'ro', isa => 'ArrayRef[Num]', default => sub { [] });
has 'data_shapes' => (is => 'rw', isa => 'ArrayRef[NameShape|AI::MXNet::DataDesc]', required => 1);
has 'label_shapes' => (is => 'rw', isa => 'Maybe[ArrayRef[NameShape|AI::MXNet::DataDesc]]');
has 'param_names' => (is => 'ro', isa => 'ArrayRef[Str]', required => 1);
has 'for_training' => (is => 'ro', isa => 'Bool', required => 1);
lib/AI/MXNet/Module/Base.pm view on Meta::CPAN
979980981982983984985986987988989990991992993994995996997998999
:
$force_rebind
=0 : Bool
Default is 0. This function does nothing
if
the executors are already
binded. But
with
this as 1, the executors will be forced to rebind.
:
$shared_module
= : A subclass of AI::MXNet::Module::Base
Default is
undef
. This is used in bucketing. When not
undef
, the shared module
essentially corresponds to a different bucket -- a module
with
different symbol
but
with
the same sets of parameters (e.g. unrolled RNNs
with
different lengths).
:
$grad_req
=
'write'
: Str|ArrayRef[Str]|HashRef[Str]
Requirement
for
gradient accumulation. Can be
'write'
,
'add'
, or
'null'
(defaults to
'write'
).
Can be specified globally (str) or
for
each
argument (array
ref
, hash
ref
).
=cut
method bind(
ArrayRef[AI::MXNet::DataDesc] $data_shapes,
Maybe[ArrayRef[AI::MXNet::DataDesc]] :$label_shapes=,
Bool :$for_training=1,
Bool :$inputs_need_grad=0,
Bool :$force_rebind=0,
Maybe[AI::MXNet::BaseModule] :$shared_module=,
Str|ArrayRef[Str]|HashRef[Str] :$grad_req='write'
lib/AI/MXNet/Module/Bucketing.pm view on Meta::CPAN
293294295296297298299300301302303304305306307308309310311312313
Default is 1.
:
$inputs_need_grad
: Bool
Default is 0.
:
$force_rebind
: Bool
Default is 0.
:
$shared_module
: AI::MXNet::Module::Bucketing
Default is
undef
. This value is currently not used.
:
$grad_req
: str, array
ref
of str, hash
ref
of str to str
Requirement
for
gradient accumulation. Can be
'write'
,
'add'
, or
'null'
(defaults to
'write'
).
Can be specified globally (str) or
for
each
argument (array
ref
, hash
ref
).
:
$bucket_key
: str
=cut
method bind(
ArrayRef[AI::MXNet::DataDesc|NameShape] :$data_shapes,
Maybe[ArrayRef[AI::MXNet::DataDesc|NameShape]] :$label_shapes=,
Bool :$for_training=1,
Bool :$inputs_need_grad=0,
Bool :$force_rebind=0,
lib/AI/MXNet/Rtc.pm view on Meta::CPAN
262728293031323334353637383940414243444546
list of output names and ndarray
kernel : str
the actual kernel code.
Note that this is only the body of the kernel, i.e.
after
{ and
before
}. Rtc will decorate the kernel.
For example,
if
name =
"mykernel"
and
inputs = [(
'x'
, mx.nd.zeros((10,)))]
outputs = [(
'y'
, mx.nd.zeros((10,)))]
kernel =
"y[threadIdx.x] = x[threadIdx.x];"
,
the kernel that is compile will be:
extern
"C"
__global__ mykernel(float
*x
, float
*y
) {
const
int
x_ndim = 1;
const
int
x_dims = { 10 };
const
int
y_ndim = 1;
const
int
y_dims = { 10 };
y[threadIdx.x] = x[threadIdx.x];
}
=cut
has 'handle' => (is => 'rw', isa => 'RtcHandle', init_arg => undef);
t/test_symbol.t view on Meta::CPAN
368369370371372373374375376377378379380381382383384385386387388
"inputs"
: [],
"backward_source_id"
: -1,
"attr"
: {
"ctx_group"
:
"stage2"
}
},
{
"op"
:
"BatchNorm"
,
"param"
: {
"eps"
:
"0.001"
,
"fix_gamma"
:
"True"
,
"momentum"
:
"0.9"
,
"use_global_stats"
:
"False"
},
"name"
:
"batchnorm0"
,
"inputs"
: [[11, 0], [12, 0], [13, 0]],
"backward_source_id"
: -1,
"attr"
: {
"ctx_group"
:
"stage2"
}
},
{
"op"
:
"null"
,
"param"
: {},
"name"
:
"softmax_label"
,
( run in 0.492 second using v1.01-cache-2.11-cpan-95122f20152 )