When I use the loss function cross_entropy, there is a erro: Traceback (most recent call last):
** File “cnn.py”, line 131, in **
** optimizer.step()**
RuntimeError: cuda runtime error (59) : device-side assert triggered at /opt/conda/conda-bld/pytorch_1512386481460/work/torch/lib/THC/generated/…/generic/THCTensorMathPointwise.cu:301
I add a sigmoid function before the net output,that can correctly run.But my input value is not only 0~1 , I use autoencoder,so I think the output by add sigmoid is not close the input
The CrossEntropyLoss is used for classification with class labels.
I think it might be not the right criterion for your autoencoder, since the labels will most likely be floats.
As a workaround you could use nn.MSELoss as a criterion.
Would this work for you?