gluonts.support.util module

class gluonts.support.util.SignalHandler(handlers_map: Dict[int, Optional[Callable[[int, Any], None]]])[source]

Bases: object

A context manager that attaches a set of signal handlers within its scope.

Parameters

handlers_map – A dictionary mapping signal numbers to associated signal handlers to be attached within the scope of the enclosing SignalHandler instance.

Callback = typing.Union[typing.Callable[[int, typing.Any], NoneType], NoneType]
class gluonts.support.util.Timer[source]

Bases: object

Context manager for measuring the time of enclosed code fragments.

gluonts.support.util.erf(x: numpy.array) → numpy.array[source]
gluonts.support.util.erfinv(x: numpy.array) → numpy.array[source]
gluonts.support.util.get_download_path() → pathlib.Path[source]
Returns

default path to download datasets or models of gluon-ts. The path is either $MXNET_HOME if the environment variable is defined or /home/username/.mxnet/gluon-ts/

Return type

Path

gluonts.support.util.map_dct_values(fn: Callable, dct: dict) → dict[source]

Maps fn over a dicts values.

gluonts.support.util.maybe_len(obj) → Optional[int][source]
gluonts.support.util.pad_to_size(x: numpy.array, size: int, axis: int = 0, is_right_pad: bool = True)[source]

Pads xs with 0 on the right (default) on the specified axis, which is the first axis by default.