Vid-ODE icon indicating copy to clipboard operation
Vid-ODE copied to clipboard

Inplace Operation Error

Open dsshim0125 opened this issue 2 years ago • 2 comments

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 에러가 발생하는데 어느 부분을 수정해야할까요?

감사합니다!

dsshim0125 avatar Aug 25 '22 03:08 dsshim0125

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.

Ice9Coffee avatar Apr 06 '23 08:04 Ice9Coffee

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

williambittner1 avatar Apr 29 '24 18:04 williambittner1