From 2067bd53b182429d059a61b0e060f92b4f317ed1 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 16 Dec 2023 10:40:04 -0800 Subject: Address BorrowMut TODO. There does not appear to be a good way to enforce const-ness here. --- src/lib/src/train.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/src/train.c b/src/lib/src/train.c index 98f58ad..ccff553 100644 --- a/src/lib/src/train.c +++ b/src/lib/src/train.c @@ -216,12 +216,11 @@ void nnTrain( // For now, we train with one sample at a time. for (int sample = 0; sample < inputs->rows; ++sample) { - // TODO: Introduce a BorrowMut. // Slice the input and target matrices with the batch size. // We are not mutating the inputs, but we need the cast to borrow. - nnMatrix training_inputs = + const nnMatrix training_inputs = nnMatrixBorrowRows((nnMatrix*)inputs, sample, 1); - nnMatrix training_targets = + const nnMatrix training_targets = nnMatrixBorrowRows((nnMatrix*)targets, sample, 1); // Will need the input transposed for backpropagation. -- cgit v1.2.3