phlower.PhlowerTensor

class phlower.PhlowerTensor(tensor, dimension_tensor=None, is_time_series=False, is_voxel=False)[source]

Bases: IPhlowerTensor

Tensor object which can be with physics dimenstion tensor.

Methods

__init__(tensor[, dimension_tensor, ...])

as_pattern(pattern)

backward()

clone()

coalesce()

detach()

from_pattern(tensor[, dimension_tensor, pattern])

indices()

n_vertices()

Returns the number of vertices.

numel()

numpy()

rank()

Returns the tensor rank.

rearrange(pattern, **axes_length)

reshape(shape[, is_time_series, is_voxel])

size()

to([device, non_blocking, dtype])

to_numpy()

to_tensor()

to_vertexwise()

Convert to vertexwise 2D tensor which has (n_vertices, -1) shape.

transpose(dim0, dim1)

values()

Attributes

device

dimension

dtype

has_dimension

is_sparse

is_time_series

is_voxel

shape

shape_pattern

Parameters:
  • tensor (torch.Tensor)

  • dimension_tensor (PhlowerDimensionTensor | None)

  • is_time_series (bool)

  • is_voxel (bool)

n_vertices()[source]

Returns the number of vertices.

Return type:

int

rank()[source]

Returns the tensor rank.

Return type:

int

to_vertexwise()[source]

Convert to vertexwise 2D tensor which has (n_vertices, -1) shape.

Returns:

PhlowerTensor

Vertexwise PhlowerTensor object.

resultant_patternstr

Pattern of the resultant shape. Can be used for rearrange.

Return type:

vertexwise_tensor