cnn: Fix floating point exception ( rand()%0 )

This commit is contained in:
augustin64 2023-05-18 18:09:01 +02:00
parent dbd5362d7d
commit 2743fcda14

View File

@ -106,8 +106,8 @@ void write_image_in_network_32(int** image, int height, int width, float** input
max_col--; max_col--;
} }
i_offset = rand()%(27-max_ligne+min_ligne); i_offset = 27-max_ligne+min_ligne == 0 ? 0 : rand()%(27-max_ligne+min_ligne);
j_offset = rand()%(27-max_col+min_col); j_offset = 27 - max_col + min_col == 0 ? 0 : rand()%(27-max_col+min_col);
} }
int padding = (32 - height)/2; int padding = (32 - height)/2;