Skip to content

Error differentiating functions with in-place mutation #78

@Antomek

Description

@Antomek

Hello,

Thank you for the work on this very useful project!

I am running into an issue where I cannot use ComponentArrays with a function which mutates its du.

As a MWE, running this example, but replacing

function dudt(u, p, t)
    @unpack L1, L2 = p
    return L2.W * tanh.(L1.W * u.^3 .+ L1.b) .+ L2.b
end

with

function dudt(du, u, p, t)
    @unpack L1, L2 = p
    du .= L2.W * tanh.(L1.W * u.^3 .+ L1.b) .+ L2.b
end

yields the error:

ERROR: LoadError: type TrackedArray has no field L1

Am I doing something wrong? Can this be fixed somehow?

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