hxtorch.spiking.handle.Handle
-
class
hxtorch.spiking.handle.
Handle
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.
-
__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’.
clone
(handle)Copy contents for handle to this handle.
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.
-
clear
() → None Set all data in handle to ‘None’.
-
clone
(handle: hxtorch.spiking.handle.Handle) → None Copy contents for handle to this handle. This handle must contain a data field for each data field in handle.
- Parameters
handle – The handle to clone.
-
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.
-
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.
-