hxtorch.spiking.TensorHandle
-
class
hxtorch.spiking.
TensorHandle
Bases:
object
Base class for HX tensor handles. New tensor handles have to be derived from this class. The name of tensors the tensor handle ‘carries’ has to be indicated in the class member ‘_carries’. For all elements in this list a property is created implicitly.
The observable state of the tensor handle is defined in ‘_obsv_state’ and defines which tensor is passed to the subsequent layer as input. Member ‘_obsv_state’ has to be in ‘_carries’.
-
__init__
() → None Instantiate a new HX handle holding references to torch tensors.
Methods
__init__
()Instantiate a new HX handle holding references to torch tensors.
clear
()Set all data in handle to ‘None’.
holds
(name)Checks whether the tensor handle already holds a tensor with key name.
put
(*tensors, **kwargs)Fill the tensor handle with actual data given by tensors or kwargs.
Attributes
Getter for observable state.
Getter for observable state identifier.
-
clear
() → None Set all data in handle to ‘None’.
-
holds
(name: str) → bool Checks whether the tensor handle already holds a tensor with key name.
- Parameters
name – Key of reference to tensor.
- Returns
Returns a bool indicating whether the data present at key name is not None.
-
property
observable_state
Getter for observable state.
- Returns
Returns the tensor associated with ‘_obsv_state’
-
property
observable_state_identifier
Getter for observable state identifier.
- Returns
Returns the identifier string associated with the observable state of the handle.
-
put
(*tensors, **kwargs) → None Fill the tensor handle with actual data given by tensors or kwargs. If tensors are given as positional arguments the tensors are assigned in the order given by class member ‘_carries’. Keyword arguments are assigned to the corresponding key. Therefore, the key has to be in ‘_carries.’
- Parameters
tensors – Tensors which are assigned to the tensor handle. The given tensors are associated with the elements in ‘_carries’ in successive order.
kwargs (param) – Assigns the items in kwargs to the elements in the tensor handle associated with the corresponding kwargs keys.
-