julia中reshape遇到类型转换的问题

我有一个矩阵嵌套向量的数据格式,例如:Array{Array{Float64,1},3},因为有需要这样存放数据的需求
然后我需要将给它重置大小为Array{Array{Float64,1},1} , 我使用reshape(x,:),在测试中没遇到问题,但是在整体项目代码中跑就提示convert转化异常!翻看源码也没理解为何会这样!
如果在跑的时候把数据放在全局变量里,再跑jupyter里跑reshape又没问题,不知道怎么回事,求大佬告知原因!



# 项目跑的代码
function flatten(x::Array{Array{T,1},3};row::Bool=false) where T <: Real
    (row == true) && (x = permutedims(x,reverse(collect(1:ndims(x)),1,2)))
    @show typeof(x),size(x)
    global what = x
   return reshape(x,:)
end

# 测试,这个跑的时候没异常
function fill_copy!(a::Array, x)
    for i in eachindex(a)
        @inbounds a[i] = copy(x)
    end
    return a
end
fill_copy(v, dims::NTuple{N, Integer}) where {N} = fill_copy!(Array{typeof(v),N}(undef, dims), v)

s = fill_copy(rand(Float64,3*3*3),(3,3,3))
@show typeof(s)
s1=reshape(s,:)
@show typeof(s1)

你能给一个可运行的出问题的example么,但看截图的话并不清楚具体是在哪一步报的错误

没事了,谢谢了,是我自己的问题!:joy: