I have a program that outputs a matrix and I have also a NN model that takes as input one element array.
I want to apply the NN to every element of the matrix.
I have tried in this way
my_model(x) = reshape(reshape(x, 1, :) |> model, size(x)) # takes the matrix, reshape it as 1xn matrix, apply the model on it and reshape the output as the input
the problemi is that the reshape function eats too memory and I can’t call GC.gc() after the function because I want to use the model in a Thread.@threads for.
What is the best way to apply a NN model to a data structure element by element?
Thank you and sorry for my english.