How to convert Array{Array{Float64,2},1} to Array{Array{Float16,2},1}

I am trying to convet an Array then got this error, how can I fix it ?

typeof(MME)

Array{Array{Float64,2},1}

mme = convert(Array{Float16},MME)

ERROR: MethodError: Cannot convert an object of type Array{Float64,2} to an object of type Float16

thank you in advance

This is the wrong type — you aren’t trying to convert MME to Array{Float16}, but rather you are trying to convert its elements to this type.

If you want to call convert like this, you need to apply it elementwise:

convert.(Array{Float16}, MME)

You can also use:

Array{Array{Float16,2},1}(MME)

or

convert(Array{Array{Float16,2},1}, MME)
6 Likes