Single number and array as input in Flux model

Suppose I have a Flux simple model like this:

model = Dense(1, 10)

If I try to call this model with a single number I get an error:

model(0.3)  # ERROR

However If I do this the model works correctly:


Do I always have to convert the number into an array?
Is there a more elegant way to do this?

How can I call the model on an array or on a matrix? (I want to call the model on every single number of the array)
This doesn’t works with single numbers:

my_model(x) = reshape(reshape(x, (1, length(x))) |> model, size(x))

Thank you and sorry for my english

A neural network is a combination of some matrices and vectors. So every input is an array and not a number.