-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Labels
Structural TangentRelated to the `Tangent` type for structured (composite) valuesRelated to the `Tangent` type for structured (composite) valuesbugSomething isn't workingSomething isn't working
Description
Compsites act like any field not present is Zero during multiplication.
For for getproperty they don't, they just check the backing named tuple.
Consider the following:
struct Foo
a::Float64
b::Float64
end
function bar(ina, inb)
f = Foo(a, b)
y = f.a
return y
end
So the pullback for f.a will be: dy-> NO_FIELDS, Composite{Foo}(;a=dy)
the pullback for Foo(a,b) will be df -> NO_FIELDS, df.a, df,b
And that would error since df.b isn't set.
The correct answer though is to have it be Zero() -- inb has not effect on y
We need to add something that checks propertynames and if not found returns zero, to getproperty
Testcase is:
@test Composite{Foo}(;a=1.4).b === Zero()
Metadata
Metadata
Assignees
Labels
Structural TangentRelated to the `Tangent` type for structured (composite) valuesRelated to the `Tangent` type for structured (composite) valuesbugSomething isn't workingSomething isn't working