# Flux: Hidden problem broadcasting convolution layer on GPU?

**URL:** <https://discourse.julialang.org/t/flux-hidden-problem-broadcasting-convolution-layer-on-gpu/67316>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [August 30, 2021, 12:10am UTC](https://discourse.julialang.org/t/flux-hidden-problem-broadcasting-convolution-layer-on-gpu/67316 "2021-08-30T00:10:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattSainsbury-Dale](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattsainsbury-dale/32/221714_2.png) [@MattSainsbury-Dale](https://discourse.julialang.org/u/MattSainsbury-Dale)\
**Post date:** [August 30, 2021, 12:10am UTC](https://discourse.julialang.org/t/flux-hidden-problem-broadcasting-convolution-layer-on-gpu/67316/1 "2021-08-30T00:10:15Z")

</div>

I found the following comment in the [source code](https://github.com/FluxML/Flux.jl/blob/0a215462ad8e0ba795205c9e94864403207d63fa/src/layers/conv.jl#L32-L94) for the `Conv` layer for `Flux.jl`:

```julia
function (c::Conv)(x::AbstractArray)
  # TODO: breaks gpu broadcast :(

```

It’s a bit concerning, given that I am currently working on a project which involves broadcasting a CNN. I could not find a mention of this issue in the documentation.

Does anyone know what is meant by “breaks” (e.g., is it just slower, are the results incorrect, etc.), and what is meant by “gpu broadcast” (e.g., does it refer to broadcasting a `Conv` layer over an Array, or something else).

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [August 30, 2021, 3:13am UTC](https://discourse.julialang.org/t/flux-hidden-problem-broadcasting-convolution-layer-on-gpu/67316/2 "2021-08-30T03:13:42Z")

</div>

All that TODO means is that uncommenting the line immediately below it (`# ndims(x) == ndims(c.weight)-1 && return squeezebatch(c(reshape(x, size(x)..., 1)))`) broke broadcast at some point. I have my doubts it’s even relevant any more given the blame is from 4 years ago, but it’s presumably persisted since nobody has bothered to investigate whether the line above is still useful. Either way, it should _not_ affect broadcasting the conv layer itself.
