NAME

AI::MXNet::Context - A device context.

DESCRIPTION

This class governs the device context of AI::MXNet::NDArray objects.

Constructing a context.

Parameters ---------- device_type : {'cpu', 'gpu'} or Context. String representing the device type

device_id : int (default=0) The device id of the device, needed for GPU

cpu

Returns a CPU context.

Parameters ---------- device_id : int, optional The device id of the device. device_id is not needed for CPU. This is included to make interface compatible with GPU.

Returns ------- context : AI::MXNet::Context The corresponding CPU context.

gpu

Returns a GPU context.

Parameters ---------- device_id : int, optional

Returns ------- context : AI::MXNet::Context The corresponding GPU context.

current_context

Returns the current context.

Returns ------- $default_ctx : AI::MXNet::Context