aihwkit.linalg.matrix module

Defines an analog matrix

class aihwkit.linalg.matrix.AnalogMatrix(*args, **kwargs)[source]

Bases: LinearOperator

Defines an analog matrix for linear algebra.

Parameters:
  • matrix (Tensor | ndarray) – matrix to store into the analog crossbar array.

  • rpu_config (RPUConfigBase) – RPU Config specifying the analog hardware properties.

  • realistic (bool) – Whether to use realistic writing while storing the matrix elements. Otherwise, the elements will be stored exactly without write noise(fake write)

  • to_kwargs (Any) – arguments for the torch .to call such as device

cuda(*args, **kwargs)[source]

Move to GPU.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

AnalogMatrix

property dtype: dtype

Return data type.

ger(x_matrix, d_matrix, alpha=1.0)[source]

GER (rank update) function performed on the analog matrix.

Parameters:
  • x_matrix (Tensor | ndarray) – left input matrix

  • d_matrix (Tensor | ndarray) – right input matrix

  • alpha (float) – scale factor

Return type:

None

property shape: Tuple[int, int]

Returns shape of analog matrix.

to(*args, **kwargs)[source]

Move to device, datatype, or rpu_config.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

AnalogMatrix