Skip to content

Backward issue #65

@sixin-zh

Description

@sixin-zh

Hello,
I'd like to raise an issue regarding the function backward of class SFB1D(Function).
In the code, it checks whether there is a need to do backward depending on the needs_input_grad[0].
In my case, needs_input_grad = (False, True, False, False, False). So I still want to perform backward with resepct to the second input of the forward function. This is not done with the current implentation . Does it make sense to
replace the condition if ctx.needs_input_grad[0]: by
if ctx.needs_input_grad[0] or ctx.needs_input_grad[1]: ?

def backward(ctx, dy):
print('TO compute backward SFB1D',ctx.needs_input_grad)
dlow, dhigh = None, None
if ctx.needs_input_grad[0]:
mode = ctx.mode
g0, g1, = ctx.saved_tensors
dy = dy[:, :, None, :]

        dx = afb1d(dy, g0, g1, mode=mode, dim=3)

        dlow = dx[:, ::2, 0].contiguous()
        dhigh = dx[:, 1::2, 0].contiguous()
    return dlow, dhigh, None, None, None, None, None

best,
Sixin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions