Comments (1)
Yes, this is expected. In both - Julia 0.5 and 0.6 operator .*
is allowed on scalars and behaves the same way as *
. The reason to use .*
in the corresponding derivative rule is to support broadcasting for tensors. In short, when rdiff
can't find tensor differentiation rule for some operation (e.g. log()
), it looks for the corresponding rule for scalars instead an infers rule for tensors. Having .*
instead of *
in scalar rules is the simplest way to make scalar rules to work in both cases.
Note, that this may totally change once Julia 0.6 is out and XDiff is adapted to support new broadcasting rules.
It doesn't mean your example shouldn't work in the current version, though. simplify
(as well as many other transformations here) work via a set of extensible rules, and you can easily define new ones:
julia> simplify(:(0.5 .* (2x)))
:(0.5 .* (2x))
julia> @simple_rule (0.5 .* (2 * _x)) _x # _x is a placeholder that matches anything
julia> simplify(:(0.5 .* (2x)))
:x
At some point I will add this rule to Espresso, but right now I'm a bit suspicious about .*
and *
since they play an important (and different!) roles in the differentiation process.
from xdiff.jl.
Related Issues (20)
- Error tagging new release
- Test on GPUArrays HOT 5
- Special functions HOT 1
- Support tuples as return types HOT 1
- Parse nested function calls HOT 1
- Unpack struct fields HOT 1
- Documentation
- Cache derivative function for different input sizes
- Deprecate from_einstein?
- Self-consistency checks?
- Test ALL to_buffered rules
- Multiple methods for a derivative function HOT 1
- Support simple loops
- `meta` field and keyword arguments HOT 1
- Info about upcoming removal of packages in the General registry
- Support broadcasting HOT 1
- Add derivatives for convolution HOT 5
- `propagate_size` is broken for :(z = log(sum(x)))
- Reduce common subexpressions HOT 1
- Improve correctness
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdiff.jl.