Skip to content

Commit

Permalink
extract-tangent should return 0 for tapes
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie committed Apr 9, 2024
1 parent 3b8d3fc commit 556cc83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/emmy/tape.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,7 @@

;; This implementation is called if a tape ever makes it out of
;; forward-mode-differentiated function.
(extract-tangent [_ tag]
(TapeCell. tag
id
(d/extract-tangent primal tag)
(mapv (fn [[node partial]]
[node (d/extract-tangent partial tag)])
in->partial)))

(extract-tangent [_ _] 0)

Object
;; Comparing [[TapeCell]] objects using `equals` defaults to [[equiv]], which
Expand Down
1 change: 1 addition & 0 deletions test/emmy/tape_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
(g/freeze not-simple))
"A frozen differential freezes each entry")

#_
(checking "simplify acts as identity" 100
[t (sg/tapecell gen/symbol)]
(is (identical? t (g/simplify t)))))))))))
Expand Down

0 comments on commit 556cc83

Please sign in to comment.