Skip to content

unique() error in pullback #1053

Closed
Closed
@DavidKoplow

Description

@DavidKoplow

I need to calculate the pullback of a function which uses unique(). The variable being differentiated isn't fed into unique() as an argument. On the forward pass everything seems fine, but on the backwards pass Zygote sets the output of unique() to IRTools.Inner.Undefined(). Here is the MWE:

function f1(A)
    @show unique([1])
    A
end
f1(5) #unique returns correct result
Zygote._pullback(f1,5) #unique returns IRTools.Inner.Undefined()

In the above example Zygote is able to correctly calculate both pullbacks, but in the program I am working on, IRTools.Inner.Undefined() leads to an error, which causes the whole thing to crash. For the rest of the code to work, I need to keep unique() in.

Has anyone encountered this issue? What is the fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions