quadrants.lang.field#
Classes#
Quadrants field class. |
|
Quadrants scalar field with SNode implementation. |
|
Quadrants bitpacked fields, where fields with quantized types are packed together. |
Module Contents#
- class quadrants.lang.field.Field(_vars)[source]#
Quadrants field class.
A field is constructed by a list of field members. For example, a scalar field has 1 field member, while a 3x3 matrix field has 9 field members. A field member is a Python Expr wrapping a C++ FieldExpression.
- Parameters:
vars (List[Expr]) – Field members.
- property snode[source]#
Gets representative SNode for info purposes.
- Returns:
Representative SNode (SNode of first field member).
- Return type:
- abstract to_numpy(dtype: quadrants._lib.core.quadrants_python.DataTypeCxx | None = None)[source]#
Converts self to a numpy array.
- Returns:
The result numpy array.
- Return type:
numpy.ndarray
- abstract to_torch(device=None)[source]#
Converts self to a torch tensor.
- Parameters:
device (torch.device, optional) – The desired device of returned tensor.
- Returns:
The result torch tensor.
- Return type:
torch.tensor
- abstract from_numpy(arr)[source]#
Loads all elements from a numpy array.
The shape of the numpy array needs to be the same as self.
- Parameters:
arr (numpy.ndarray) – The source numpy array.
- class quadrants.lang.field.ScalarField(var)[source]#
Bases:
FieldQuadrants scalar field with SNode implementation.
- Parameters:
var (Expr) – Field member.