Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Support for UniformScaling #50

Open
wesselb opened this issue Aug 22, 2017 · 3 comments
Open

Support for UniformScaling #50

wesselb opened this issue Aug 22, 2017 · 3 comments

Comments

@wesselb
Copy link
Contributor

wesselb commented Aug 22, 2017

UniformScaling is currently not supported:

julia> Leaf(Tape(), 0) + UniformScaling(1)
ERROR: MethodError: no method matching +(::Nabla.Leaf{Int64}, ::UniformScaling{Int64})
@willtebbutt
Copy link
Member

We need to be careful here. Apparently we're suppose to use

5 + UniformScaling(1).λ

as

5 + UniformScaling(1)

is deprecated. But yes, we definitely should support.

@iamed2
Copy link
Member

iamed2 commented Aug 22, 2017

2I is another way of spelling UniformScaling(2), by the way

@willtebbutt
Copy link
Member

willtebbutt commented Aug 31, 2017

As it turns out, this is actually quite a troublesome implementation. Consider the reverse-mode sensitivity of

Y = 5 * UniformScaling(x)

w.r.t. x, where x is a scalar. If the reverse-mode sensitivity of Y is itself a UniformScaling, then the answer is undefined because we have not provided any information regarding the size of the matrices that any of the UniformScalings are meant to represent. If, only the other hand, has a particular size, say it's N x N, then the solution is well defined (it's 5 * sum(diag(Ȳ))).

Phrased differently, the reverse-mode sensitivity of x is x̄ = 5 * sum(diag(Ȳ)). If has a constant diagonal, say β, then this becomes x̄ = 5 N β where Y has size N x N. If is itself represented by a UniformScaling, then we don't know N.

There are other problems than the one I've presented here, but they pretty much all seem to stem from UniformScalings not coming with any size information; it's the things with which they interact that give them some notion of size.

Am I thinking about this the right way, or have I missed something obvious?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants