The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

AI::MXNet::Base - Helper functions

DEFINITION

Helper functions

zip

Perl version of for x,y,z in zip (arr_x, arr_y, arr_z)
Parameters
----------
$sub_ref, called with @_ filled with $arr_x->[$i], $arr_y->[$i], $arr_z->[$i]
for each loop iteration.
@array_refs

enumerate

Same as zip, but the argument list in the anonymous sub is prepended
by the iteration count.

product

Calculates the product of the input agruments.

bisect_left

pdl_shuffle

Shuffle the pdl by the last dimension
Parameters
-----------
PDL $pdl
$preshuffle Maybe[ArrayRef[Index]], if defined the array elements are used
as shuffled last dimension's indexes

assert

Parameters
-----------
Bool $input
Str $error_str
Calls Carp::confess with $error_str//"AssertionError" if the $input is false

check_call

Checks the return value of C API call
This function will raise an exception when error occurs.
Every API call is wrapped with this function.
Returns the C API call return values stripped of first return value,
checks for return context and returns first element in
the values list when called in scalar context.

build_param_doc

Builds argument docs in python style.
arg_names : array ref of str
Argument names.
arg_types : array ref of str
Argument type information.
arg_descs : array ref of str
Argument description information.
remove_dup : boolean, optional
Whether to remove duplication or not.
Returns
-------
docstr : str
Python docstring of parameter sections.

_notify_shutdown

Notify MXNet about shutdown.