williamyang1991 / DualStyleGAN

[CVPR 2022] Pastiche Master: Exemplar-Based High-Resolution Portrait Style Transfer
Other
1.64k stars 254 forks source link

input must be contiguous when autograd #39

Closed Sutongtong233 closed 2 years ago

Sutongtong233 commented 2 years ago

When I finetune DualStyleGAN, when d_r1_loss(real_pred, real_img), it call 'upfirdn2d.py', and RunError:

File "/home/tongtong/python_project/DualStyleGAN/model/stylegan/op/upfirdn2d.py", line 143, in backward ctx.out_size, File "/home/tongtong/python_project/DualStyleGAN/model/stylegan/op/upfirdn2d.py", line 42, in forward g_pad_y1, RuntimeError: input must be contiguous

I have tried to add .contiguous() after the input, but it doesn't work. What should I do? Thanks in advance.

williamyang1991 commented 2 years ago

I think you can follow the code in fused_act.py to modify the code of upfirdn2d.py https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L29-L31

https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L49-L51

https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L119

Sutongtong233 commented 2 years ago

Thanks, the issue has been solved.

------------------ 原始邮件 ------------------ 发件人: "williamyang1991/DualStyleGAN" @.>; 发送时间: 2022年8月5日(星期五) 凌晨0:29 @.>; @.**@.>; 主题: Re: [williamyang1991/DualStyleGAN] input must be contiguous when autograd (Issue #39)

I think you can follow the code in fused_act.py to modify the code of upfirdn2d.py https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L29-L31

https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L49-L51

https://github.com/williamyang1991/DualStyleGAN/blob/fcc547c7728baffb8ddd0ce21fa0d7252d761786/model/stylegan/op/fused_act.py#L119

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>