julia
b84fe52c - Make broadcast recursion in `flatten` structural (#29816)

Commit
7 years ago
Make broadcast recursion in `flatten` structural (#29816) * 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>
Author
Parents
Loading