hgq.utils package

Subpackages

Submodules

hgq.utils.dataset module

class hgq.utils.dataset.Dataset(x_set, y_set=None, batch_size=None, device: str = 'cpu:0', drop_last=False, **kwargs)

Bases: PyDataset

batch(batch_size)

hgq.utils.minmax_trace module

class hgq.utils.minmax_trace.TrainingFlagWrapper(value)

Bases: object

hgq.utils.minmax_trace.trace_minmax(model: Model, data: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | Sequence[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]] | PyDataset, reset=True, batch_size=1024, verbose: int | bool = 0, return_results=False)

hgq.utils.misc module

hgq.utils.misc.gather_vars_to_kwargs(skip_pattern=None) dict[str, Any]

Gather all local variables in the calling function and return them as a dictionary. If a variable is named kwargs, it will be updated with the rest of the variables. This function is useful for initializing classes with a large number of arguments.

Parameters:

skip_pattern (str, optional) – A regular expression pattern to match variables to skip. If a variable matches the pattern, it will not be included in the returned dictionary. The default is None.

Returns:

A dictionary containing all local variables in the calling function, except for those that start and end with double underscores.

Return type:

dict[str, Any]

hgq.utils.misc.warn_no_synth(conf: bool, msg: str)

hgq.utils.singleton module

class hgq.utils.singleton.Singleton

Bases: type

Module contents

hgq.utils.trace_minmax(model: Model, data: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | Sequence[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]] | PyDataset, reset=True, batch_size=1024, verbose: int | bool = 0, return_results=False)