-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I am playing around with Espresso and XDiff, because I think it would be cool for some future version of LossFunctions.jl to generate all the losses, their derivatives, and their properties just based on defining the function (like @makeloss L(x) = 1/2 * x^2)
Taking the example of a simple popular version of the least squares loss L(x) = 1/2 * x^2, I found that rdiff changes the operation * to the broadcasted version .* which seems to prevent constant folding
julia> using Espresso, XDiff
julia> rdiff(:(1/2 * x^2), x=1.)
Dict{Symbol,Expr} with 1 entry:
:x => :(0.5 .* (2x))
julia> simplify(:(0.5 .* (2x)))
:(0.5 .* (2x))
julia> simplify(:(0.5 * (2x)))
:xIs this expected behaviour? How would you suggest to deal with such cases?
Metadata
Metadata
Assignees
Labels
No labels