NAME

AI::MXNet::NDArray - Multidimensional tensor object of MXNet.

aspdl

Returns a copied PDL array of current array.

Returns ------- array : PDL A copy of the array content.

asmpdl

Returns copied PDL::Matrix objectt of current array.

Requires caller to "use PDL::Matrix" in user space. Returns ------- array : PDL::Matrix A copy of array content.

_slice

Returns sliced NDArray that shares memory with the current one.

Parameters ---------- start : int Starting index of slice. stop : int Finishing index of slice.

_at

Returns a sub NDArray that shares memory with current one.

Parameters ---------- idx : int index of the sub array.

reshape

Returns a reshaped NDArray that shares the memory with current one.

Parameters ---------- new_shape : Shape new shape of NDArray

Broadcasting the current NDArray into the given shape.

Parameters --------- Shape $shape : the shape to broadcast

wait_to_read

Block until all pending write operations on the NDArray are finished.

This function will return when all the pending writes to the current NDArray are finished. There can be pending reads going on when the function returns.

shape

Get the shape of current NDArray.

Returns ------- an array ref representing the shape of current ndarray

size

Number of elements in the array.

context

The context of the NDArray.

Returns ------- $context : AI::MXNet::Context

dtype

The data type of current NDArray.

Returns ------- a data type string ('float32', 'float64', 'float16', 'uint8', 'int32') representing the data type of the ndarray. 'float32' is the default dtype for the ndarray class.

copyto

Copy the content of current array to another entity.

When another entity is the NDArray, the content is copied over. When another entity is AI::MXNet::Context, a new NDArray in the context will be created.

Parameters ---------- other : NDArray or Context Target NDArray or context we want to copy data to.

Returns ------- dst : NDArray

copy

Makes a copy of the current ndarray in the same context

Returns ------ $copy : NDArray

T

Get transpose of the NDArray. Works only on 2-D matrices.

astype

Returns copied ndarray of current array with the specified type.

Parameters ---------- $dtype : Dtype

Returns ------- $array : ndarray A copy of the array content.

as_in_context

Returns an NDArray in the target context. If the array is already in that context, self is returned. Otherwise, a copy is made.

Parameters ---------- context : AI::MXNet::Context The target context we want the return value to live in.

Returns ------- A copy or self as an NDArray in the target context.

One hot encoding indices into matrix out.

Parameters ---------- indices: NDArray An NDArray containing indices of the categorical features.

out: NDArray The result of the encoding.

Returns ------- $out: NDArray

_ufunc_helper(lhs, rhs, fn_array, lfn_scalar, rfn_scalar):

Helper function for element-wise operation
The function will perform numpy-like broadcasting if needed and call different functions

Parameters
----------
lhs : NDArray or numeric value
    left hand side operand

rhs : NDArray or numeric value
    right hand side operand

fn_array : function
    function to be called if both lhs and rhs are of NDArray type

lfn_scalar : function
    function to be called if lhs is NDArray while rhs is numeric value

rfn_scalar : function
    function to be called if lhs is numeric value while rhs is NDArray;
    if none is provided, then the function is commutative, so rfn_scalar is equal to lfn_scalar

Returns
-------
out: NDArray
    result array

empty(

Creates an empty uninitialized NDArray, with the specified shape.

Parameters ---------- shape : Shape shape of the NDArray.

ctx : AI::MXNet::Context, optional The context of the NDArray, defaults to current default context.

Returns ------- out: Array The created NDArray.

zeros

Creates a new NDArray filled with 0, with specified shape.

Parameters ---------- shape : Shape The shape of the NDArray. ctx : AI::MXNet::Context, optional. The context of the NDArray, defaults to current default context.

Returns ------- out: Array The created NDArray.

ones

Creates a new NDArray filled with 1, with specified shape.

Parameters ---------- shape : Shape The shape of the NDArray. ctx : Context, optional. The context of the NDArray, default to current default context.

Returns ------- out: Array The created NDArray.

full

Creates a new NDArray filled with given value, with specified shape.

Parameters ---------- shape : Shape The shape of the NDArray. val : float or int The value to be filled with. ctx : Context, optional. The context of the NDArray, default to current default context.

Returns ------- out: NDArray The created NDArray.

array

Creates a new NDArray that is a copy of the source_array.

Parameters ---------- source_array : PDL, PDL::Matrix, Array ref in PDL::pdl format Source data to create NDArray from.

ctx : Context, optional The context of the NDArray, default to current default context.

Returns ------- out: Array The created NDArray.

concatenate

Concatenates an array ref of NDArrays along the first dimension.

Parameters ---------- arrays : array ref of NDArrays Arrays to be concatenate. They must have identical shape except for the first dimension. They also must have the same data type. axis : int The axis along which to concatenate. always_copy : bool Default 1. When not 1, if the arrays only contain one NDArray, that element will be returned directly, avoid copying.

Returns ------- An NDArray in the same context as $arrays->[0]->context.

arange

Similar function in the MXNet ndarray as numpy.arange See Also https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html.

Parameters ---------- start : number, optional Start of interval. The interval includes this value. The default start value is 0. stop : number, optional End of interval. The interval does not include this value. step : number, optional Spacing between the values repeat : number, optional The repeating time of all elements. E.g repeat=3, the element a will be repeated three times --> a, a, a. ctx : Context, optional The context of the NDArray, defaultw to current default context. dtype : data type, optional The value type of the NDArray, defaults to float32

Returns ------- out : NDArray The created NDArray

load

Loads ndarray from a binary file.

You can also use Storable to do the job if you only work on perl. The advantage of load/save is the file is language agnostic. This means the file saved using save can be loaded by other language binding of mxnet. You also get the benefit being able to directly load/save from cloud storage(S3, HDFS)

Parameters ---------- fname : str The name of the file.Can be S3 or HDFS address (remember built with S3 support). Example of fname:

- `s3://my-bucket/path/my-s3-ndarray`
- `hdfs://my-bucket/path/my-hdfs-ndarray`
- `/path-to/my-local-ndarray`

Returns ------- out : array ref of NDArrays or hash ref with NDArrays

save

Save array ref of NDArray or hash of str->NDArray to a binary file.

You can also use Storable to do the job if you only work on perl. The advantage of load/save is the file is language agnostic. This means the file saved using save can be loaded by other language binding of mxnet. You also get the benefit being able to directly load/save from cloud storage(S3, HDFS)

Parameters ---------- fname : str The name of the file.Can be S3 or HDFS address (remember built with S3 support). Example of fname:

- `s3://my-bucket/path/my-s3-ndarray`
- `hdfs://my-bucket/path/my-hdfs-ndarray`
- `/path-to/my-local-ndarray`

data : array ref of NDArrays hash ref of NDArrays The data to be saved.

imdecode

Decode an image from string. Requires OpenCV to work.

Parameters ---------- str_img : str binary image data clip_rect : iterable of 4 int clip decoded image to rectangle (x0, y0, x1, y1) out : NDArray output buffer. can be 3 dimensional (c, h, w) or 4 dimensional (n, c, h, w) index : int output decoded image to i-th slice of 4 dimensional buffer channels : int number of channels to output. Decode to grey scale when channels = 1. mean : NDArray subtract mean from decode image before outputting.

_new_empty_handle

Returns a new empty handle.

Empty handle can be used to hold result

Returns ------- a new empty ndarray handle

_new_alloc_handle

Returns a new handle with specified shape and context.

Empty handle is only used to hold results

Returns ------- a new empty ndarray handle

waitall

Wait for all async operations to finish in MXNet. This function is used for benchmarks only.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 337:

Unknown directive: =head

Around line 569:

Unknown directive: =head