In Keras4Delphi I succesfully stored the output of a neural network into a variable. Now I want to simply read it from a Delphi array (in Delphi 10.3 Rio), not in string format but in a Double array type, from the numpy array format of Python. I get an error (Invalid variant operation) with the code I thought that should work.
I tried the following code (for XOR test in Keras4Delphi):
var x_test, y_test : TNDarray;
str_v : string;
y_out : TArray;
begin
x_test := TNumPy.npArray( [ [ 0, 1 ] ] );
y_test := model.Predict(x_test);
str_v := model.Predict(x_test).ToString; // --> works fine.
y_out := y_test.AsArrayofDouble; // --> Invalid variant operation, for : "y_out := model.Predict(x_test).AsArrayofDouble" also same error.
end.
Should I try another function instead of "AsArrayofDouble" to get the network output in a Delphi Double array? I searched for a proper function for hours but didn't find any.