Flux bilinear upsampling

What is the best way to use Flux to create a bilinear upsampling layer? Something analogous to tensorflow bilinear upsample.

I appreciate your insight in advance.

1 Like

Decided to go for it.

1 Like

The implementation effort has moved to this pull request.

I got the forward part working for both CPU and GPU, but gradient doesn’t work in the GPU case (it does in the CPU case). It seems hard to debug because Juno’s debugger crashes when I try to get into the gradient call. Who here has more experience getting gradients through with CuArrays?

x = Float32.([1 2; 3 4])[:,:,:,:]
x_c = CuArray(x)

c = BilinearUpsample2d((2,2))
c_c = gpu(c) #don't think this does anything, since there are no arrays stored

o = c(x)
o_c = c(x_c)

g = gradient(x -> sum(c(x)), x)[1]
g_c = gradient(x -> sum(c(x)), x_c)[1]
@Juno.run gradient(x -> sum(c(x)), x_c) #crashes on my setup

The error it gives is “unrecognized isdefined node $(QuoteNode(Float32))”, can’t find anything on it

My setup is Julia 1.4.1, Flux 0.10.5, Atom 1.46.0

Any ideas?