Code fails in jupyter notebook, but succeeds in REPL

I have the following code

using Statistics
using LinearAlgebra
using ForwardDiff
using Plots
using Revise
using Distributions
using DelimitedFiles


## Construct the offsets


cur_offset = collect([range(reverse(offsetrange)...,length=Int(dim/2));range(offsetrange...,length=Int(dim/2))]);


cur_offset is then used as an argument all over my code, and that all seems to work fine. I then try and modify the parameter with the following

cur_offset = cur_offset .+ (m_grads_α .* dropdims(norm_α_grad;dims=1));

and this simply will not run inside the jupyter notebook, or inside a script. The code hangs there and will not execute the next line, which is printing cur_offset. It will run fine in the REPL.

If I run the command

println( cur_offset .+ (m_grads_α .* dropdims(norm_α_grad;dims=1)))

then this will succeed wherever I run it. So it seems to me that the assigment in the compiler is what is causing problems.

I also have issues with the command
println(typeof(cur_offset .+ (m_grads_α .* dropdims(norm_α_grad;dims=1))));
in the notebook or scripts, but again no problems at all in the REPL.

Please advise on how I can fix this, or on further information I need to give so that this bug can be resolved!