Skip to content

Complex RNN n_layers>1 is wrong #360

Closed
@jonashaag

Description

The way we implement complex RNN (used in DCCRN) is wrong since the layers are computed independently for the real and imaginary components, and the real and imaginary results are merged only once.

What we want (n_layers=2):

rr1 = real_lstm(input.real)
ir1 = real_lstm(input.imag)
ii1 = imag_lstm(input.imag)
ri1 = imag_lstm(input.real)
r1 = rr1 - ii1
i1 = ir1 + ri1
out1 = from_reim(r1, i1)

rr2 = real_lstm(out1.real)
ir2 = real_lstm(out1.imag)
ii2 = imag_lstm(out1.imag)
ri2 = imag_lstm(out1.real)
r2 = rr2 - ii2
i2 = ir2 + ri2
out2 = from_reim(r2, i2)

What I think we have (n_layers=2):

rr2 = real_lstm(real_lstm(input.real))
ir2 = real_lstm(real_lstm(input.imag))
ii2 = imag_lstm(imag_lstm(input.imag))
ri2 = imag_lstm(imag_lstm(input.real))
r2 = rr2 - ii2
i2 = ir2 + ri2
out2 = from_reim(r2, i2)

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions