AssertionError: nn criterions don’t compute the gradient w.r.t. targets - please mark these variable

运行环境: pytorch 0.3.1, python 3.5

背景:我想利用VGG来提取预测的图像和原图像的高级特征使他们尽可能的相近

AssertionError: nn criterions don’t compute the gradient w.r.t. targets - please mark these variable

 解决办法: 通过pytorch的官网论坛进行了提问

AssertionError: nn criterions don’t compute the gradient w.r.t. targets - please mark these variable

问题原因: 

AssertionError: nn criterions don’t compute the gradient w.r.t. targets - please mark these variable