Thank you very much!! I have tried datach before but forget to assign it to itself( >____< ). This is my final code which can work.
        for t in range(self._opt.temperature):
            syn_energy = self._Des128(sample_seq)  # deep network
            syn_energy.sum().backward()  # backward the output
            # print(t,syn_energy.sum(),sample_seq.requires_grad)
            temp = sample_seq + 0.5 * self._opt.sampling_step * self._opt.sampling_step * sample_seq.grad
            sample_seq = sample_seq * (1 - mask) + temp * mask
            sample_seq.clamp_(0.0, 1.0)  # min , max
            sample_seq = sample_seq.detach()
            sample_seq.requires_grad = True