Hi,Mr Yu
I’m also trying to run this code and facing the same problem with you.
I figure out why it goes wrong.
In adversarial Training,
# Adversarial Training 
    rollout = Rollout(generator, 0.8)
    print('#####################################################')
    print('Start Adversarial Training...\n')
    ......
            # calculate the reward
            rewards = rollout.get_reward(samples, 16, discriminator)
            rewards = Variable(torch.Tensor(rewards))
            if opt.cuda:
                rewards = torch.exp(rewards.cuda()).contiguous().view((-1,))
            prob = generator.forward(inputs)
#            print('SHAPE: ', prob.shape, targets.shape, rewards.shape)              

The error happened because the author flats the reward shape to 1 dimension in GPU environment .However,you and I both run this code in CPU environment ,which cause the error happened.
So here is the solution
add this
rewards = torch.exp(rewards).contiguous().view((-1,))

after
rewards = Variable(torch.Tensor(rewards))

Hope it can help