Skip to content

Commit 8868158

Browse files
committed
Make relative amplitude of random noise configurable
1 parent c2fcd9e commit 8868158

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

peps_ad/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class PEPS_AD_Config:
135135
gradient norm is below this threshold.
136136
optimizer_random_noise_max_retries (:obj:`int`):
137137
Maximal retries for optimization with random noise.
138+
optimizer_random_noise_relative_amplitude (:obj:`float`):
139+
Relative amplitude used for random noise.
138140
line_search_method (:obj:`Line_Search_Methods`):
139141
Method used for the line search routine.
140142
line_search_initial_step_size (:obj:`float`):
@@ -205,6 +207,7 @@ class PEPS_AD_Config:
205207
optimizer_autosave_step_count: int = 2
206208
optimizer_random_noise_eps: float = 1e-4
207209
optimizer_random_noise_max_retries: int = 5
210+
optimizer_random_noise_relative_amplitude: float = 1e-1
208211

209212
# Line search
210213
line_search_method: Line_Search_Methods = Line_Search_Methods.WOLFE

peps_ad/optimization/optimizer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ def optimize_peps_network(
235235
rng = PEPS_Random_Number_Generator.get_generator(backend="jax")
236236

237237
def random_noise(a):
238-
return a + a * rng.block(a.shape, dtype=a.dtype) * 5e-1
238+
return (
239+
a
240+
+ a
241+
* rng.block(a.shape, dtype=a.dtype)
242+
* peps_ad_config.optimizer_random_noise_relative_amplitude
243+
)
239244

240245
if isinstance(input_tensors, PEPS_Unit_Cell):
241246
working_tensors = cast(

0 commit comments

Comments
 (0)