Training 1D CNN in PyTorch

You might create a zero in (len(test_x)//batch_size), which would create an invalid score.
I don’t know, how test_x is defined, so you would have to check the values manually.

Also, sklearn.metrics.f1_score expects the ground truth label as the first argument and the predictions as the second.