Hi,

It looks like an error because some index in you BCECriterion are wrong. This may not happen in all epochs if you drop the last partial batches for example. Or if you generate these inputs on the fly and some of them are wrong.
It’s a device side that says that what you gave as input does not verify some condition. So yes you can fix it by giving correct inputs to that function 

This kind of error is raised when a cuda kernel detect a problem. CUDA is asynchronous, so unless you start your code with CUDA_LAUNCH_BLOCKING=1 environment variable, the python stack trace is wrong. Unfortunaly, because of how cuda works, we can’t make these errors much more user-friendly.
The error is in the file BCECriterion.cu so it comes from a call to BCELoss (or a criterion that uses it) You can see that *input >= 0. && *input <= 1. You might want to check that your values are in [0, 1] as expected from the doc 4.