Skip to content

Commit 4303bb8

Browse files
authored
Merge pull request #77 from shashi/s/mul-scalar
Restrict the scalar multiplication rules to `Number`s
2 parents 5c68a9e + 2bedd08 commit 4303bb8

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)