pdft.bases.ParameterView#

class pdft.bases.ParameterView(name, read, write, manifolds)[source]#

Bases: object

What a trainer moves in place of a basis’s tensors.

read(basis) gives the parameters as a list of arrays, write(basis, params) a copy of the basis that holds them, and manifolds(params) the manifold each one lives on, or None to have it read off their values as classify_manifold does. write is traceable, so a loss differentiates through it and the parameters are trained like any others: the basis and its circuit stay what they are, and whatever the view does not read is not trained.

The package’s views: tensors_view, the tensors themselves, each on the manifold its values put it on (what the trainers move when no view is named); cp_phases_view, one angle per controlled-phase gate (cp_phases); cp_diagonals_view, all four phases of every controlled-phase tensor (cp_diagonals). The last two are free real numbers on EuclideanManifold, read in double precision whatever the precision of the tensors, and written back in the tensors’ own.

Parameters:
__init__(name, read, write, manifolds)#
Parameters:
Return type:

None

Methods

__init__(name, read, write, manifolds)

Attributes

name: str#
read: Callable#
write: Callable#
manifolds: Callable#