Skip to content

Commit 2261dea

Browse files
committed
use .. operator to update record
1 parent 3a3da2d commit 2261dea

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

src/nested_tensor.gleam

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -823,33 +823,15 @@ pub fn hp_new(revs revs, alpha alpha) {
823823
}
824824

825825
pub fn hp_new_mu(hp hp: Hyperparameters, mu mu: Float) {
826-
Hyperparameters(
827-
revs: hp.revs,
828-
alpha: hp.alpha,
829-
mu: mu,
830-
beta: hp.beta,
831-
batch_size: hp.batch_size,
832-
)
826+
Hyperparameters(..hp, mu: mu)
833827
}
834828

835829
pub fn hp_new_beta(hp hp: Hyperparameters, beta beta: Float) {
836-
Hyperparameters(
837-
revs: hp.revs,
838-
alpha: hp.alpha,
839-
mu: hp.mu,
840-
beta: beta,
841-
batch_size: hp.batch_size,
842-
)
830+
Hyperparameters(..hp, beta: beta)
843831
}
844832

845833
pub fn hp_new_batch_size(hp hp: Hyperparameters, batch_size batch_size: Int) {
846-
Hyperparameters(
847-
revs: hp.revs,
848-
alpha: hp.alpha,
849-
mu: hp.mu,
850-
beta: hp.beta,
851-
batch_size: batch_size,
852-
)
834+
Hyperparameters(..hp, batch_size: batch_size)
853835
}
854836

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

0 commit comments

Comments
 (0)