lgatr.primitives.invariants

Invariants, e.g. inner product, absolute squared norm, pin invariants.

Functions

abs_squared_norm(x)

Computes a modified version of the squared norm that is positive semidefinite and can therefore be used in layer normalization.

inner_product(x, y)

Computes the inner product of multivectors f(x,y) = <x, y> = <~x y>_0.

lgatr.primitives.invariants.abs_squared_norm(x)[source]

Computes a modified version of the squared norm that is positive semidefinite and can therefore be used in layer normalization.

Parameters:

x (torch.Tensor) – Input multivector with shape (…, 16).

Returns:

outputs – Geometric algebra norm of x with shape (…, 1).

Return type:

torch.Tensor

lgatr.primitives.invariants.inner_product(x, y)[source]

Computes the inner product of multivectors f(x,y) = <x, y> = <~x y>_0.

Equal to geometric_product(reverse(x), y)[..., [0]] (but faster).

Parameters:
  • x (torch.Tensor) – First input multivector with shape (…, 16) or (…, channels, 16). Batch dimensions must be broadcastable between x and y.

  • y (torch.Tensor) – Second input multivector with shape (…, 16) or (…, channels, 16). Batch dimensions must be broadcastable between x and y.

Returns:

outputs – Result with shape (…, 1). Batch dimensions are result of broadcasting between x and y.

Return type:

torch.Tensor