Skip to content

Commit 20f7727

Browse files
authored
Update notes.md
1 parent 6d9d01f commit 20f7727

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ end
213213
A few observations:
214214
1. All dense primals are gone. In the pullback, they only appeared in places where they can be safely replaced with the primals themselves because they're doing array-like things. `C_dense` appeared in the construction of `restructure_C_pb`, however, we were using a sub-optimal implementation of that function. Much of the time, `restructure_of_pb` doesn't require `C_dense` in order to know what the pullback would look like and, if it does, it can be obtained from `C`.
215215
2. All direct calls to `rrule_via_ad` have been replaced with calls to functions which are defined to return the things we actually need (the pullbacks). These typically have efficient (and easy to write) implementations.
216-
3. `C̄_nat` could be any old `AbstractArray`, because it's conceptually the cotangent for an `Array`. For example, `pullback_of_restructure` for a `Diagonal` returns a `Diagonal`. This is good -- it means we might occassionally get faster computations in the pullback.
216+
3. It is permissible for `C̄_nat` to be any old `AbstractArray`, because it's conceptually the cotangent for an `Array`. For example, it is permissible for us to manually optimise `pullback_of_restructure` for a `Diagonal` to ensure that it returns a `Diagonal`. This is good -- it means we can occassionally get faster computations in the natural pullback.
217217

218218
Roughly speaking, the above implementation has only one additional operation than our existing rrules involving `ProjectTo`, which is a call to `restructure_C_pb`, which handles converting a structural tangent for `` into the corresponding natural. Currently we require users to do this by hand, and no clear guidance is provided regarding the correct way to handle this conversion, in contrast to the clarity provided here. In this sense, all that the above is doing is providing a well-defined mechanism by which users can obtain natural cotangents from structural cotangents, so it should ease the burden on rule-implementers.
219219

0 commit comments

Comments
 (0)