psh01087 / Vid-ODE

Vid-ODE: Continuous-Time Video Generation with Neural Ordinary Differential Equation
58 stars 5 forks source link

Inplace Operation Error #6

Open dsshim0125 opened 2 years ago

dsshim0125 commented 2 years ago

Hi,

thank you for your excellent work.

I have run the train code, but I encountered inplace operation error in an adversarial loss.

How can I solve it?

Thank you!

Screen Shot 2022-08-25 at 1 00 38 PM

GAN의 adversarial loss부분에서 inpalce operation 에러가 발생하는데 어느 부분을 수정해야할까요?

감사합니다!

Ice9Coffee commented 1 year ago

I encountered the same issue when I use a newer version of pytorch.

Swap the order of Train G and Train D may help. In main.py:

def train(...):
    ...
            # Train G
            optimizer_netG.zero_grad()
            loss_netG.backward()
            optimizer_netG.step()

            # Train D
            optimizer_netD.zero_grad()
            loss_netD.backward()
            optimizer_netD.step()
    ...

Train G first, then train D.

williambittner1 commented 6 months ago

@Ice9Coffee: Thanks, I had the same problem like @dsshim0125 and swaping the order resolved the issue for me.