cntk.axis module

Axis for CNTK variables on data binding.

class Axis(*args)[source]

Bases: cntk.cntk_py.Axis

An axis object describes the axis of a variable and is used for specifying the axes parameters of certain functions such as reductions. Besides the static axes corresponding to each of the axes of the variable’s shape, variables of kind ‘input’ and any ‘output’ variables dependent on an ‘input’ variable also have two additional dynamic axes whose dimensions are known only when the variable is bound to actual data during compute time (viz. sequence axis and batch axis denoting the axis along which multiple sequences are batched).

Axis parameters can also be negative, which allows to refere axis starting from the last axis. Please be aware that Axis objects work in a column-major wise, as opposed to any other function in the library.

static all_axes()[source]

Axis object representing all the axes–static and dynamic–of an operand.

Returns:all axes
Return type:Axis
static all_static_axes()[source]

Axis object representing all the static axes of an operand.

Returns:all static axes
Return type:Axis
static default_batch_axis()[source]

Returns an Axis object representing the batch axis

Returns:default batch axis
Return type:Axis
static default_dynamic_axis()[source]

Returns an Axis object representing the default dynamic axis

Returns:default dynamic axis
Return type:Axis
static default_input_variable_dynamic_axes()[source]

Default dynamic axes of the input variable

Returns:instances
Return type:tuple of Axis
is_batch_axis

Returns True if the axis is a batch axis and False otherwise

Returns:True if this axis is a batch axis and False otherwise
Return type:bool
is_ordered

Returns True if the axis is ordered; i.e. if there is an ordering between the dimensions along the axis.

Returns:True if this axis is ordered and False otherwise
Return type:bool
is_sequence_axis

Returns True if the axis is a sequence axis and False otherwise

Returns:True if this axis is a sequence axis and False otherwise
Return type:bool
is_static_axis

Returns True if the axis is of type static and False otherwise

Returns:True if this axis is of type static and False otherwise
Return type:bool
name

Returns the name of this axis.

Returns:the name of this axis.
Return type:str
static new_leading_axis()[source]

Creates an Axis object representing a new leading static axis.

Returns:axis object representing a new leading static axis.
Return type:Axis
static new_unique_dynamic_axis(name)[source]

Creates an Axis object representing a new unique dynamic axis.

Parameters:name (str) – name of the dynmic axis
Returns:new unique dynamic axis
Return type:Axis
static_axis_index(checked=True)[source]

Returns the integer with which the static axis is defined. For example, 0 = first axis, 1 = second axis, etc.

Parameters:checked (bool) – if True then this function will throw an exception if the axis is not static.
Returns:the number with which the static axis is defined.
Return type:int
static unknown_dynamic_axes()[source]

Unknown dynamic axes

Returns:instances
Return type:tuple of Axis