Skip to content

Commit 2bedd08

Browse files
author
ShashiGowda
committed
Restrict the scalar multiplication rules to Numbers
1 parent 84a1763 commit 2bedd08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rulesets/Base/base.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474

7575
# product rule requires special care for arguments where `mul` is non-commutative
7676

77-
frule(::typeof(*), x, y) = x * y, Rule((Δx, Δy) -> Δx * y + x * Δy)
77+
frule(::typeof(*), x::Number, y::Number) = x * y, Rule((Δx, Δy) -> Δx * y + x * Δy)
7878

79-
rrule(::typeof(*), x, y) = x * y, (Rule(ΔΩ -> ΔΩ * y'), Rule(ΔΩ -> x' * ΔΩ))
79+
rrule(::typeof(*), x::Number, y::Number) = x * y, (Rule(ΔΩ -> ΔΩ * y'), Rule(ΔΩ -> x' * ΔΩ))
8080

8181
frule(::typeof(identity), x) = x, Rule(identity)
8282

0 commit comments

Comments
 (0)