Calculation of Functions in a loop inside another Function

The signature does not match since:

julia> typeof([square,square]) <: Vector{Function}
false

You can either update:

to chain_cal(chain::Vector{<:Function}, x::CuArray) since

julia> typeof([square,square]) <: Vector{<:Function}
true

or update

to Function[square, square] which would create a Vector{Function} and thus match your signature since

julia> typeof(Function[square,square]) <: Vector{Function}
true

See relevant manual section.

2 Likes