Closed simonmandlik closed 4 years ago
Probably related to https://github.com/FluxML/Zygote.jl/issues/811
The problem was that there is a definition of adjoint for multiplication of two matrices. I have tried to implement an adjoint specifically for *
using rrule
, which fails:
function rrule( A::typeof(*), ::MyMatrix, B::AbstractMatrix) = ...
once it is defined with @adjoint
it works as expected:
Zygote.@adjoint A::MyMatrix * B::AbstractMatrix = ...
so I suspect this is a duplicate of https://github.com/FluxML/Zygote.jl/issues/811
Is it possible with Zygote to build custom
AbstractMatrix
subtypes with custom adjoints? I would like to have a matrix, that would behave like a standard dense matrix, but before left-multiplying a data matrix it fills all missing elements in that matrix by values from a vector of parameters:and everything works as expected:
However if I change the struct definition to:
this stops working and gives this error:
Is it possible to create custom
AbstractMatrix
subtypes in this way or does Zygote make it impossible?