AI::MXNet::Engine - Allows management of properties of the MXNet's engine.
my $x; mx->engine->bulk(10, sub { $x = mx->nd->ones([10]); $x *= 2; $x += 1; $x->wait_to_read(); $x += 1; ok(($x->aspdl == 4)->all); for my $i (1..100) { $x += 1; } }); ok(($x->aspdl == 104)->all);
Set size limit on bulk execution. Bulk execution bundles many operators to run together. This can improve performance when running a lot of small operators sequentially. Parameters ---------- $size : int Maximum number of operators that can be bundled in a bulk. Returns ------- int Previous bulk size.
Bulk execution bundles many operators to run together. This can improve performance when running a lot of small operators sequentially. Parameters ---------- $size : int Maximum number of operators that can be bundled in a bulk. $sub: CodeRef to execute my $x; mx->engine->bulk(10, sub { $x = mx->nd->zeros([1]); for my $i (1..100) { $x += 1; } });
To install AI::MXNet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::MXNet
CPAN shell
perl -MCPAN -e shell install AI::MXNet
For more information on module installation, please visit the detailed CPAN module installation guide.