https://github.com/JuliaLang/julia
Revision b84fe52c8876de1537c50481546a734cc1990441 authored by Keno Fischer on 28 October 2018, 19:24:13 UTC, committed by GitHub on 28 October 2018, 19:24:13 UTC
* Make broadcast recursion in `flatten` structural

The inference enhancements in #29294 work quite well to prevent limiting
on many kinds of code. However, targetting TPUs, one code pattern it
struggeled with was a fairly large broadcast fusion in Flux:

     λ.(reshape(γ, affine_shape...) .* ((x .- μ) ./ σ) .+ reshape(β, affine_shape...))

The reason #29294 is because the make_makeargs function used by the
implementation of Broadcast.flatten (which the TPU backend uses) had
a non-decreasing first argument (passing the return value of a previous
invocation of make_makeargs back in as the first argument). However,
that's not a fundamental limitation of the operation, but rather an
implementation choice. This PR switches that function's recursion pattern
to be purely structural, allowing inference to infer through it (with
the changes in #29294). As a result, ResNet50 infers properly.

* Comment spelling fix

Co-Authored-By: mbauman <mbauman@gmail.com>
1 parent 1038233
History
Tip revision: b84fe52c8876de1537c50481546a734cc1990441 authored by Keno Fischer on 28 October 2018, 19:24:13 UTC
Make broadcast recursion in `flatten` structural (#29816)
Tip revision: b84fe52
File Mode Size
.circleci
.github
base
contrib
deps
doc
etc
src
stdlib
test
ui
.freebsdci.sh -rwxr-xr-x 1.2 KB
.gitattributes -rw-r--r-- 67 bytes
.gitignore -rw-r--r-- 235 bytes
.mailmap -rw-r--r-- 9.5 KB
.travis.yml -rw-r--r-- 6.9 KB
CONTRIBUTING.md -rw-r--r-- 20.5 KB
DISTRIBUTING.md -rw-r--r-- 23.6 KB
HISTORY.md -rw-r--r-- 238.0 KB
LICENSE.md -rw-r--r-- 5.1 KB
Make.inc -rw-r--r-- 36.4 KB
Makefile -rw-r--r-- 28.3 KB
NEWS.md -rw-r--r-- 1.9 KB
README.arm.md -rw-r--r-- 5.7 KB
README.md -rw-r--r-- 29.3 KB
README.windows.md -rw-r--r-- 13.0 KB
VERSION -rw-r--r-- 10 bytes
Windows.inc -rw-r--r-- 1.5 KB
appveyor.yml -rw-r--r-- 2.6 KB

README.md

back to top