hxtorch.spiking.utils.from_nir.Experiment
-
class
hxtorch.spiking.utils.from_nir.Experiment(*args, mock: bool = False, dt: float = 1e-06, inter_batch_entry_wait: int = 0, **kwargs) Bases:
hxtorch.core.experiment.BaseExperimentExperiment class for describing experiments on hardware
-
__init__(*args, mock: bool = False, dt: float = 1e-06, inter_batch_entry_wait: int = 0, **kwargs) Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(*args[, mock, dt, …])Initialize self.
connect(module, input_handles, output_handle)Add an module to the experiment and connect it to other experiment modules via input and output handles.
connect_wrapper(wrapper)Add a wrapper module to the experiment and assign it to the experiments modules.
get_source_handle(module)Generate external input events
Hook to be executed after mapping, but before execution.
run(runtime)Executes the experiment in mock or on hardware using the information added to the experiment for a time given by runtime and returns a dict of hardware data represented as PyTorch data types.
Attributes
-
property
batch_size
-
connect(module: HXBaseModule, input_handles: Tuple[Handle, …], output_handle: Handle) → Handle Add an module to the experiment and connect it to other experiment modules via input and output handles.
- Parameters
module – The HXModule to add to the experiment.
input_handles – The TensorHandle serving as input to the module (its obsv_state).
output_handle – The TensorHandle outputted by the module, serving as input to subsequent HXModules.
-
connect_wrapper(wrapper: HXModuleWrapper) Add a wrapper module to the experiment and assign it to the experiments modules. In the PyTorch graph the individual module functions assigned to the wrapper are then bypassed and only the wrapper’s forward_func is considered when building the PyTorch graph. This functionality is of interest if several modules have cyclic dependencies and need to be represented by one PyTorch function.
- Parameters
wrapper – The HWModuleWrapper to add to the experiment.
-
get_source_handle(module) → None Generate external input events
-
property
last_run_chip_configs
-
post_mapping_hook() Hook to be executed after mapping, but before execution. Can be used to set hardware parameters that depend on the mapping.
-
run(runtime: float | None) Executes the experiment in mock or on hardware using the information added to the experiment for a time given by runtime and returns a dict of hardware data represented as PyTorch data types.
- Parameters
runtime – The runtime of the experiment on hardware in ms.
- Returns
Returns the data map as dict, where the keys are the population descriptors and values are tuples of values returned by the corresponding module’s post_process method.
-