Skip to content

Commit

Permalink
Optimizer.compute_optimal_parameters should return mutable list
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdavham committed Jan 24, 2025
1 parent 153862e commit 911be9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fsrs/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _update_parameters(
num_reviews = _num_reviews()

if num_reviews < mini_batch_size:
return DEFAULT_PARAMETERS
return list(DEFAULT_PARAMETERS)

# Define FSRS Scheduler parameters as torch tensors with gradients
params = torch.tensor(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_zero_revlogs(self):

optimal_parameters = optimizer.compute_optimal_parameters()

assert optimal_parameters == DEFAULT_PARAMETERS
assert optimal_parameters == list(DEFAULT_PARAMETERS)

def test_review_logs(self):
"""
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_review_logs(self):
optimal_parameters = optimizer.compute_optimal_parameters()

# the optimal paramaters are no longer equal to the starting parameters
assert optimal_parameters != DEFAULT_PARAMETERS
assert optimal_parameters != list(DEFAULT_PARAMETERS)

# the output is expected
assert np.allclose(optimal_parameters, expected_optimal_parameters)
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_few_review_logs(self):

optimal_parameters = optimizer.compute_optimal_parameters()

assert optimal_parameters == DEFAULT_PARAMETERS
assert optimal_parameters == list(DEFAULT_PARAMETERS)

def test_unordered_review_logs(self):
"""
Expand Down

0 comments on commit 911be9a

Please sign in to comment.