mxfusion.components.variables.runtime_variable

Members

mxfusion.components.variables.runtime_variable.add_sample_dimension(F, array)

Add an extra dimension with shape one in the front (axis 0) of an array repesenting samples.

Parameters:
  • F (mxnet.ndarray or mxnet.symbol) – the execution mode of MXNet.
  • array (MXNet NDArray or MXNet Symbol) – the array that the extra dimension is added to.
Returns:

the array with the extra dimension.

Rtypes:

the same type as the input array

mxfusion.components.variables.runtime_variable.add_sample_dimension_arrays(F, arrays)

Add the sample dimension to a dict of arrays.

Parameters:
  • F (mxnet.ndarray or mxnet.symbol) – the execution mode of MXNet.
  • arrays ({UUID: array}) – a dictionary of MXNet arrays.
mxfusion.components.variables.runtime_variable.expectation(F, array)

Return the expectation across the samples if the variable is a set of samples, otherwise return the variable.

Parameters:F (mxnet.ndarray or mxnet.symbol) – the MXNet execution mode.
mxfusion.components.variables.runtime_variable.is_sampled_array(F, array)

Check if the array is a set of samples.

Returns:True if the array is a set of samples.
Rtypes:boolean
mxfusion.components.variables.runtime_variable.get_num_samples(F, array)

Get the number of samples in the provided array. If the array is not a set of samples, the return value will be one.

Returns:the number of samples.
Rtypes:int
mxfusion.components.variables.runtime_variable.as_samples(F, array, num_samples)

Broadcast the variable as if it is a sampled variable. If the variable is already a sampled variable, it directly returns the data reference.

Parameters:
  • F (mxnet.ndarray or mxnet.symbol) – the execution mode of MXNet.
  • array (MXNet NDArray or MXNet Symbol) – the array to operate on.
  • num_samples (int) – the number of samples