Skip to content

Commit

Permalink
Fix nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
rozukke committed Jul 3, 2024
1 parent cdffd8d commit f62e13b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ u8 infer(vector* input) {
propagate_fwd(weights[6], outputs[5], outputs[6], biases[6]);
softmax_inplace(outputs[6]->data, 52);

u8 pred = getv_max_i(outputs[6]->data, 52);
u8 pred = argmax(outputs[6]->data, 52);

free(outputs[0]->data);
free(outputs[0]);
Expand Down Expand Up @@ -119,7 +119,7 @@ u8 infer_reuse_layers_thread(vector* input, matrix** weights, vector** biases) {
propagate_fwd(weights[6], outputs[1], outputs[0], biases[6]);
softmax_inplace(outputs[0]->data, 52);

u8 prediction = getv_max_i(outputs[0]->data, 52);
u8 prediction = argmax(outputs[0]->data, 52);

free(outputs[0]->data);
free(outputs[0]);
Expand Down Expand Up @@ -165,7 +165,9 @@ int main(int argc, char* argv[]) {
// Set up preliminary counts and data
const char* directory_path = argv[2];
int input_count = file_count(directory_path);
int iter_per_in = atoi(argv[3]);
printf("Number of input tensors: %d\n", input_count);
printf("Iterations per input: %d\n", iter_per_in);

f32* tensors = (f32*)aligned_alloc(SIMD_ALGN, TSIZE_ALGN_BYTES * input_count);

Expand Down Expand Up @@ -195,7 +197,6 @@ int main(int argc, char* argv[]) {
printf("Pre inference (model read, tensor read, transpose) took %lu us\n",
(preinf.tv_sec - start.tv_sec) * 1000000 + preinf.tv_usec - start.tv_usec);

int iter_per_in = atoi(argv[3]);
// int NUM_THREADS = sysconf(_SC_NPROCESSORS_ONLN);

if (iter_per_in > 1)
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void transpose_mat_inplace(matrix* in) {
}

// Get result from output layer
u8 getv_max_i(f32* in, int len) {
u8 argmax(f32* in, int len) {
int idx = 0;
float res = in[0];
for (int i = 0; i < len; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ void softmax_inplace(f32* dest, int len);

void transpose_mat_inplace(matrix* in);

u8 getv_max_i(f32* a, int len);
u8 argmax(f32* a, int len);

0 comments on commit f62e13b

Please sign in to comment.