adam.pytorch.torch_like#

Classes#

TorchLike

Class wrapping pyTorch types

TorchLikeFactory

Abstract class for a generic Array wrapper. Every method should be implemented for every data type.

SpatialMath

Class implementing the main geometric functions used for computing rigid-body algorithm

Module Contents#

class adam.pytorch.torch_like.TorchLike[source]#

Bases: adam.core.spatial_math.ArrayLike

Class wrapping pyTorch types

array: torch.Tensor[source]#
__post_init__()[source]#

Converts array to the desired type

__setitem__(idx, value: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides set item operator

__getitem__(idx)[source]#

Overrides get item operator

property shape[source]#
reshape(*args)[source]#
property T: TorchLike[source]#

Returns: TorchLike: transpose of array

__matmul__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides @ operator

__rmatmul__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides @ operator

__mul__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides * operator

__rmul__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides * operator

__truediv__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides / operator

__add__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides + operator

__radd__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides + operator

__sub__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides - operator

__rsub__(other: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#

Overrides - operator

__neg__() TorchLike[source]#

Overrides - operator

class adam.pytorch.torch_like.TorchLikeFactory[source]#

Bases: adam.core.spatial_math.ArrayLikeFactory

Abstract class for a generic Array wrapper. Every method should be implemented for every data type.

static zeros(*x: int) TorchLike[source]#
Returns:

zero matrix of dimension *x

Return type:

TorchLike

static eye(x: int) TorchLike[source]#
Parameters:

x (int) – dimension

Returns:

identity matrix of dimension x

Return type:

TorchLike

static array(x: numpy.typing.ArrayLike) TorchLike[source]#
Returns:

vector wrapping x

Return type:

TorchLike

class adam.pytorch.torch_like.SpatialMath[source]#

Bases: SpatialMath

Class implementing the main geometric functions used for computing rigid-body algorithm

Parameters:

ArrayLike – abstract class describing a generic Array wrapper. It needs to be implemented for every data type

static sin(x: numpy.typing.ArrayLike) TorchLike[source]#
Parameters:

x (ntp.ArrayLike) – angle value

Returns:

sin value of x

Return type:

TorchLike

static cos(x: numpy.typing.ArrayLike) TorchLike[source]#
Parameters:

x (ntp.ArrayLike) – angle value

Returns:

cos value of x

Return type:

TorchLike

static outer(x: numpy.typing.ArrayLike, y: numpy.typing.ArrayLike) TorchLike[source]#
Parameters:
  • x (ntp.ArrayLike) – vector

  • y (ntp.ArrayLike) – vector

Returns:

outer product of x and y

Return type:

TorchLike

static skew(x: TorchLike | numpy.typing.ArrayLike) TorchLike[source]#
Parameters:

x (Union[TorchLike, ntp.ArrayLike]) – vector

Returns:

skew matrix from x

Return type:

TorchLike

static vertcat(*x: numpy.typing.ArrayLike) TorchLike[source]#
Returns:

vertical concatenation of x

Return type:

TorchLike

static horzcat(*x: numpy.typing.ArrayLike) TorchLike[source]#
Returns:

horizontal concatenation of x

Return type:

TorchLike