the criterion itself never had backward. If this code worked for you previously, that’s strange.
Also, critBCE.forward is wrong and your overall code is fairly wrong.
Your code should be something of this order:
        output = dis(X2)
        loss = critBCE(output.float(), Yd.float())
        err_real += loss.data[0]
        loss.backward()