Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions fixed_point_finder/fixed_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ def run_update(batch_idx, opt_state):
return lax.fori_loop(lower, upper, run_update, opt_state)


optimize_fp_core_jit = jit(optimize_fp_core, static_argnums=(1, 2, 3))
def get_optimize_fp_core(batch_idx_start, num_batches, update_fun, opt_state):
def get_optimize_fp_core_(batch_idx_start, num_batches):
return optimize_fp_core(batch_idx_start, num_batches, update_fun, opt_state)
return get_optimize_fp_core_


def optimize_fps(rnn_fun, fp_candidates, hps, do_print=True):
Expand Down Expand Up @@ -214,8 +217,11 @@ def update(i, opt_state):
break
batch_idx_start = oidx * print_every
start_time = time.time()
opt_state = optimize_fp_core_jit(batch_idx_start, print_every, update_fun,
opt_state)

optimize_fp_core = get_optimize_fp_core(batch_idx_start, num_batches, update_fun, opt_state)
optimize_fp_core_jit = jit(optimize_fp_core, static_argnums=(1, ))

opt_state = optimize_fp_core_jit(batch_idx_start, print_every)
batch_time = time.time() - start_time

# Training loss
Expand Down
457 changes: 64 additions & 393 deletions notebooks/Fixed Point Finder Tutorial.ipynb

Large diffs are not rendered by default.