Until the number of outputs from the network/model are 2 [since you are training on 2 classes], you will not face any issues.
Also if you have 10 outputs for the network and you are only training on 2 classes, this will not have an issue too.



 ani0075:

CrossEntropy criterion expects a class index in the range [0, C-1]


This condition is violated only when your data set has for example “10 classes” and your network is having “2 outputs”, but not the other way around.