NAME

AI::MXNet::Engine - Allows management of properties of the MXNet's engine.

SYNOPSIS

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_bulk_size

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

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;
    }
});