phlower.PhlowerDimensionTensor

class phlower.PhlowerDimensionTensor(tensor=None, dtype=torch.float32)[source]

Bases: object

Tensor object which corresponds to physics dimension.

Methods

__init__([tensor, dtype])

detach()

from_list(values[, dtype])

Parse from list object

to([device, non_blocking, dtype])

to_dict()

to_physics_dimension()

Attributes

device

dtype

is_dimensionless

Return True if the tensor is dimensionless.

Parameters:
  • tensor (torch.Tensor | None)

  • dtype (torch.dtype)

classmethod from_list(values, dtype=torch.float32)[source]

Parse from list object

Parameters:
  • values (list[float] | tuple[float]) – list or tuple if length of values is not equal to the number of registered dimension type, raise ValueError.

  • dtype (dtype)

Returns:

tensor object

Return type:

PhlowerDimensionTensor

property is_dimensionless: bool

Return True if the tensor is dimensionless.