PyTensorContractionLayerModel¶
Full Name
neuroptimiser.core.models.PyTensorContractionLayerModel
Description
- class PyTensorContractionLayerModel[source]¶
Bases:
PyLoihiProcessModel
Tensor contraction layer model for Loihi-based perturbation-based nheuristics
This model implements a tensor contraction layer that performs a contraction operation on the input spikes and weights, producing an output activation matrix.
See also
neuroptimiser.core.processes.TensorContractionLayer
Process that implements a tensor contraction layer for perturbation-based nheuristics.
- __init__(proc_params)[source]¶
Initialises the tensor contraction layer model with the given parameters.
- Parameters:
proc_params (dict) – A dictionary containing additional parameters for the process model.
- a_out: PyOutPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyOutPortVectorDense'>, d_type=<class 'bool'>, precision=1)¶
- implements_process¶
alias of
TensorContractionLayer
- implements_protocol¶
alias of
LoihiProtocol
- required_resources: ty.List[ty.Type[AbstractResource]] = [<class 'lava.magma.core.resources.CPU'>]¶
- run_spk()[source]¶
Runs the tensor contraction layer process model.
- The process is summarised as follows:
Receives the input spikes from the inport.
If the weight tensor is not initialised, it sets it to the weight matrix with an additional dimension.
Performs the contraction operation using np.einsum to compute the output activation matrix.
Sends the output activation matrix to the outport.
- s_in: PyInPort = LavaPyType(cls=<class 'lava.magma.core.model.py.ports.PyInPortVectorDense'>, d_type=<class 'bool'>, precision=None)¶
- s_matrix: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'bool'>, precision=None)¶
- weight_matrix: ndarray = LavaPyType(cls=<class 'numpy.ndarray'>, d_type=<class 'float'>, precision=None)¶