hxtorch.perceptron.nn.MACLayer
-
class
hxtorch.perceptron.nn.
MACLayer
(num_sends: Optional[numbers.Integral] = None, wait_between_events: numbers.Integral = 5, mock: bool = False, *, input_transform: Optional[Callable[[torch.Tensor], torch.Tensor]] = None, weight_transform: Optional[Callable[[torch.Tensor], torch.Tensor]] = <function clamp_weight_>) Bases:
hxtorch.perceptron.nn.Layer
Layer that performs a multiply accumulate operation.
-
__init__
(num_sends: Optional[numbers.Integral] = None, wait_between_events: numbers.Integral = 5, mock: bool = False, *, input_transform: Optional[Callable[[torch.Tensor], torch.Tensor]] = None, weight_transform: Optional[Callable[[torch.Tensor], torch.Tensor]] = <function clamp_weight_>) - Parameters
num_sends – Number of sends of the input. Values greater than 1 result in higher output to the neurons and increases the s/n ratio. For
None
this is automatically adjusted during initialization.wait_between_events – Wait time between two successive vector inputs, in FPGA clock cycles. Shorter wait time can lead to saturation of the synaptic input.
mock – Enable mock mode.
input_transform – Function that receives the input and returns a tensor to be used as input to the chip.
weight_transform – Function that receives the weight and returns a tensor to be used as weight matrix on the chip.
Methods
__init__
([num_sends, wait_between_events, …])- param num_sends
Number of sends of the input. Values greater than 1
reset_parameters
([weight_mean, relu_shift])Reset parameters to reasonable initialization values.
-
reset_parameters
(weight_mean: numbers.Real = 0.0, relu_shift: numbers.Integral = 1) → None Reset parameters to reasonable initialization values. Method based on Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification - He, K. et al. (2015)
- Parameters
weight_mean – Mean value of the weight distribution
relu_shift – Bit shift assumed in subsequent ConvertingReLU
-