Readability tweaks

This commit is contained in:
Marcel Plch 2024-11-11 18:43:38 +01:00
parent c2b9dfdd29
commit 4169714b24
Signed by: dormouse
GPG key ID: 2CA77596BC4BDFFE

View file

@ -44,8 +44,8 @@ neural_new(size_t input_size, size_t output_size, size_t layer_count) {
// Calculate sizes of individual layers and allocate them. // Calculate sizes of individual layers and allocate them.
for (int i = 0; i < layer_count; i++) { for (int i = 0; i < layer_count; i++) {
self->layers[i] = nl_new(input_size self->layers[i] = nl_new(input_size + (layer_diff * i
+ (layer_diff * i / ((ssize_t)layer_count-1)), / ((ssize_t)layer_count-1)),
i < (layer_count-1) ? i < (layer_count-1) ?
(input_size + (layer_diff * (i+1) (input_size + (layer_diff * (i+1)
@ -243,16 +243,19 @@ neural_getMesh(Neural_Network *nn, ModelRegistry *mr) {
} }
model = model_circle(0, (GLfloat)1/64); model = model_circle(0, (GLfloat)1/64);
brightness = nl->neurons[i].value <= 1.0 ? nl->neurons[i].value : 255; brightness = nl->neurons[i].value <= 1.0 ?
nl->neurons[i].value : 255;
model_colorXYZ(model, 0, brightness, 0); model_colorXYZ(model, 0, brightness, 0);
Tensor *translation_matrix = tensor_new(4, 4); Tensor *translation_matrix = tensor_new(4, 4);
Tensor *aspectRatio_matrix = tensor_new(4, 4); Tensor *aspectRatio_matrix = tensor_new(4, 4);
aspectRatio_matrix->data[0] = (GLfloat)9/16; aspectRatio_matrix->data[0] = (GLfloat)9/16;
translation_matrix->data[3] = (((GLfloat)-1*16/9)*.90) translation_matrix->data[3] = (((GLfloat)-1*16/9)*.90)
+ ((GLfloat)1/(nl->layer_size-1)*2 * i * (((GLfloat)16/9))*.90); + ((GLfloat)1/(nl->layer_size-1)
* 2 * i * (((GLfloat)16/9))*.90);
translation_matrix->data[7] = .90 - ((GLfloat)1/(nn->layer_count)*2 * j *.90); translation_matrix->data[7] = .90 - ((GLfloat)1/(nn->layer_count)
* 2 * j *.90);
model->transformations[0] = translation_matrix; model->transformations[0] = translation_matrix;
model->transformations[1] = aspectRatio_matrix; model->transformations[1] = aspectRatio_matrix;