hxtorch.perceptron.nn

This module contains layers that can be used in modules together with the building blocks from py:mod:torch.nn. Unlike their counterparts, their multiply-accumulate operations are performed with the BrainScaleS-2 accelerator. Additional digital operations are performed in the SIMD processors of BSS-2.

Classes

Conv1d(in_channels, out_channels, …)

Applies a 1D convolution over an input signal composed of several input planes.

Conv2d(in_channels, out_channels, …)

Applies a 2D convolution over an input image composed of several input planes.

ConvNd(num_sends, wait_between_events, mock, …)

Base class for n-dimensional convolution.

ConvertingReLU(shift, mock)

Applies a rectified linear unit to the input, shifts and clips to the input range of the chip.

ExpandedConv1d(in_channels, out_channels, …)

Unrolls the weight matrix for execution on hardware.

Integral()

Integral adds a conversion to int and the bit-string operations.

Layer(mock)

Base class of all layers in hxtorch.nn.

Linear(in_features, out_features, bias, …)

Applies a linear transformation to the incoming data on Hicann-X.

MACLayer(num_sends, wait_between_events, …)

Layer that performs a multiply accumulate operation.

ReLU(mock)

Applies a rectified linear unit to the input.

Real()

To Complex, Real adds the operations that work on real numbers.

Functions

hxtorch.perceptron.nn.abstractmethod(funcobj)

A decorator indicating abstract methods.

Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract methods are overridden. The abstract methods can be called using any of the normal ‘super’ call mechanisms. abstractmethod() may be used to declare abstract methods for properties and descriptors.

Usage:

class C(metaclass=ABCMeta):

@abstractmethod def my_abstract_method(self, …):

hxtorch.perceptron.nn.clamp_weight_(weight: torch.Tensor)torch.Tensor

Clamps all elements of the weight in-place into the maximal weight range of BrainScaleS-2.

hxtorch.perceptron.nn.scale_input(x_in: torch.Tensor)torch.Tensor

Scales the tensor to the maximal input range of BrainScaleS-2.

hxtorch.perceptron.nn.scale_weight(weight: torch.Tensor)torch.Tensor

Scales the tensor to the maximal weight range of BrainScaleS-2.

hxtorch.perceptron.nn.signature(obj, *, follow_wrapped=True)

Get a signature object for the passed callable.