procedure Load_Warch(Warch : in out T_Warch) is
--Source_Filename : in String) is
Warch_File : Ada.Streams.Stream_Io.File_Type;
Warch_File_Access : Ada.Streams.Stream_Io.Stream_Access;
Warch_Filename : constant String := "warch.wa";
Trainfile : String(1..256) := (others => Character'Val(32));
Network : String(1..256) := (others => Character'Val(32));
Width : Positive;
begin
Ada.Streams.Stream_IO.open(Warch_File, Stream_Io.Out_File, Warch_Filename);
Warch_File_Access := Ada.Streams.Stream_IO.Stream(Warch_File);
-- Load width of Warch --
Text_Io.Put("Load Warch of width = " );
Positive'read(Warch_File_Access, Warch.Arch_Width);
Text_Io.Put_Line(Integer'Image(Warch.Arch_Width));
-- Load archs --
for I in 1..Warch.Arch_Width-1 loop
Text_Io.Put("network of width = " );
Positive'Read(Warch_File_Access,width);
Warch.arch(I) := new T_Node(Width);
Text_Io.Put_Line(Integer'Image(Warch.arch(I).width));
Text_Io.Put("train filename = " );
string'Read(Warch_File_Access, trainfile);
Warch.Arch(I).Network.Trainfile := Unbounded.To_Unbounded_String(Trainfile(1..Fixed.Index_Non_Blank(Trainfile, Ada.Strings.Backward)));
Text_Io.Put_Line(Unbounded.To_String(Warch.Arch(I).Network.Trainfile));
Positive'Read(Warch_File_Access,Warch.Arch(I).Network.Train_Length);
Float'Read(Warch_File_Access, Float(Warch.Arch(I).Network.Converged));
Positive'Read(Warch_File_Access,Warch.Arch(I).Network.Max_Epochs);
Float'Read(Warch_File_Access, Float(Warch.Arch(I).Network.RMS_Error));
Positive'Read(Warch_File_Access,Warch.Arch(I).Network.Current_Epoch);
Boolean'Read(Warch_File_Access,Warch.Arch(I).Network.Reuse_Network);
Text_Io.Put("Network filename = " );
String'Read(Warch_File_Access, network);
Warch.Arch(I).Network.Network := Unbounded.To_Unbounded_String(Network(1..Fixed.Index_Non_Blank(Network, Ada.Strings.Backward)));
Text_Io.Put_Line(Unbounded.To_String(Warch.Arch(I).Network.Network));
delay 10.0;
end loop;
Ada.Streams.Stream_IO.Close(Warch_File);
end Load_warch;