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 representing 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_to_arrays(F, arrays, out=None)

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.
  • out (dict) – (optional) if not None, add processed arrays into out.
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.array_has_samples(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
mxfusion.components.variables.runtime_variable.arrays_as_samples(F, arrays)

Broadcast the dimension of samples for a list of variables. If the number of samples of at least one of the variables is larger than one, all the variables in the list are broadcasted to have the same number of samples.

Parameters:
  • F (mxnet.ndarray or mxnet.symbol) – the execution mode of MXNet.
  • arrays ([MXNet NDArray or MXNet Symbol or {str: MXNet NDArray or MXNet Symbol}]) – a list of arrays with samples to be broadcasted.
Returns:

the list of variables after broadcasting

Rtypes:

[MXNet NDArray or MXNet Symbol or {str: MXNet NDArray or MXNet Symbol}]