Skip to content

Commit

Permalink
use .. operator to update record
Browse files Browse the repository at this point in the history
  • Loading branch information
nohzafk committed Jul 23, 2024
1 parent 3a3da2d commit 2261dea
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/nested_tensor.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -823,33 +823,15 @@ pub fn hp_new(revs revs, alpha alpha) {
}

pub fn hp_new_mu(hp hp: Hyperparameters, mu mu: Float) {
Hyperparameters(
revs: hp.revs,
alpha: hp.alpha,
mu: mu,
beta: hp.beta,
batch_size: hp.batch_size,
)
Hyperparameters(..hp, mu: mu)
}

pub fn hp_new_beta(hp hp: Hyperparameters, beta beta: Float) {
Hyperparameters(
revs: hp.revs,
alpha: hp.alpha,
mu: hp.mu,
beta: beta,
batch_size: hp.batch_size,
)
Hyperparameters(..hp, beta: beta)
}

pub fn hp_new_batch_size(hp hp: Hyperparameters, batch_size batch_size: Int) {
Hyperparameters(
revs: hp.revs,
alpha: hp.alpha,
mu: hp.mu,
beta: hp.beta,
batch_size: batch_size,
)
Hyperparameters(..hp, batch_size: batch_size)
}

pub fn revise(f: fn(Theta) -> Theta, revs: Int, theta: Theta) -> Theta {
Expand Down

0 comments on commit 2261dea

Please sign in to comment.