aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-12-16 10:40:04 -0800
committer3gg <3gg@shellblade.net>2023-12-16 10:40:04 -0800
commit2067bd53b182429d059a61b0e060f92b4f317ed1 (patch)
tree089db32bd8ac2952123629d9dd2d7b39d969402a
parent653e98e029a0d0f110b0ac599e50406060bb0f87 (diff)
Address BorrowMut TODO. There does not appear to be a good way to enforce const-ness here.
-rw-r--r--src/lib/src/train.c5
1 files 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(
216 216
217 // For now, we train with one sample at a time. 217 // For now, we train with one sample at a time.
218 for (int sample = 0; sample < inputs->rows; ++sample) { 218 for (int sample = 0; sample < inputs->rows; ++sample) {
219 // TODO: Introduce a BorrowMut.
220 // Slice the input and target matrices with the batch size. 219 // Slice the input and target matrices with the batch size.
221 // We are not mutating the inputs, but we need the cast to borrow. 220 // We are not mutating the inputs, but we need the cast to borrow.
222 nnMatrix training_inputs = 221 const nnMatrix training_inputs =
223 nnMatrixBorrowRows((nnMatrix*)inputs, sample, 1); 222 nnMatrixBorrowRows((nnMatrix*)inputs, sample, 1);
224 nnMatrix training_targets = 223 const nnMatrix training_targets =
225 nnMatrixBorrowRows((nnMatrix*)targets, sample, 1); 224 nnMatrixBorrowRows((nnMatrix*)targets, sample, 1);
226 225
227 // Will need the input transposed for backpropagation. 226 // Will need the input transposed for backpropagation.