sf.math.parameters.Variable¶
- class mrmustard.math.parameters.Variable(value, name, bounds=(None, None), update_fn=<function update_euclidean>)[source]¶
Bases:
objectA parameter whose value can change.
my_var = Variable(1, "my_var")
- Parameters:
value (
any) – The value of this variable.name (
str) – The name of this variable.bounds (
Tuple[Optional[float],Optional[float]]) – The numerical bounds of this variable.update_fn (
Callable) – The function used to update this variable during training.
Attributes
The numerical bounds of this variable.
The name of this constant.
The function used to update this variable during training.
The value of this variable.
- bounds¶
The numerical bounds of this variable.
- name¶
The name of this constant.
- update_fn¶
The function used to update this variable during training.
- value¶
The value of this variable.
Methods
orthogonal(value, name[, bounds, N])Initializes a variable with
update_fnfor orthogonal optimization.symplectic(value, name[, bounds, N])Initializes a variable with
update_fnfor simplectic optimization.unitary(value, name[, bounds, N])Initializes a variable with
update_fnfor unitary optimization.- static orthogonal(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fnfor orthogonal optimization.- Parameters:
value (
Optional[any]) – The value of the returned variable. IfNone, a random orthogonal matrix of dimensionNis initialized.name (
str) – The name of the returned variable.bounds (
Tuple[Optional[float],Optional[float]]) – The numerical bounds of the returned variable.N (
int) – The dimension of the random orthogonal matrix. This value is ignored ifvalueis notNone.
- Returns:
A variable with
update_fnfor orthogonal optimization.
- static symplectic(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fnfor simplectic optimization.- Parameters:
value (
any) – The value of the returned variable. IfNone, a random symplectic matrix of dimensionNis initialized.name (
str) – The name of the returned variable.bounds (
Tuple[Optional[float],Optional[float]]) – The numerical bounds of the returned variable.N (
int) – The dimension of the random symplectic matrix. This value is ignored ifvalueis notNone.
- Returns:
A variable with
update_fnfor simplectic optimization.
- static unitary(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fnfor unitary optimization.- Parameters:
value (
any) – The value of the returned variable. IfNone, a random unitary matrix of dimensionNis initialized.name (
str) – The name of the returned variable.bounds (
Tuple[Optional[float],Optional[float]]) – The numerical bounds of the returned variable.N (
int) – The dimension of the random unitary matrix. This value is ignored ifvalueis notNone.
- Returns:
A variable with
update_fnfor unitary optimization.